A tip that I didn't mention in the video is when you're iterating through the dataset to create the sample weights is to iterate through dataset.imgs rather than just dataset. This will run much faster because we are not resizing, performing transformations and so on which we do not need to do when we are only interested in the labels of the examples.
@amnesie1483 жыл бұрын
Hi Aladdin , First of all thank you for the super good video, but I didn't figure out which part should be " iterate through dataset.imgs ", can you point it out?
@imveryhungry1122 жыл бұрын
the pytorch weighted random sampler is an amazing pytorch feature. Thanks for talking about it here.
@sahasamanecheppali5473 жыл бұрын
You sir, deserve way more subscribers for the consistency and the diversity of the topics you choose. Keep up the good work.
@wolfisraging3 жыл бұрын
Awesome video bro, this has been really helpful. I'd like to share one trick of mine: Applying more random and strong data augmentation to the examples that are limited, and less random augmentation on examples that are quiet enough, and then making sure that each batch to the model receives an equal number of examples for each unique label. The only side effect here would be that you'd have to write your own custom dataloader that does that 🥱, and to be honest, it's not easy 😂, but once you set it up then its just a matter of copying and pasting for next projects :) Thanks again for the video.
@AladdinPersson3 жыл бұрын
Hey Wolf! :) That sounds interesting, I would like to check it out if you could you share an example of such a custom dataloader?
@rosacanina6745 ай бұрын
Thank you so much for your great content! I was wondering if the loader in the video is the train_loader? do you also apply oversampling on dev_train and test dataloader?
@jacoblee62463 жыл бұрын
Great video!A small bug: The orders of traversal between os.walk and datasets.ImageFolder are different. In the github code, We cannot guarantee that the smaller number of samples will get a greater sampling weight.
@yashrunwal51113 жыл бұрын
Hi, how can we use the WeightedRandomSampler for Object Detection task?
@mochametmachmout44673 жыл бұрын
To tackle the imbalance one can also use the Focal Loss function. The kornia library has it.
@rafaelmahammadli6672 жыл бұрын
Hello, How can we apply under-sampling on your case? Oversampling and undersampling can be applied together? Thank you
@Zulle863 Жыл бұрын
Does we have to call get data loader for once for train and once for test set or just a single time for the entire dataset?
@kirankharel9293 жыл бұрын
Thanks Aladdin for all your videos, they are really awesome and informative
@AladdinPersson3 жыл бұрын
Really appreciate it bro
@yanfeng5519 Жыл бұрын
Great lecture.
@clariolee Жыл бұрын
人像加入视频时候舒服多了!!不知道看哪的时候就看脸哈哈哈。
@fasolya993 жыл бұрын
why did you multiply the sample_weights (which is zero) by len(dataset) ?
@frankrobert91992 жыл бұрын
Great lectures.
@thantyarzarhein54593 жыл бұрын
Awesome video and this channel is so underrated in DL community. I would like to know if there will be paper implementation tutorials in the future ?
@AladdinPersson3 жыл бұрын
Yeah for sure. Any paper in particular you'd wanna see?
@aishwaryaagarwal35403 жыл бұрын
@@AladdinPersson arxiv.org/pdf/1905.05908.pdf This one if possible. Can you make some tutorials on compositional zero-shot learning and implement some papers in that field.
@0730pleomax3 жыл бұрын
Thanks Aladdin! Would you mind recommend us your learning resources? I mean most of your teaching content are pretty rare in any ML/DL book.
@AladdinPersson3 жыл бұрын
I'm just sharing solutions to problems I face. Googling, reading docs and github, no good learning resource there unfortunately
@hassanrevel Жыл бұрын
Thanks man
@sebastianamaruescalantecco79163 жыл бұрын
There is a bug in the program that can cause you a lot of trouble. After line 22 add this line of code -> subdir.sort() os.walk() won't traverse your folders in alphabetical order so you have to sort the generator before appending the calculated weights. The could should look something like this: for root, subdir, files in os.walk(root_dir): subdir.sort() if len(files) > 0: ....
@bryanyan83462 жыл бұрын
The same problem arises for me, thanks for pointing out!
@hamidmahmoodpour36592 жыл бұрын
why we can not use shuffle while using sampler?
@ZulkaifAhmed13 жыл бұрын
Dude you are awesome. I like your pytorch tutorials. But would love if you could use google colab for next ones.
@mariaanson65373 жыл бұрын
What is the editor or Ide you are using
@nishantyadav63413 жыл бұрын
Aladdin, you deserve more subscribers. And you need to charge more :) Just joined as a member.
@AladdinPersson3 жыл бұрын
Appreciate you bro
@helimehuseynova66312 жыл бұрын
Hi , If we have 3 classes, how can we do it ?
@kelixoderamirez Жыл бұрын
permisiion to learn sir. thank you
@sahil-74733 жыл бұрын
Superb!! I implemented AugMix DataAugmentation myself to increase the minority label's samples. My question is should we stick around one data augmentation technique which is state of the art OR we should try all of the others technique? Thanks
@AladdinPersson3 жыл бұрын
I prefer to use RandAugment
@mustafabuyuk64253 жыл бұрын
Randaugment is one of the best augmentation method, it will improve your model performance and I was using weight normalization like this nSamples = [346,168,106] # class samples normedWeights = [1 - (x / sum(nSamples)) for x in nSamples] normedWeights = torch.FloatTensor(normedWeights).to(device) print(normedWeights) nn.CrossEntropyLoss(weight=normedWeights) is your second method different than this
@AladdinPersson3 жыл бұрын
I prefer oversampling (and you can still use RandAugment) rather than class weighting as it seems you're doing in the example
@НиколайНовичков-е1э3 жыл бұрын
Thanks!
@TheAcujlGamer3 жыл бұрын
Great video!
@Tripdin3 жыл бұрын
Thank you
@kirtipandya46183 жыл бұрын
How can you use pytorch and tensorflow so well. You must have invested so many hours of practice. How do you do that? Which API you like more for ML? In Keras you handle images differently and in pytorch you handle differently. It amazing to see that you have mastery over both. Well less people can do that. Usually people like to work with only one API.
@AladdinPersson3 жыл бұрын
I like PyTorch more. I think you overestimate me for sure, I'm way worse than what you think and need to google everything. You just see the refined version in the video and not the horrible mistakes I make :)
@jimmychen47963 жыл бұрын
@@AladdinPersson You are too humble bro! A nice lesson learned: ), good job, and keep going!
@shaharweksler12033 жыл бұрын
@@AladdinPersson maybe you can make a video about how you get stuck and your train of thoughts and google queries to solve it
@mattiagatti12002 жыл бұрын
Hello, I still don't understand how replacement = True differs from replacement = False, may you explain me it please? Thank you :)
@erdi7493 жыл бұрын
Another amazing tutorial! I wonder if you have a patreon page where we can support you, it is well deserved. I have a question as well. I have a large imbalanced dataset. I need to call getloader function to get train and test loaders for hyperparamter tuning. Scanning the entire trainset in each function call makes the code slower. Do you suggest a work around? Thank you!
@amirhosseindaraie56222 жыл бұрын
Hi Aladdin, Your code does not work and the result is still imbalanced. What should we do?
@AladdinPersson2 жыл бұрын
Why does the code "not work"?
@jijie1333 жыл бұрын
Great video!
@sakib.94193 жыл бұрын
I've been trying to do this in TensorFlow with ImageDataGens for over 5 hrs now, Could you help out?
@AladdinPersson3 жыл бұрын
I'm not sure how you do it in Tensorflow
@sakib.94193 жыл бұрын
@@AladdinPersson That's fine, d'you have a discord btw?
@apurbasarkar69183 жыл бұрын
how to do it in tensorflow? I'm struck
@tirthadatta2072 Жыл бұрын
Can u give me solution about computational cost or memory allocation problem related to oversampling imbalance dataset. It is too hard for me to buy gpu because of high cost and it is also problem for many of us. Can anyone here give solution related to the issue?
@유영재-c9c2 жыл бұрын
dataset link over!
@robinranabhat3125 Жыл бұрын
Recap at 9:00
@seanbenhur3 жыл бұрын
Bro..are you in linkedin!?
@AladdinPersson3 жыл бұрын
Yeyup, same name :)
@seanbenhur3 жыл бұрын
@@AladdinPersson Request sent😌
@ArunKumar-sg6jf3 жыл бұрын
Do in TENSORFLOW also bro
@AladdinPersson3 жыл бұрын
I don't know a good way to do it in Tensorflow... :\ Maybe someone else knows and can help out?
@wolfisraging3 жыл бұрын
I've been using it in almost every other projects... but never understood what's so random about it? Why random in its name? 🙂