pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.82k stars 21.33k forks source link

How to detect smaller objects with custom object datasets #2256

Open praneeth0609 opened 4 years ago

praneeth0609 commented 4 years ago

hello... Currently, I'm working on custom object detection like birds, etc. I need to detect small objects also. but am not able to detect small objects. To get detect small objects, what I need to do. Here are my questions:

  1. How many images required per class ? (am using 2 classes.)
  2. For smaller object detection what I have to do ?
  3. even the object is very small in the frame. it should be detected . for this any suggestions?
  4. If we take one bird as an example, how many images required for specific angle of bird (front, back, up, bottom) ?
  5. what is the minimum object size that i can detect using yolo. ?
  6. For smaller object detections, what changes I have to do to my custom object dataset ?
  7. Any suggestions for improving the mAP ?
Farjad3253 commented 4 years ago

@praneeth0609 I am also working currently on a project to detect objects which are even smaller than mentioned by you. The objects are small stones, nuts, bolts, screws etc. I am also facing the same issue that I have trained Yolov3 and Yolov4 on my custom dataset but not able to get good results. So any solution?

MuhammadAsadJaved commented 4 years ago

@praneeth0609 @Farjad3253

https://github.com/AlexeyAB/darknet

check this repo and search "small object" , he explained how to train for small objects, smaller than 16 x 16.

m-ali-awan commented 4 years ago

@MuhammadAsadJaved . Yes I have checked that repo but not getting good results!

praneeth0609 commented 4 years ago

@MuhammadAsadJaved , thanks for your reply. I have checked https://github.com/AlexeyAB/darknet and i followed those instructions. can you give some suggestions on below quires:

  1. How many images required per class for proper detection and classification?
  2. If we take one bird as an example, how many images required for a specific angle of bird(front, back, up, bottom) ?
  3. Any suggestions for improving the mAP ?
praneeth0609 commented 4 years ago

hello @pjreddie @MuhammadAsadJaved I have a camera with 30X optical Zoom, and I want to detect birds, which are at long distances. give me some suggestions:

  1. for the above scenario which type of images I have to take for training. a. high resolution or low resolution. b. what should be the bird size in training images.
  2. I'm using yolo object detection algorithm. please give me some suggestions.
Farjad3253 commented 4 years ago

@MuhammadAsadJaved @praneeth0609 . I have tried the training of model for smaller objects as specified on https://github.com/AlexeyAB/darknet. But still not getting good results on small objects like bolts, screws, stones etc. Kindly solve this issue?

MuhammadAsadJaved commented 4 years ago

I haven't worked with this problem, I just saw this information so shared with you.

On Mon, Aug 10, 2020 at 11:02 AM Farjad3253 notifications@github.com wrote:

@MuhammadAsadJaved https://github.com/MuhammadAsadJaved @praneeth0609 https://github.com/praneeth0609 . I have tried the training of model for smaller objects as specified on https://github.com/AlexeyAB/darknet. But still not getting good results on small objects like bolts, screws, stones etc. Kindly solve this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/2256#issuecomment-671142812, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG4GR5B4LYS6MUYXG3MASTTR75PLVANCNFSM4PWMJYDQ .

Tuumix commented 4 years ago

When you're going to detect the object, try to set higher values on width and height on your cfg file. I managed to detect really small objects on a image 4000x3000 with the width and height on 2560.

Farjad3253 commented 4 years ago

@Tuumix . What was the input size which you specified in the cfg file?

Tuumix commented 4 years ago

@Farjad3253 for training it was 768 and for detection 2560

Farjad3253 commented 4 years ago

@Tuumix . Ok you mean that for training it was 768x768 and while testing you used 2560x2569? Is it so?

Tuumix commented 4 years ago

Yes, for training I cropped the image in 768x768x and for detection I use the full resolution image but the cfg file I used 2560x2560

Farjad3253 commented 4 years ago

@Tuumix . Ok I got your point that while you were training you specified the resolution as 768x768 in .cfg file!

Tuumix commented 4 years ago

Yees, sorry if my explanation was a little bit confusing haha

Farjad3253 commented 4 years ago

@Tuumix . No problem dear! Atleast you tried to help us. Thanks!

praneeth0609 commented 4 years ago

Yes, for training I cropped the image in 768x768x and for detection I use the full resolution image but the cfg file I used 2560x2560

@Tuumix thank you for your suggestion. how you did the crop operation. is it cropping the object or resizing the full image to 768x768. can you share your .cfg file here. it will be more helpful.

Tuumix commented 4 years ago

@praneeth0609 I cropped the object to 768x768.

praneeth0609 commented 4 years ago

@Tuumix thank you for your replay. I want to know some details regarding the training of yolov4. present I'm training custom data using yolov4. Screenshot (74) this is how I'm getting the loss and mAP graph. can you clarify the bellow questions?

  1. How many iterations need to perform(according to the above graph for better results)?
  2. what should I do to maintain constant mAP?
praneeth0609 commented 4 years ago

