Official YOLO v7 Custom Object Detection on Colab

Поділитися
Вставка
  • Опубліковано 14 лип 2024
  • This YOLO v7 custom object detection tutorial is focused on training the custom model on Google Colab. After training, you can run inferencing locally or on Colab. The method is generic enough to train all seven variations of official YOLO v7 models. In our previous tutorial, we trained the base YOLO v7 custom object detector, and in this tutorial, we train YOLOv7x to compare the performance of these two variants.
    * Code and custom dataset is available for our Patreon Supporters*
    / thecodingbug
    Custom dataset development in YOLO v7 format:
    • Official YOLO v7 Custo...
    Setting up YOLO v7 locally:
    • Official YOLO v7 Custo...
    ---------------------------------------------
    ► Time Stamps:
    Introduction: (0:00)
    Setting up Colab: (0:29)
    Mounting Google Drive: (0:47)
    Cloning YOLO v7 Repository: (1:20)
    Creating Custom Dataset: (2:23)
    Training Custom YOLO v7 Model: (4:34)
    Inferencing Custom Objects: (7:55)
    Inferencing Custom Objects Locally: (9:00)
    ---------------------------------------------
    ► Links:
    github.com/WongKinYiu/yolov7
    ---------------------------------------------
    Want to discuss more?
    ►Join my discord: / discord
    #TheCodingBug
    ---------------------------------------------
    ► My Other Tutorials:
    ○ YOLO v7 Custom Object Detection (Win & Linux): • Official YOLO v7 Custo...
    ○ YOLO v7 Complete Tutorial (Colab): • Official YOLO v7 Objec...
    ○ YOLO v7 Complete Tutorial (Windows and Linux): • Official YOLO v7 COMPL...
    ○ 40 Object Detection Models in TensorFlow: • TensorFlow Object Dete...
    ○ Realtime Object Detection on CPU with OpenCV: • Realtime Object Detect...
    ○ DETECTRON2 Custom Object Detection, Custom Instance Segmentation Tutorial: Part 2 (Training Models): • DETECTRON2 Custom Obje...
    ○ DETECTRON2 Custom Object Detection, Custom Instance Segmentation Tutorial: Part 1 (Preparing Data): • DETECTRON2 Custom Obje...
    ○ Detectron2 on Colab: • DETECTRON2 TUTORIAL fo...
    ○ Instance Segmentation as Rendering: • DETECTRON2 PointRend T...
    ○ Detectron2 Complete Tutorial: • COMPLETE DETECTRON2 TU...
    ○ YOLOv4 On Android Using TFLite: • YOLOv4 TFLite Object D...
    ○ Custom YOLOv4 Object Detection with TensorFlow and TFLite : • Custom Object Detectio...
    ○ Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet): • YOLOv4 Custom Object D...
    ○ Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset): • YOLOv4 Custom Object D...
    ○ YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT: • YOLOv4 Object Detectio...
    ○ Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams: • Darknet YOLOv4 Object ...
    ○ Real-Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux: • YOLOv4 and YOLOv3 Obje...
    ○ Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows: • Object Tracking with T...
    ---------------------------------------------
    ► Follow us on Twitter: / bugcodingthe
    ► Support us on Patreon: / thecodingbug
    ---------------------------------------------
    DISCLAIMER: Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you!

