How to Train YOLOv4 on a Custom Dataset in Darknet

Поделиться
HTML-код
  • Опубликовано: 4 авг 2024
  • ✅ Subscribe: bit.ly/rf-yt-sub
    A video of how to train YOLO v4 to recognize custom objects in Google Colab in the Darknet framework. In this video we will take the following steps to train our custom detector:
    1) Gather and process our dataset
    2) Load dataset into Google Colab
    3) Build Darknet framework in Google Colab
    4) Write custom YOLO v4 training configuration
    5) Train custom YOLO v4 detector
    6) Use trained YOLO v4 detector for inference
    7) Export YOLO v4 weights
    Label your images:
    blog.roboflow.com/getting-sta...
    Corresponding training blog post:
    blog.roboflow.com/training-yo...
    Colab Notebook:
    colab.research.google.com/git...
    What is MaP?
    • What is Mean Average P...
  • НаукаНаука

Комментарии • 65

  • @kaibe5241
    @kaibe5241 2 года назад +3

    I have to admit, when I first started watching this I thought to myself "ugh, another AWS overpriced solution". But no, this is actually awesome. You've saved me a ton of hours in getting the data ready for our own models - new subscriber AND customer!

  • @RyanRuddell
    @RyanRuddell 3 года назад +2

    Thanks for the great videos.
    you Rock!!!

  • @MrAnki1234
    @MrAnki1234 3 года назад

    Thank you very much!

  • @rhalppalanca3273
    @rhalppalanca3273 3 года назад

    very helpful sir for my project. upload more cool videos

  • @yilberrojas8306
    @yilberrojas8306 3 года назад

    thanks you are the best

  • @fatimadarbandsari1870
    @fatimadarbandsari1870 Год назад

    Thank you so much

  • @lutzludtke6587
    @lutzludtke6587 3 года назад

    Thanks a lot for allowing so many to get their feet wet with visuals.
    Just starting of with integrating it into our existing solutions.
    QUESTION:
    How do I change/reduce the file size of the generated .weigths file?
    Which factores do control it and where can I change them?

  • @user-yx5dz9ic9p
    @user-yx5dz9ic9p 3 года назад

    Thanks you share the procedure,.
    I've the question is that could I use the weights on video?

  • @bintangrahardjoputra1525
    @bintangrahardjoputra1525 Год назад

    Hi, thanks for the great explanation. Is there any chance that we can see the accuracy of the model (YOLO v4) after the training process done? thank you

  • @lukaswyon8687
    @lukaswyon8687 3 года назад +1

    @Robotflow Great video! How can i get the coordinates of the predicted boundboxes?

  • @darksideofthemoon3185
    @darksideofthemoon3185 3 года назад

    Hi! Thank you for this tutorial. Can you tell me how can I view/download my annotation labels in txt format? I used roboflow to generate my dataset and it created txt files for every image in the test directory but they remain empty even after testing my detector. I need the generated darknet format labels for my test set.

  • @Thamiah
    @Thamiah 3 года назад

    Hi! Question, I have exported my weights if I want to predict using this notebook still how can I do that, I already imported the weights but it does not predict sadly.

  • @Mahmoudkentut
    @Mahmoudkentut 3 года назад

    Hi! Thank you for the explanation. I have a few questions. When you download the pre-trained weights, is this called a transfer learning? What's the difference between transfer learning and fine-tuning? Is there a way to show the mAP or loss in graph format? Sorry I'm still new to this..

  • @angelinakancheva3990
    @angelinakancheva3990 3 года назад

    Once we've got our (trained) best weights, how can we use them on unseen data of the same kind just for testing? And can inference be tested on multiple images simultaneously?

  • @rajeshvaradi1004
    @rajeshvaradi1004 3 года назад

    thanks for the great video
    how did u change the image @19:23 ?

  • @Peedrows14
    @Peedrows14 3 года назад

    I'm training the yolov4 to identify small objects, these objects are one into another... Im identifying cells and nuclei.... When i finished the process, the name of the bounding boz were to big and they were above the other ones... it became impossible to read. Is there any chance the make the letters smaller to see the others predictions?

  • @iposipos9342
    @iposipos9342 3 года назад +1

    Thank you for your easy to follow videos:). Please I have a question. Why do we have to pre-structure the train and validation images before running the training? Can't we implement k-fold cross validation on yolo during the training?
    Most of the tutorials that i have found in yolo whether v3, v4 or v5 has the train and validation folders already setup. Thanks for your response. Am really curious about this.

    • @Roboflow
      @Roboflow  3 года назад +1

      Yes, you should have a validation set already split apart! In the video you can see how Roboflow will automatically split your data for you.

    • @iposipos9342
      @iposipos9342 3 года назад +1

      @@Roboflow Yes i saw in the video, that the split was done by Roboflow.
      Is it possible to do the split using k-fold Cross validation during training rather than using Roboflow for the split?

    • @Roboflow
      @Roboflow  3 года назад

      @@iposipos9342 k-fold cross validation may indeed be possible - though it is not in the scope of this tutorial.

  • @alastrareymart6394
    @alastrareymart6394 9 месяцев назад

    Goof afternoon sir...sir I would like to ask on how you installed your pip requirements using google colab,,because I followed your tutorial but I have encounter some error in converting yolo to tflite model

  • @yonghyun377
    @yonghyun377 3 года назад

    Can I ask
    what is the number of gpu tesla V-100 on colab? :)

  • @denyfitra7904
    @denyfitra7904 2 года назад

    hello bro, can we use tensorboard for yolov4?

  • @user-jf3hb1fm5m
    @user-jf3hb1fm5m Год назад +1

    Hi I have some problems I use custom data on roboflow when I'm training it have errors path directory not have ,how i can fix this problem

  • @alhasanalshaebi
    @alhasanalshaebi 3 года назад

    @Roboflow Should I training the model again if I make augmentation on the dataset, Where the model has been trained on an original dataset before?

    • @Roboflow
      @Roboflow  3 года назад

      Yes. Consider starting training from the checkpoint of the model trained on your original images.

  • @marsrocket
    @marsrocket 3 года назад

    When performing inference should I resize the input to match the training size, or does darknet do that automatically? Does it resize training input images if they’re not already the correct size?

    • @Roboflow
      @Roboflow  3 года назад

      Yes the images will be automatically resized. However, you may see slightly faster inference if you resize ahead of time.

  • @astorf
    @astorf 2 года назад

    how to save files with .labels and .cfg extensions in collab ?

  • @rahulgiri54
    @rahulgiri54 3 года назад

    can we detect the accident dent using yolov4 in darknet? if yes then how & if no then please provide option!

  • @farahkhan1128
    @farahkhan1128 9 месяцев назад

    can you do age prediction by facial feature recognition using yolo v4

  • @pallavi5799
    @pallavi5799 Год назад

    How to upload the data directly without using your Roboflow app. Because in Roboflow, I cannot split my train, Val, and test sets category-wise if the data is imbalanced. Not sure how your build custom model did not take that into consideration.

  • @blueming2049
    @blueming2049 Год назад +1

    now the colab has changed, the code inside the colab notebook provided unable to run completely already. Is there anyone is currently doing yolov4 with this colab notebook but can run completely ?

  • @akhilandrewleo7511
    @akhilandrewleo7511 2 года назад

    how to change the number of epochs and then create checkpoints to save those trained weights

  • @feyzaaydogan8304
    @feyzaaydogan8304 3 года назад

    Isn't it too slow for training? Because only 50 photos for train, validation and test. How can I do faster?

  • @ZuesNgcobo
    @ZuesNgcobo Год назад

    I am getting the below error when I have to perform the prediction
    Unable to init server: Could not connect: Connection refused

  • @rahataraferdousi3372
    @rahataraferdousi3372 3 года назад

    Hi Thanks for the video. I got this error.
    CUDA Error Prev: an illegal memory access was encountered
    CUDA Error Prev: an illegal memory access was encountered: Success
    darknet: ./src/utils.c:325: error: Assertion `0' failed.

  • @akash_a_desai
    @akash_a_desai 3 года назад +1

    It will be really helpful if you add code for testing .mp4 or video , hope you will add this in your collab repo

    • @akashanil4540
      @akashanil4540 3 года назад

      !./darknet detector demo data/obj.data cfg/custom-yolov4-detector.cfg backup/custom-yolov4-detector_last.weights -dont_show /content/traffic.mp4 -thresh 0.4 -i 0 -out_filename /content/traffic_1.mp4
      add this line instead of the one provided for image inference and replace all the cfg and weights with yours in this command including the video path.

  • @3picblader64
    @3picblader64 2 года назад

    need the best file in py. How can I do that .

  • @goutamborthakur4980
    @goutamborthakur4980 3 года назад

    @Roboflow, I am unable to run the below part, getting an error stating cannot find _darknet.labels even though I followed your entire code. Could you please help me with this?
    #Set up training file directories for custom dataset
    %cd /content/darknet/
    %cp train/_darknet.labels data/obj.names
    %mkdir data/obj
    #copy image and labels
    %cp train/*.jpg data/obj/
    %cp valid/*.jpg data/obj/
    %cp train/*.txt data/obj/
    %cp valid/*.txt data/obj/
    with open('data/obj.data', 'w') as out:
    out.write('classes = 2
    ')
    out.write('train = data/train.txt
    ')
    out.write('valid = data/valid.txt
    ')
    out.write('names = data/obj.names
    ')
    out.write('backup = /mydrive/yolov4/backup')
    #write train file (just the image list)
    import os
    with open('data/train.txt', 'w') as out:
    for img in [f for f in os.listdir('train') if f.endswith('jpg')]:
    out.write('data/obj/' + img + '
    ')
    #write the valid file (just the image list)
    import os
    with open('data/valid.txt', 'w') as out:
    for img in [f for f in os.listdir('valid') if f.endswith('jpg')]:
    out.write('data/obj/' + img + '
    ')

    • @Roboflow
      @Roboflow  3 года назад

      Make sure to export in the "YOLO Darknet" format!

    • @goutamborthakur4980
      @goutamborthakur4980 3 года назад

      @@Roboflow , yes I did...exported.

  • @Huds-ux1xb
    @Huds-ux1xb 7 месяцев назад

    Its still work on 2023 ?

  • @dribletdrop7959
    @dribletdrop7959 Год назад +2

    i have taked erorr: "/bin/bash: ./darknet: No such file or directory"

    • @Roboflow
      @Roboflow  Год назад

      Please create an issue at github.com/roboflow-ai/notebooks and describe your problem. We will try to help you out :)

    • @rusugabriel2554
      @rusugabriel2554 Год назад

      have you fixed the error ?

    • @dribletdrop7959
      @dribletdrop7959 Год назад

      @@rusugabriel2554, unfortunately no, i stopped using roboflow, here is my solution :)

  • @standpunkt_reddit
    @standpunkt_reddit Год назад

    I have done all the steps but when I am trying to test the images I amgettiing "test" folder is not there. Has anyone faced similar issue?
    FileNotFoundError Traceback (most recent call last)
    in
    1 import os
    2 #/test has images that we can test our detector on
    ----> 3 test_images = [f for f in os.listdir('test') if f.endswith('.jpg')]
    4 import random
    5 img_path = "test/" + random.choice(test_images);
    FileNotFoundError: [Errno 2] No such file or directory: 'test'

    • @ZuesNgcobo
      @ZuesNgcobo Год назад

      In my case I created a completly new dir for the test images but I think the issue was that the directory in the code did not match mine so I changed mine to /content/drive/MyDrive/ColabNotebooks/test

  • @marco5728
    @marco5728 2 года назад

    I've got 80 images, whys it say it's gonna take 10 hours? :O

  • @nina_________________
    @nina_________________ Год назад +1

    It doesn't function anymore.

  • @user-tl8nv9ws9h
    @user-tl8nv9ws9h 3 года назад

    how to do it? checkpoint,yolov4.data-00000-of-00001,yolov4.index ----> saved_model.pb

  • @muhamadsyaepulhuda2735
    @muhamadsyaepulhuda2735 7 месяцев назад +1

    /bin/bash: line 1: ./darknet: No such file or directory

    • @ghostwalid1534
      @ghostwalid1534 2 месяца назад

      i have the same problem, did you found the solution?

  • @Adroitbit
    @Adroitbit 2 года назад

    during 16:24 steps. You need to go outside and touch the grass. Because this step take so ducking long.

  • @gguy156
    @gguy156 2 года назад +1

    Yeah... the title was about training in darknet. Dislike

  • @BrunoMartins-qv7vo
    @BrunoMartins-qv7vo Год назад +3

    i got this error "error: ‘CUDNN_CONVOLUTION_FWD_PREFER_FASTEST’ undeclared (first use in this function); did you mean ‘CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3’?" when i run "!make". Someone knows how to solve this?

  • @muhamadsyaepulhuda2735
    @muhamadsyaepulhuda2735 7 месяцев назад

    i got issue on 10:14
    compilation terminated due to -Wfatal-errors.
    make: *** [Makefile:144: obj/convolutional_layer.o] Error 1

  • @AMINFIRDAUS-hg7dv
    @AMINFIRDAUS-hg7dv Год назад +1

    why i get this error when compile darknet using Cmake : compilation terminated due to -Wfatal-errors.
    make: *** [Makefile:162: obj/convolutional_layer.o] Error 1

    • @Roboflow
      @Roboflow  Год назад

      Hi 👋🏻! It is a known bug that we are trying to solve for quite a long time. You can take a look at the issue here: github.com/roboflow/notebooks/issues/28

  • @fatimadarbandsari1870
    @fatimadarbandsari1870 Год назад

    Thank you so much