How to Train YOLOv4 on a Custom Dataset in Darknet

แชร์
ฝัง
  • เผยแพร่เมื่อ 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!!!

  • @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?

  • @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

  • @user-yx5dz9ic9p
    @user-yx5dz9ic9p 3 ปีที่แล้ว

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

  • @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.

  • @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?

  • @MrAnki1234
    @MrAnki1234 3 ปีที่แล้ว

    Thank you very much!

  • @rhalppalanca3273
    @rhalppalanca3273 3 ปีที่แล้ว

    very helpful sir for my project. upload more cool videos

  • @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..

  • @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.

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

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

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

    Thank you so much

  • @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?

  • @yilberrojas8306
    @yilberrojas8306 3 ปีที่แล้ว

    thanks you are the best

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

    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

  • @rajeshvaradi1004
    @rajeshvaradi1004 3 ปีที่แล้ว

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

  • @yonghyun377
    @yonghyun377 3 ปีที่แล้ว

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

  • @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.

  • @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.

  • @rahulgiri54
    @rahulgiri54 3 ปีที่แล้ว

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

  • @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.

  • @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.

  • @denyfitra7904
    @denyfitra7904 2 ปีที่แล้ว

    hello bro, can we use tensorboard for yolov4?

  • @user-jf3hb1fm5m
    @user-jf3hb1fm5m 11 หลายเดือนก่อน +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

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

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

  • @astorf
    @astorf 2 ปีที่แล้ว

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

  • @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?

  • @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.

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

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

  • @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 .

  • @Huds-ux1xb
    @Huds-ux1xb 6 หลายเดือนก่อน

    Its still work on 2023 ?

  • @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.

  • @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'

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

      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 6 หลายเดือนก่อน +1

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

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

      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 6 หลายเดือนก่อน

    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