КОМЕНТАРІ • 121

  • @brunospfc8511
    @brunospfc8511 Рік тому +3

    Another great tutorial, this channel should have far more recognition, some other tutorials take more time not to work, and they miss stuff, this is compact and complete, thanks

  • @CodeHacker278
    @CodeHacker278 Рік тому

    Hey thank you so much I used both methods from both videos but this one worked flawlessly

    • @omoklamok
      @omoklamok Рік тому

      hi can you help me followed the two both has problem but i thnk this colab should work because it use google gpu heres my output
      RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

  • @sanjaybhatikar
    @sanjaybhatikar 8 місяців тому

    So nicely explained!

  • @_Fangirling
    @_Fangirling Рік тому +1

    Thank you so much. You are the life saver!!!

  • @chad2149
    @chad2149 Рік тому

    Great tutorial! Thanks!

  • @jaiborade3421
    @jaiborade3421 Рік тому

    Great session by you sir..

  • @tsaibro
    @tsaibro 6 місяців тому

    amazing course. Helps a lot😉

  • @AiEdgar
    @AiEdgar Рік тому

    Thanks this might game on my toolbox

  • @IzeIzeBaby
    @IzeIzeBaby Рік тому

    Thanks alot this worked great but i didn't have to update yaml on my colab. It just worked :D
    Training takes a while but i'm used to worse since playing around with dreambooth / stable diffusion

  • @limtless232
    @limtless232 Рік тому

    Thank you so much for the great tutorials!
    I wanted to know if we can detect vehicle speed and capture over speeding vehicles real time? and capture their license plate. I am assuming we have to use yolov7 with opencv, but again I have no idea if that is possible or how to do it.

  • @haticeozdemir51
    @haticeozdemir51 Рік тому

    Hello. It's a very good video, well done. While I was testing on the test photo, I encountered the error "/bin/bash: -c: line 0: syntax error near unexpected token `('"). What could be the reason. Do you know?

  • @TECHNEWSUNIVERSE
    @TECHNEWSUNIVERSE Рік тому +6

    AssertionError: train: No labels in data/train/labels.cache. Can not train without labels.
    Can you please help me with this error

    • @fangirlpurpose4859
      @fangirlpurpose4859 Рік тому +1

      hey i have the same problem. have u solved the problem?

    • @TECHNEWSUNIVERSE
      @TECHNEWSUNIVERSE Рік тому +2

      @@fangirlpurpose4859 Please remove the cache file in google colab folder

    • @fangirlpurpose4859
      @fangirlpurpose4859 Рік тому

      @@TECHNEWSUNIVERSE thank u so much

    • @aryashinde6401
      @aryashinde6401 3 місяці тому

      Even after removing the cache files it's coming back after running. Any other solution?

  • @fangirlpurpose4859
    @fangirlpurpose4859 Рік тому

    Thank you for the tutorial. Can u help me why I have this problem?
    AssertionError: train: No labels in data/train/human.cache. Can not train without labels
    while i've uploaded the labels in data folder

  • @srinadhila8743
    @srinadhila8743 Рік тому

    Sir, what is the learning rate used in the training? thank you sir

  • @abrarluvrabit
    @abrarluvrabit Рік тому

    Can we also do active learning in our coding like out of 20 testing images my system detect 19 correct images but only 1 incorrect detection so how can i tell my system about this 1 incorrect image detection so next time it will not repeat the same mistake again. and how can i do that without training the entire model again?

  • @vyshakhcp2068
    @vyshakhcp2068 5 місяців тому

    hey, so can i detect many images at a time. you wrote code for each images you are going to detect.so if i have to detect many images at once, then do i have to write code for each one of them in google colab and anaconda prompt????

  • @mangaenfrancais934
    @mangaenfrancais934 Рік тому

    Hi, Thank you, is there any way to use .pt file with Opencv ?

  • @prasannaravijr1420
    @prasannaravijr1420 9 місяців тому

    Hi can you tell how to show bounding box and its values for an output of an image

  • @JavedKhan-to1ez
    @JavedKhan-to1ez Рік тому +1

    Hello sir please make a video about how we connect Yolo v7 models to the web .my FYP model is ready only connect web app is remaining.
    Thanks

  • @genextv415
    @genextv415 Рік тому

    Is it possible to obtain a saliency map from this model?

  • @Nouf2024_
    @Nouf2024_ 3 місяці тому +1

    Hi , I have error
    torch.cuda.OutOfMemoryError: CUDA out of memory
    I reduced batch size to 16 , 8 ,4 and 2 . I got the same error .
    can u help me plz!

  • @TheAbishanth
    @TheAbishanth 5 місяців тому

    I used 100 epochs for training. it took 3 stops to complete the training, but in the end only last.pt file is genrated and i couldnt see best.pt

  • @abrarluvrabit
    @abrarluvrabit Рік тому +1

    Awesome work worth watching it, thank you all the team of TheCodingBug for your efforts.
    Can you please guide us if we want to make object detection of atleast 2 or 3 custom dataset not just the 1 object in this video which is 'jack sparrow' what changes we need to do in the data.yaml coding file? plese make a video on this or atleast ans me here i will be very thankful to you.

    • @TheCodingBug
      @TheCodingBug  Рік тому

      In case of 3 classes,
      nc=3
      And then 3 names in the class names list.
      Also, nc=3 in respective model cfg file.

    • @abrarluvrabit
      @abrarluvrabit Рік тому

      @@TheCodingBug thanks alot i got it now, one more and last Question: i have 3 car's length and width data and i want to show it with the name of these car's on the bounding box, like for example it should display VW ID.3 Length = 4 Width = 2, where in the code i can do this?

    • @AmitKumar-hm4gx
      @AmitKumar-hm4gx Рік тому

      @@TheCodingBug and do we keep images of all the 3 classes in one folder ?

  • @aryashinde6401
    @aryashinde6401 3 місяці тому

    Hello
    I followed your tutorial but I'm getting an error which says 'no labels in data/train ' cannot train without labels. I have followed every step but it's not able find the labelled images

  • @NEZERSEY
    @NEZERSEY Рік тому

    how can yolov7 architecture be remodified

  • @MdAlamgirHossain-ov7ud
    @MdAlamgirHossain-ov7ud Рік тому

    sir, could you please give me idea how to test multiple image from the test folder or path in yolov7 model by using colab?
    already, i had followed this video and the code.

  • @iamxba3a817
    @iamxba3a817 2 місяці тому

    it works with pictures but didn’t work with video i don’t know what to do

  • @ahmetkaba7895
    @ahmetkaba7895 Рік тому +1

    Hello Sir, great Tutorial.
    I want to run yolov7 with my csi camera instead of a usb webcam, but i dont't know how i can achieve this.
    Do i need to make changes in the detect.py file? If yes what changes and where?
    I'm fairly new in thies field and i would be happy for any help.

    • @TheCodingBug
      @TheCodingBug  Рік тому

      CSI camera on raspberry pi I'd assume. It has same 0 identifier which you can use as --source

    • @ahmetkaba7895
      @ahmetkaba7895 Рік тому

      I'm using a jetson nano and if select 0 or 1 for source, i either get nothing or the usb cam...

  • @AmitKumar-hm4gx
    @AmitKumar-hm4gx Рік тому +2

    What if we want to detect extra classes in addition to COCO for example - I want to detect everything yolov7 is trained on and just remove cars from the existing class names and add 3 more classes such as let's say sedan, suv etc.. so basically, my model should be able to detect 79 + 2 = 81 classes ? Is that possible ?

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      You need to retrain custom model on coco as well as your own data (relabel cars in coco dataset to the car models basically)

    • @AmitKumar-hm4gx
      @AmitKumar-hm4gx Рік тому +1

      @@TheCodingBug thank you, since we are using pre-trained model, what do you think should be the approximate number of images from each class that one should consider given there are almost 80 labelled classes in COCO… 300 images per category ?

    • @TheCodingBug
      @TheCodingBug  Рік тому

      @@AmitKumar-hm4gx yes. That'll suffice.... Also, see if negative sampling is possible.

    • @AmitKumar-hm4gx
      @AmitKumar-hm4gx Рік тому

      @@TheCodingBug Thank you, I have been studying the detection code, I had a doubt is it possible for us to print the bounding box coordinates for each object detected. Also, are these bounding box details stored somewhere in the repo once the execution is done or if we want that we have to manually store it inside a folder.

  • @abrarluvrabit
    @abrarluvrabit Рік тому

    Can you please also make a video on a Multi-label object dection in a single bounding box. I have a dataset that involves images with bounding boxes which have more than 1 label.
    For example, I have 5 classes (0-4), then an image might have a bounding box with label "2" and another might have a bounding box with two labels "2, 4" ie it belongs to both categories. so how can we show two labels or classes on a single bounding box? please make a video on this or atleast provide some solution in your ans here i will be very thankful to you.

    • @neverninetofive
      @neverninetofive Рік тому

      Hi, did you find a solution for this? Thanks in advance

  • @albertrg9166
    @albertrg9166 Рік тому +1

    I have a doubt regarding the flag values "--conf-thres and "--iou-thres". How to set them accordingly, in order to optimize our training?

    • @TheCodingBug
      @TheCodingBug  Рік тому

      These are not for training. These are used at testing time. Use 0.5, 0.5

    • @albertrg9166
      @albertrg9166 Рік тому +1

      @@TheCodingBug I am sorry, my question is not well defined. I was referring to optimize the inference (setting those parameters when running detect.py), based on the plots.

    • @TheCodingBug
      @TheCodingBug  Рік тому

      @@albertrg9166 in training graphs, iou and confidence should be as close to 1 as possible. If it's greater than 0.5, we say that model is able to learn something but below that, model is unable to learn anything. If it's closer to 0 (something like 0.1), you'll not get any bboxes while inferencing.

  • @BadBoy-si7cm
    @BadBoy-si7cm Рік тому +1

    Bro, please make a video on web cam detection using yolo v7

  • @capocianni1043
    @capocianni1043 Рік тому

    thanks bro nice vid. Have you got linkedin to share?

  • @user-jo2zb1rp5w
    @user-jo2zb1rp5w Рік тому +1

    Hi, How can I continue training the yolov7 after fully completing the first training?

  • @akshayakki5692
    @akshayakki5692 Рік тому

    Sir, can you make a video regarding, the calculation of accuracy to this model in Google colab.

    • @TheCodingBug
      @TheCodingBug  Рік тому

      Accuracy on validation data is stored at the end of training in the train folder.

  • @omoklamok
    @omoklamok Рік тому

    hi can you help me with this one.. i tried to follow the instruction and follow everything after i run the code
    RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
    this is my error

  • @Studio-gs7ye
    @Studio-gs7ye Рік тому +1

    How could know loss or accuracy per epoch ? IS any kind of graph?

    • @TheCodingBug
      @TheCodingBug  Рік тому

      You'll find all graphs in training folder where final.pt file is.

  • @akshayakki5692
    @akshayakki5692 Рік тому +1

    Sir, can we increase the epochs number in Google colab like 200 or 300

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      Yes. As long as it doesn't get disconnected

  • @lakshaykumar3626
    @lakshaykumar3626 Рік тому +1

    I am getting the same image in the exp folder that I give as input.

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      Increase number of training images or reduce --conf to 0.1

  • @abhinava3302
    @abhinava3302 Рік тому +1

    I implemented it on Colab. But the program is not generating bounding boxes while detect.py is executed. Please help.

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      Check precision recall curves in training folder. Model must not be learning anything if the values are too small.
      If so, increase the dataset.

    • @abhinava3302
      @abhinava3302 Рік тому

      @@TheCodingBug Thank you sir.

  • @GlentoranMark
    @GlentoranMark Рік тому

    Can we convert these to .tflite? I'm an Android developer, I can create models thanks to Google's Model Maker but I'm looking a more accurate model.
    Thanks for the channel, very informative. I binged on a few last night and hit the subscribe button today. Things have definitely moved on in this field and got easier since I first tackled Tensorflow 3 years ago.

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      Indeed.
      We should be able to convert it to tflite or onnx at least.

    • @GlentoranMark
      @GlentoranMark Рік тому +1

      @@TheCodingBug Thanks for the quick reply. Should we use the same methods as converting from YoloV4 that you used?

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      @@GlentoranMark No. It'd be different. I'll make a tutorial by the end of this month.

    • @GlentoranMark
      @GlentoranMark Рік тому

      @@TheCodingBug. Thank you so much.
      One other question, when I create a model in Google's Model maker, I'm limited to 25 detections at a time. Is there anywhere in the Yolo V7 model where we can change this number to 100 or 1,000 detections? I'm creating a money counting app and am limited by 25 detections.

  • @kishoreg8835
    @kishoreg8835 Рік тому +2

    How to convert .pt to .onnx for custom. After converting to .onnx. how to use .onnx to do object detection. Please help

  • @jptoaster
    @jptoaster Рік тому

    hey, i have a problem, when i want to use yolov7-w6 and size batch 16 i have this error:
    torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 100.00 MiB (GPU 0; 14.76 GiB total capacity; 13.27 GiB already allocated; 41.88 MiB free; 13.45 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
    But, i reduce size batch to 8 and i have this error:
    RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
    I haven´t found a solution. do you know what i can do?

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      Use batch size of 4 or 2.

    • @jptoaster
      @jptoaster Рік тому

      ​@@TheCodingBug
      This is my command:
      !python train_aux.py --device 0 --batch-size 2 --epochs 100 --img 1280 1280 --data data/custom_data.yaml --hyp data/hyp.scratch.custom.yaml --cfg cfg/training/yolov7-w6-custom.yaml --weights yolov7-w6.pt --name yolov7-w6.pt
      i tried, but using train.py i get this:
      Traceback (most recent call last):
      File "train.py", line 616, in
      train(hyp, opt, device, tb_writer)
      File "train.py", line 363, in train
      loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batch_size
      File "/content/gdrive/MyDrive/IA-python/yolov7/utils/loss.py", line 585, in __call__
      bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
      File "/content/gdrive/MyDrive/IA-python/yolov7/utils/loss.py", line 677, in build_targets
      b, a, gj, gi = indices[i]
      IndexError: list index out of range
      And if i use train_aux.py i get this:
      Traceback (most recent call last):
      File "train_aux.py", line 612, in
      train(hyp, opt, device, tb_writer)
      File "train_aux.py", line 362, in train
      loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batch_size
      File "/content/gdrive/MyDrive/IA-python/yolov7/utils/loss.py", line 1206, in __call__
      bs_aux, as_aux_, gjs_aux, gis_aux, targets_aux, anchors_aux = self.build_targets2(p[:self.nl], targets, imgs)
      File "/content/gdrive/MyDrive/IA-python/yolov7/utils/loss.py", line 1558, in build_targets2
      from_which_layer = from_which_layer[fg_mask_inboxes]
      RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
      i dont understand the problem. Help me please aaaa

    • @TheCodingBug
      @TheCodingBug  Рік тому +1

      @@jptoaster make sure you've downloaded and placed the weights file along with code. Use train.py and not train_aux.py. Remove --device flag

  • @chandanasai225
    @chandanasai225 Рік тому

    what does this error mean? and how to solve
    Traceback (most recent call last):
    File "train.py", line 616, in
    train(hyp, opt, device, tb_writer)
    File "train.py", line 251, in train
    assert mlc < nc, 'Label class %g exceeds nc=%g in %s. Possible class labels are 0-%g' % (mlc, nc, opt.data, nc - 1)
    AssertionError: Label class 22 exceeds nc=2 in data/custom_data.yaml. Possible class labels are 0-1

    • @farhadhossen4548
      @farhadhossen4548 11 місяців тому

      Same Problem form me

    • @chandanasai225
      @chandanasai225 11 місяців тому

      @@farhadhossen4548 Hey! I have resolved this problem
      Try to check all your .txt files for incorrect class ids. over there
      we have in this format
      21 0.601124 0.555046 0.797753 0.880734
      here in the place of 21 we need to change the value.
      For suppose we have 2 classes namely Man and Women, then we will assign 0 and 1 respectively.
      So we need to change the value of 21 to the respective class values.
      Try it, it will be resolved.

    • @farhadhossen4548
      @farhadhossen4548 11 місяців тому

      ​@@chandanasai225 can you provide me your mail? I need some help regarding this problem.

    • @sameradnan8674
      @sameradnan8674 6 місяців тому

      ​@@chandanasai225
      Hello.. I have this problem also, i am trying to train image that contain 5 number and the same error is happen to me.
      my txt file is like that:
      15 0.077500 0.385000 0.085000 0.370000
      16 0.232500 0.415000 0.125000 0.350000
      17 0.372500 0.235000 0.125000 0.370000
      16 0.530000 0.455000 0.120000 0.390000
      16 0.672500 0.280000 0.115000 0.400000
      17 0.825000 0.380000 0.120000 0.420000
      Any kind of help please?

  • @ardumaniak
    @ardumaniak Рік тому

    7:25 I'm getting this error: RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
    PLESE HELP

    • @kagansenkeser4357
      @kagansenkeser4357 Рік тому

      hey did u find a solution

    • @ardumaniak
      @ardumaniak Рік тому

      @@kagansenkeser4357 No, i simply tried this tutorial: ua-cam.com/video/-QWxJ0j9EY8/v-deo.html
      It's important to use anaconda prompt

    • @kagansenkeser4357
      @kagansenkeser4357 Рік тому

      @@ardumaniak thank you

  • @varunraj5543
    @varunraj5543 Рік тому

    All codes are running but in the end there is no segmentation of the image or video . Its getting saved as it is and no detection is happening. Can someone please help by pointing out the error

    • @101-sridhar.r2
      @101-sridhar.r2 Рік тому

      Reduce the --conf value

    • @varunraj5543
      @varunraj5543 Рік тому

      @@101-sridhar.r2 what value should I put any suggestions on that ??

    • @varunraj5543
      @varunraj5543 Рік тому

      @@101-sridhar.r2 tried doing that still not working. Is it a problem with the dataset????

    • @101-sridhar.r2
      @101-sridhar.r2 Рік тому

      @Varun Raj I reduced that --conf 0.1 . But my model is not predicting correctly I used 230 images as accident but it detecting normal car as also accident

    • @varunraj5543
      @varunraj5543 Рік тому

      @@101-sridhar.r2 same is happening with me . I reduced it to 0.1 but still the detection isn't happening

  • @Studio-gs7ye
    @Studio-gs7ye Рік тому +1

    can you please give ipynb notebook

    • @TheCodingBug
      @TheCodingBug  Рік тому

      The codes are available for our Patreon supporters.

  • @tenns-tu1yz
    @tenns-tu1yz 3 місяці тому

    yolo-world yolo9 video upload

  • @MarianoGoni
    @MarianoGoni Рік тому +1

    "Official YOLO v7 Custom Object Detection on Colab" is the title...in the middle you change to v7x... only to find that is worst than v7! what a waste of time and GPU! Next time please spoil it at the start so we don't train a useless model.

    • @kevingiftson9420
      @kevingiftson9420 3 місяці тому

      Do the steps for yolov7 instead of yolov7x and it will work just fine

  • @jaiborade3421
    @jaiborade3421 Рік тому +1

    Hi sir, I'm getting below message
    Traceback (most recent call last):
    File "train.py", line 587, in
    opt.data, opt.cfg, opt.hyp = check_file(opt.data), check_file(opt.cfg), check_file(opt.hyp) # check files
    File "/content/gdrive/MyDrive/test/yolov7/utils/general.py", line 151, in check_file
    assert len(files), f'File Not Found: {file}' # assert file was found
    AssertionError: File Not Found: cfg/training/yolov7x-custom.yaml

    • @TheCodingBug
      @TheCodingBug  Рік тому

      You do not have yolov7x-custom.yaml file

  • @sameradnan8674
    @sameradnan8674 6 місяців тому

    Hello sir.
    I have this error when i need to train image that contains 5 random number
    Transferred 630/644 items from yolov7x.pt
    Scaled weight_decay = 0.0005
    Optimizer groups: 108 .bias, 108 conv.weight, 111 other
    train: Scanning 'data/train/labels.cache' images and labels... 10 found, 0 missing, 0 empty, 0 corrupted: 100% 10/10 [00:00

  • @yaroslavbukowski794
    @yaroslavbukowski794 Рік тому

    RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
    That's weird Something with colab
    Everything was working fine a couple days before
    But recently started to encounter this error while training
    Traceback (most recent call last):
    File "train.py", line 616, in
    train(hyp, opt, device, tb_writer)
    File "train.py", line 363, in train
    loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs) # loss scaled by batch_size
    File "/content/gdrive/MyDrive/Yolo7/yolov7/utils/loss.py", line 585, in __call__
    bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
    File "/content/gdrive/MyDrive/Yolo7/yolov7/utils/loss.py", line 759, in build_targets
    from_which_layer = from_which_layer[fg_mask_inboxes]
    RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

    • @omoklamok
      @omoklamok Рік тому

      Hi did you find the answer i have similar problem i did follow the video step by step but i got same error

    • @flycat9384
      @flycat9384 Рік тому

      Hi, can you solved this problem ?

    • @kagansenkeser4357
      @kagansenkeser4357 Рік тому

      @@omoklamok hey did u find a solution

  • @farhadhossen4548
    @farhadhossen4548 11 місяців тому

    Traceback (most recent call last):
    File "/content/drive/MyDrive/The Codding Bug/yolov7/train.py", line 616, in
    train(hyp, opt, device, tb_writer)
    File "/content/drive/MyDrive/The Codding Bug/yolov7/train.py", line 245, in train
    dataloader, dataset = create_dataloader(train_path, imgsz, batch_size, gs, opt,
    File "/content/drive/MyDrive/The Codding Bug/yolov7/utils/datasets.py", line 69, in create_dataloader
    dataset = LoadImagesAndLabels(path, imgsz, batch_size,
    File "/content/drive/MyDrive/The Codding Bug/yolov7/utils/datasets.py", line 392, in __init__
    cache, exists = torch.load(cache_path), True # load
    File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
    File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
    _pickle.UnpicklingError: STACK_GLOBAL requires str
    I found this problem can you solve me out this prblm?

  • @schizo2342
    @schizo2342 Рік тому +1

    WARNING: Dataset not found, nonexistent paths: ['/content/gdrive/MyDrive/TheCodingBug/yolov7/coco/val2017.txt']
    Traceback (most recent call last):
    File "train.py", line 616, in
    train(hyp, opt, device, tb_writer)
    File "train.py", line 97, in train
    check_dataset(data_dict) # check
    File "/content/gdrive/MyDrive/TheCodingBug/yolov7/utils/general.py", line 173, in check_dataset
    raise Exception('Dataset not found.')
    Exception: Dataset not found.
    im getting this warning. I have copied the training and validatio files

    • @TheCodingBug
      @TheCodingBug  Рік тому

      You didn't follow instructions. This path is removed from dataset yaml file.

    • @schizo2342
      @schizo2342 Рік тому

      @@TheCodingBug tat error is cleared but...the weights file tat im using for custom detection isnt detecting any object in the video that im providing

    • @abhishek68238
      @abhishek68238 Рік тому

      Hey how did you solve this "Dataset Not Found Error"?

    • @schizo2342
      @schizo2342 Рік тому

      @@abhishek68238 change the path of image and labels in coco.yaml file

    • @varunraj5543
      @varunraj5543 Рік тому

      in the custom yolov7 where you give the train and val paths, give it in the form of a list. For instance ,
      train: [ training image path, training label path]
      val: [val image path, val label path]
      this worked for me

  • @nikhilgupta7569
    @nikhilgupta7569 Рік тому +1

    AssertionError: train: No labels in data/train/labels.cache. Can not train without labels.
    Can you please help me with this error

    • @abhishek68238
      @abhishek68238 Рік тому

      Is your issue solved, I am getting the same error?