Build Your First Pytorch Model In Minutes! [Tutorial + Code]

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 101

  • @manuelsteele7755
    @manuelsteele7755 หลายเดือนก่อน +13

    I am an old Gen X guy who had written a thesis on 2-dimensional image processing for nuclear medicine back in the 1990s for a master's degree on C/Unix. In 2021, I returned for a PhD in AI/ML for healthcare. I am taking a modern course on medical imaging with a deep learning expert at Arizona State. The problem is that he assumes every student already knows how to apply deep learning with data loaders, training, and testing for large batch jobs on cloud clusters in the first week. Needless to say, I fell behind but am slowly catching up. This video is a "must" and the best I have seen to really explain the basic depth of defining datasets, data loaders, training, testing, and analysis to a good set of images. The overall activity flow actually applies to the chest x-rays I have been assigned for deep learning using ResNet or other models. I am going to review the notebook in more details. This really helps. Thank you.

  • @VlivinG
    @VlivinG ปีที่แล้ว +21

    I have a course at university and here I am learning things they should teach... your explanations are short and clear thanks! after my score submission, I will email your channel to my professor and his assistant as a clear example of what education is

    • @ben_jamin01
      @ben_jamin01 11 หลายเดือนก่อน

      I don't do computer science or university or anything, but I think that you're are an example for other educators.

    • @mugdhoamin8033
      @mugdhoamin8033 11 หลายเดือนก่อน +2

      😂😂
      In my case if I mail my teacher, I highly doubt he would open the mail let alone try to teach like this channel.

  • @pharod77
    @pharod77 ชั่วโมงที่ผ่านมา

    The best video on subject I was able to find. Thank you so much for your work!

  • @vitorribeirosa
    @vitorribeirosa 7 หลายเดือนก่อน +14

    Thank you, Rob!!!
    I strongly appreciate your work. I have learned a lot from your videos.
    Cheers from Japan!!!

  • @khalilnaji36
    @khalilnaji36 9 หลายเดือนก่อน +18

    This man is single-handedly carrying the education side of TH-cam for Data Science on his back

    • @checkmyvideos8118
      @checkmyvideos8118 4 หลายเดือนก่อน

      how? He just babbles stuff to type without explaining what it is and where it comes from

  • @johanongchangco8525
    @johanongchangco8525 ปีที่แล้ว +11

    Best video ever. I had my 14 year old watching with me and he understood it with very little commentary from me :)

  • @Healsi95
    @Healsi95 ปีที่แล้ว +6

    Wow, Rob. What an amazing video, I'm currently learning Deep Learning from scratch and your video is great to understand how to cod these networks and how to apply all those concepts learned in other videos about how Neural networks work.
    I'll be waiting for the next video, hoping you enlighten me over how how to tune the network, maybe transfer learning with CNNs along with attention modules would be just awesome!

  • @brianperez3808
    @brianperez3808 2 หลายเดือนก่อน +1

    Pro tip:
    freeze the base model layers for faster training in the SimpleCardClassifier class
    self.features = nn.Sequential(*list(self.base_model.children())[:-1])
    for param in self.features.parameters():
    param.requires_grad = False

  • @chrisogonas
    @chrisogonas 7 หลายเดือนก่อน +1

    Well illustrated! Thanks Rob.

  • @sriramabhaktahanuma
    @sriramabhaktahanuma 11 หลายเดือนก่อน +3

    Hey Rob.. thanks for the video. Well structured and well paced. Please do many end to ends like these.

  • @rayray9996
    @rayray9996 10 หลายเดือนก่อน +1

    I love the way you explain, but please post videos using R as well....how about time series forecasting with machine learning using R...

  • @hugoczerniawski166
    @hugoczerniawski166 ปีที่แล้ว +1

    Great vid Mr Mulla! I got confused at the last stage a bit but the confusion was mainly casued by my relativley small exprience with PyTorch. I will try to calclute the accurancy now! Thank you!

  • @cosheimil
    @cosheimil ปีที่แล้ว +1

    Thank you for this video! Its a lot of notebooks with torch and ur video helped me, thank you!

  • @christiansnaturestudio6599
    @christiansnaturestudio6599 ปีที่แล้ว +1

    Im looking forward to add it to my project portfolio. Money money money 💰

  • @drewgrant1605
    @drewgrant1605 3 หลายเดือนก่อน

    Great video! Super helpful. It was a comprehensive yet not too detailed introduction. Question though, why did you add “@property” with the classes method in the PlayingCardDataset object?

  • @spencermarx2049
    @spencermarx2049 4 หลายเดือนก่อน

    Great video! All the necessary things to get the main ideas, and no rambling on the side. The video is 31:31 long, and contains exactly 31:31 of content.

  • @hlolkukuku
    @hlolkukuku 9 หลายเดือนก่อน +1

    def calculate_accuracy(model, data_loader, device):
    model.eval()
    correct = 0
    total = 0
    with torch.no_grad():
    for images, labels in data_loader:
    images, labels = images.to(device), labels.to(device)
    outputs = model(images)
    _, predicted = torch.max(outputs.data, 1)
    total += labels.size(0)
    correct += (predicted == labels).sum().item()
    return 100 * correct / total
    # After training, calculate accuracy on the test set
    test_accuracy = calculate_accuracy(model, test_loader, device)
    print(f"Test Accuracy: {test_accuracy}%")
    the Test Accuracy is 93.20754... %
    Hope thats correct and helps!

  • @nursemulla
    @nursemulla ปีที่แล้ว

    I think Scarlett knows more about this than me. She started taking a coding class! : )

  • @خالدابوطالب-ع2ب
    @خالدابوطالب-ع2ب 9 หลายเดือนก่อน

    What a great video! You speaks so similar to Cal Newport

  • @ramprasath6424
    @ramprasath6424 10 หลายเดือนก่อน +1

    really helpful vid
    looking out for more of similar

  • @jees__antony
    @jees__antony 9 หลายเดือนก่อน

    this is the best vdo I have seen on pytorch

  • @ShahafAbileah
    @ShahafAbileah 5 หลายเดือนก่อน

    Thanks for making this video! I wonder if it's necessary to define the PlayingCardDataset class at all? It looks like it's a thin wrapper around ImageFolder, which itself inherits from Dataset and already provides all the necessary functionality. So, rather than doing `dataset = PlayingCardDataset(...)` you could simply do `dataset = ImageFolder(...)` and similarly provide the folder path and the transform to use. Right? Perhaps the point here was to indicate that often you _will_ want to define your own dataset class, in order to something more custom, so it helps to introduce the concept here, even if it's not really necessary in this case.

  • @EvanBurnetteMusic
    @EvanBurnetteMusic ปีที่แล้ว +3

    Hey Rob thanks for this perfect intro to pytorch! I've been learning TFJS and this vertical slice really helped. I'm trying to run this on Kaggle and I'm running into this problem: LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on. This is my first time using Kaggle so I'm not sure what I'm doing wrong. No worries if you have no idea either just thought you should know!

    • @EvanBurnetteMusic
      @EvanBurnetteMusic ปีที่แล้ว +5

      I just asked ChatGPT and it seems like you have to turn on internet on Kaggle instances under notebook options in the right sidebar!

    • @ShahafAbileah
      @ShahafAbileah 5 หลายเดือนก่อน

      @@EvanBurnetteMusic Thanks for that! Looks like you now need to verify your Kaggle account (add a phone number and get a code via SMS). That gives you the option to turn on internet, and also to get GPU support.

  • @VijayJaisankar
    @VijayJaisankar ปีที่แล้ว +1

    Thanks for this video! Really nice to brush up on the basics :)

  • @andrelvcoelho
    @andrelvcoelho ปีที่แล้ว +4

    Hi, Rob! Very nice video tutorials you have in your channel! I like them very much. Detailed and at the same time straight to the point. Just a small note: This line is mistaken in your script: test_loader = DataLoader(val_dataset, batch_size=32, shuffle=False). It should be "test_dataset," instead. Perhaps you should generate a new version on Kaggle. All the best!

  • @95Coaster
    @95Coaster 10 หลายเดือนก่อน

    I see what you did there with the joker cards in the test data set ;-)

  • @youaintd1
    @youaintd1 ปีที่แล้ว +1

    Great one! I'm on mac, so I replaced Cuda with Metal...
    device = torch.device("mps" if torch.backends.mps.is_available() else "cpu")

  • @aryanverma7506
    @aryanverma7506 3 หลายเดือนก่อน

    You have just inspired me. Smashed that Subscribe button .

  • @muhammadfahad3577
    @muhammadfahad3577 7 หลายเดือนก่อน +1

    at 18:17 mark, he uses images object as a param to run the model. Where is he getting this images object from?? I don't see it anywhere above except for when he runs that for loops and pull images from dataloader but that was inside the for loop so it cant be that.

  • @athleticsupramaxx9227
    @athleticsupramaxx9227 10 หลายเดือนก่อน +1

    at 22:10 you have "test_loader = DataLoader(val_dataset, batch_size=32, shuffle=False)" but it should be "test_loader = DataLoader(test_dataset, batch_size=32, shuffle=False)" right?

  • @ArunYadav-qq1cj
    @ArunYadav-qq1cj ปีที่แล้ว +1

    Plz make a pytorch playlist for intermediate to advanced. It is nowhere on the internet.

  • @designavideo1821
    @designavideo1821 ปีที่แล้ว

    Peace be upon you, how are you, my friend? I am from Iraq and I am a final-year university student in the Computer Engineering Department. He has a graduation project called controlling traffic lights using artificial intelligence (Python). I hope you will make a video designing a project with a program about simulating traffic lights for real cars.❤

  • @LittleTimmyJWC
    @LittleTimmyJWC 7 หลายเดือนก่อน +1

    What if we’re using multiple datasets? How would we change our code?

  • @Techonsapevole
    @Techonsapevole ปีที่แล้ว

    Thanks, well done

  • @raven9965
    @raven9965 7 หลายเดือนก่อน

    looking for advice, any resource or recommendations on haw to "grade" the performance of an ML besides error?

  • @Monarped1948
    @Monarped1948 หลายเดือนก่อน

    Hiss Rob. I am a beekeeper and as man other beekeeper we have an interest in analyze honey and see the sort of pollen Therese is in it and The number of each sort of pollen in it. It could be analyser by a picture of survey of honeyextract. Do you think that is possible to do Witherspoon this program?

  • @artyomkhrenn
    @artyomkhrenn ปีที่แล้ว

    Thanks, Rob!

  • @leminhdung1981
    @leminhdung1981 ปีที่แล้ว +1

    Thanks!

  • @delaramranjbarshargh9968
    @delaramranjbarshargh9968 8 หลายเดือนก่อน

    thank you. perfect.

  • @muhammadhananbaloch
    @muhammadhananbaloch หลายเดือนก่อน

    what does 239/239 in training loop progress and 9/9 in validation loop progress in each epoch represent at: 27:45

  • @SamiTuzcuoglu
    @SamiTuzcuoglu 11 หลายเดือนก่อน +1

    everything is good but there are sources for Image Classifier, Any chance you can make a video for object detection ? I couldt find any video or anything for that.

    • @robmulla
      @robmulla  11 หลายเดือนก่อน

      Check ouit my videos on yolov5 and yolov7. They are all about object detection.

    • @SamiTuzcuoglu
      @SamiTuzcuoglu 10 หลายเดือนก่อน

      hi @@robmulla, I meant using torch. I couldnt find any source that implementing object detection model using pytorch, all the object detection videos made by prepared models such as yolov5, yolov8, ssd, vgg etc.

    • @sidindian1982
      @sidindian1982 หลายเดือนก่อน

      ​@@robmulla where is the code???

  • @square007tube
    @square007tube 7 หลายเดือนก่อน

    Thanks for this video.

  • @sandeephooda9253
    @sandeephooda9253 หลายเดือนก่อน

    Thanks

  • @davoodastaraky7608
    @davoodastaraky7608 ปีที่แล้ว

    Thank you Rob :)

  • @abzrg
    @abzrg 2 หลายเดือนก่อน +1

    I'm watching this with 2x speed and still it doesn't feel fast

  • @artwork-studios
    @artwork-studios 4 หลายเดือนก่อน +1

    Im at 17:46

  • @manpham5635
    @manpham5635 ปีที่แล้ว

    This is incredible

  • @that_one_momo_guy
    @that_one_momo_guy ปีที่แล้ว

    Hi Rob, thanks for the fantastic video! I was left with an outstanding doubt: I don't see how the Adam optimizer 'gets' the information from the loss and backward propagation steps. There is a loss object on which we do backward propagation and then, seemingly completely separately, we do an optimization step with Adam.
    But how does Adam know in which direction to move without having, say, a loss argument? Say, something like "loss.backward(); optimizer.step(loss)" would make sense in my head.

    • @felixmuller9062
      @felixmuller9062 ปีที่แล้ว

      In an earlier line we gave the Adam optimized the model.parameters(). When we do all our computations through our model and in the end through our loss these computations will be stored in an internal state of the model. When we then call loss.backward() all these steps our tensors took through the model (and the loss) are run in reverse order and the backwards calculated gradients are also stored in the internal state of our model. And now hence the Adam optimized has the connection to the model parameters and we stored the backwards calculated gradients in our hidden state in the model, it is enough to call optimizer.step() and let the Adam do his magic.
      I hope this helps.

    • @that_one_momo_guy
      @that_one_momo_guy ปีที่แล้ว

      @@felixmuller9062 Wait that's the part that I don't get: the loss is computed based on the model predictions, but the loss object doesnt 'know' about the parameters right? Like, the model parameters are not an argument of the loss creator function

    • @felixmuller9062
      @felixmuller9062 ปีที่แล้ว

      No but the loss "measures" the deviation from the true classification. When you look in the formulas of the backpropagation algorithm you will see that the first derivative is the one regarding the loss function. From there on, following the chain rule, this flows in the different layers of the network and that's how the gradients for the weights can be calculated.
      Does this clarify a little more?

    • @that_one_momo_guy
      @that_one_momo_guy ปีที่แล้ว

      @@felixmuller9062 Ah I see, thanks! so just to make sure I get it: 'loss' is given a reference to the parameters of the model, and this parameters object has a 'bin' for gradients, so loss.backward() populates this bin?
      I think I was thinking too functional---the key is that backward does have a side effect on an object outside of it's 'house'. (Like loss.backward() modifies not only the loss object but also the parameters object.)

    • @that_one_momo_guy
      @that_one_momo_guy ปีที่แล้ว

      @@felixmuller9062 Wait nevermind, I'm confused again: the loss function does not get information about the model parameters or their location in memory. It just receives the predicted outputs and the correct labels. How does it know where to store the gradients computed?

  • @aryamankumar2712
    @aryamankumar2712 25 วันที่ผ่านมา

    goated video

  • @Bababoboboa-gu3iu
    @Bababoboboa-gu3iu 7 หลายเดือนก่อน +4

    Good job just copy-pasting code snippets no beginner would ever understand. Yes, I can take your code and train a model now. But I don't understand half the things you did.

  • @aarondrossart6026
    @aarondrossart6026 6 หลายเดือนก่อน +1

    Video is excellent. I'm just a coding idiot.

  • @chandramohan1281
    @chandramohan1281 11 หลายเดือนก่อน

    Is it possible to create tflite model so that we can use that in an Android??

  • @tilkesh
    @tilkesh 4 หลายเดือนก่อน

    print('Thank you')

  • @08胡溢朗
    @08胡溢朗 11 หลายเดือนก่อน +1

    I got the LocalEntryNotFoundError in
    model = SimpleCardClassifer(num_classes=53)
    print(str(model)[:500])

    • @08胡溢朗
      @08胡溢朗 11 หลายเดือนก่อน +1

      LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on.

  • @bladerun31
    @bladerun31 ปีที่แล้ว +1

    Can run on AMD Radeon gpu no issue?

    • @robmulla
      @robmulla  ปีที่แล้ว

      Nvidia really is the only option.

  • @carmizadok5491
    @carmizadok5491 5 หลายเดือนก่อน

    Amazing

  • @notacupofmilk2021
    @notacupofmilk2021 4 หลายเดือนก่อน +1

    10:49

  • @Levy957
    @Levy957 ปีที่แล้ว

    Amazing!!!!

  • @amogu_07
    @amogu_07 11 หลายเดือนก่อน +1

    model = SimpleCardClassifer(num_classes=53)
    print(str(model)[:500]) this is not running at all someone plz help

    • @marco8673
      @marco8673 6 หลายเดือนก่อน

      i also have this problem, did you solved it?

    • @marco8673
      @marco8673 6 หลายเดือนก่อน +1

      ok solved it, you just have to turn on the internet on the kaggle notebook

    • @amogu_07
      @amogu_07 6 หลายเดือนก่อน

      @@marco8673 tnx

  • @prasadjayanti
    @prasadjayanti 5 หลายเดือนก่อน

    quite useful 👋

  • @963seeker
    @963seeker ปีที่แล้ว

    Just a side note, the tqdm slows the processing speed. If you are using a PC equipped with the latest GPU(s) then thats fine, but if you are using a laptop you might want to exclude it from the code.

  • @obayram4615
    @obayram4615 ปีที่แล้ว

    great thanksss🙂

  • @kam3766
    @kam3766 ปีที่แล้ว

    Thank you Rob

  • @CS_n00b
    @CS_n00b ปีที่แล้ว

    very good

  • @DalazG
    @DalazG 10 หลายเดือนก่อน

    I wonder how i could create this for forex trading. Wish there was some tutorial

  • @Gunat737
    @Gunat737 ปีที่แล้ว

    Great

  • @RobertHorvat93
    @RobertHorvat93 8 หลายเดือนก่อน

    Am i the only one who thought this was Tai Lopez ? :))

  • @umarsaid6340
    @umarsaid6340 11 หลายเดือนก่อน +25

    When you say GPU, your picture is blocking it. Next time, it is better if you just hide your picture and let your voice do the explaining. No offense.

  • @zbaktube
    @zbaktube หลายเดือนก่อน

    You can delete this, just one note: You are not importing from nn.Module but you are inheriting from it. Not that important, just for the sake of OOP.

  • @08胡溢朗
    @08胡溢朗 10 หลายเดือนก่อน

    make a depth images pytorch

  • @showbikshowmma3520
    @showbikshowmma3520 11 วันที่ผ่านมา

    build a model to understand user's intent plz

  • @2380raj
    @2380raj 9 หลายเดือนก่อน

    55 upvotes and 581copy and edits on your kaggel notebook.Hard world out there...😑

  • @ericbroun4657
    @ericbroun4657 11 หลายเดือนก่อน

    ❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤

  • @itsfarseen
    @itsfarseen 5 หลายเดือนก่อน

    You robbed my precious 2 hrs rob mulla. I watched your How to Pytorch video hoping you'd show me how to build a model using Pytorch. Then I watched this video as well. Thanks for scamming me of my precious time and attention. You just showed how to import timm and call forward() on it. You didn't teach me how to make a model using Pytorch. Thank you so much 🙏 keep stealing everyone's time.

  • @itsfarseen
    @itsfarseen 5 หลายเดือนก่อน

    Don't watch. Waste of time.
    The whole video is just import timm; timm.Model().forward();

  • @aoa1015
    @aoa1015 11 หลายเดือนก่อน

    Thanks!