@Tuumix @Farjad3253

  1. Currently, I'm using a camera for custom object detection using the yolov4 algorithm, which has 1920x1080 pixels resolution. Now I want to change my camera. the specifications of both the new camera and old camera are similar. can I use the same weight files and the same training methods with the new camera?
  2. is there any effects or changes in detection with different cameras? (using yolov4 object detection)
kangks commented 4 years ago

Hi @Tuumix

If I understand correctly, your training network size was 768x768, and you cropped your training images to that resolution.

During detection, your input image resolution is 4000x3000 and forwarded to detection network of 2560x2560.

  1. Did you scale down the evaluation image size of 4000x3000 to network size of 2560x2560, or did you slide the evaluation image in the size of 2560x2560 (and probably 200px strive for overlaps) before forward to the network for detection?

  2. Regarding training network, I also found in https://github.com/AlexeyAB/darknet/blob/master/README.md#how-to-improve-object-detection that says

    increase network resolution in your .cfg-file (height=608, width=608 or any value multiple of 32) - it will increase precision

    Do you think you would get better accuracy if your training size was higher than 768?

    We have a similar use case to detect small objects (~200px) in a 4k image. We bumped the training size to 1056x1056 (the largest training resolution we can fit with 16GB GPU RAM), but the detection accuracy of small objects is not very, thus investigating what other parameters (training network size, training image size; detection network size, detection image size).

Thanks!

praneeth0609 commented 4 years ago

If we have to use two different GPU s 2060 and 2070, for OpenCV dnn or darkent , do we need to use separate versions of cuda and CUDNN...? If we use two separate versions can I use them whenever I need or will the older version will be overwritten by the new version?

MuhammadAsadJaved commented 4 years ago

You can use same cuda and cudnn.

On Sun, Sep 27, 2020 at 9:41 PM praneeth0609 notifications@github.com wrote:

If we have to use two different GPU s 2060 and 2070, for OpenCV dnn or darkent , do we need to use separate versions of cuda and CUDNN...? If we use two separate versions can I use them whenever I need or will the older version will be overwritten by the new version?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/2256#issuecomment-699637218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG4GR5DNCNVJK2MO54ANXPLSH46JTANCNFSM4PWMJYDQ .

research-boy commented 4 years ago

@kangks can you share the cfg file for training with 1056x1056

praneeth0609 commented 3 years ago

@MuhammadAsadJaved currently I'm using intel i7 9th gen, Geforce 2060 6 GB GPU, Linux os, and am trying to detect the custom objects using yolov4, but am getting Low processing rate. can I upgrade to 2070 8 GB, if I can..? what are the advantages of 2070 over 2060. can you suggest the best GPU for Yolo v4 object detection with a decent frame rate ...?

meetyogi98 commented 3 years ago

I have images that have a height of around 2000 and a width around 1500. I'm using 4-tesla T4 GPU. When I use height width 1024 or even 608 for batch size = 64 and subdivision = 16. I get out of memory cuda error.

My question is I want to train yolov4 for higher resolution at batch size=64 and subdivision=16 so what kind of GPU I need, how much RAM do I need, How much GPU I need? OR any other hard ware configure I have to follow for such kind of training?

Thank You

tomer-erez commented 2 years ago

hello... Currently, I'm working on custom object detection like birds, etc. I need to detect small objects also. but am not able to detect small objects. To get detect small objects, what I need to do. Here are my questions:

  1. How many images required per class ? (am using 2 classes.)
  2. For smaller object detection what I have to do ?
  3. even the object is very small in the frame. it should be detected . for this any suggestions?
  4. If we take one bird as an example, how many images required for specific angle of bird (front, back, up, bottom) ?
  5. what is the minimum object size that i can detect using yolo. ?
  6. For smaller object detections, what changes I have to do to my custom object dataset ?
  7. Any suggestions for improving the mAP ?

did you get good results? i am trying to set a cfg file for small objects as well, tennis table balls, and i was wondering if you would have any advice

AhlemKaabi commented 2 years ago

I think this might help from www.ccoderun.ca Stéphane's Darknet FAQ: TLDR troubleshooting What is Darknet? What is YOLO? What software is used to make this work? How do I get started? Which configuration file should I use? Does the network have to be perfectly square? How does sizing work? What is the optimal network size? Can I train a neural network with a CPU? What is the difference between CPU and GPU? How many images will it take? What about negative samples? Can I train a neural network using synthetic images? What does the error message "CUDA Error: out of memory" mean during training? How to build Darknet on Linux? How to build Darknet on Windows? What about OpenCV and CUDA? How many FPS should I expect to get? How can I increase my FPS? How much memory does it take? How long does it take to train? What command should I use when training my own network? How should I setup my files and directories? What about the "train" and "valid" files? How to run against multiple images? Should I crop my training images? How to annotate images? How do Darknet/YOLO annotations work? How do I turn off data augmentation? How important is image rotation as a data augmentation technique? Where can I get more help?

praneeth0609 commented 1 year ago

@AhlemKaabi Thank you for sharing the proper resource here.