AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

Changing the layers of yolo for detecting small and large object. #6932

Open saikrishnadas opened 3 years ago

saikrishnadas commented 3 years ago

I came across this, for training for both small and large objects use modified models: YOLOv4: 3 yolo layers: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-custom.cfg

A bit confused in the config file, Where should i change my cfg code inorder to train both smaller and larger object ?

ByeByeChen commented 3 years ago

Do you know how to do it? I want to detect small targets. Can you give me some advice?

stephanecharette commented 3 years ago

1) What size network are you trying to train? (in the [net] section at the top of your .cfg, or answer "I don't know yet") 2) What size are your images? 3) What size are your objects in those images?

Based on the answer to those questions, we can then give you some information on which config file you should use and how to set things up.

ByeByeChen commented 3 years ago

Thank you for your reply. I want to train 408 408 network. My picture size is 2000 2000, and the target size I detect is about 30 * 30.

------------------ 原始邮件 ------------------ 发件人: "AlexeyAB/darknet" <notifications@github.com>; 发送时间: 2020年11月10日(星期二) 上午9:24 收件人: "AlexeyAB/darknet"<darknet@noreply.github.com>; 抄送: "Anonymous"<159119942@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [AlexeyAB/darknet] Changing the layers of yolo for detecting small and large object. (#6932)

What size network are you trying to train? (in the [net] section at the top of your .cfg, or answer "I don't know yet")

What size are your images?

What size are your objects in those images?

Based on the answer to those questions, we can then give you some information on which config file you should use and how to set things up.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

stephanecharette commented 3 years ago

408x408 is an invalid size. See here: https://www.ccoderun.ca/programming/2020-09-25_Darknet_FAQ/#square_network

Let's assume you mean 416x416. So 2000/416=4.8. The objects you are trying to find are 30x30, divided by 4.8 = 6x6

This isn't going to work. Your images are too large, your network is too small, and the objects are too small.

So you need to crop or tile your images, or you need to significantly increase your network size.

stephanecharette commented 3 years ago

Some information on one possible implementation of tiling, in case cropping is not doable: https://www.ccoderun.ca/darkhelp/api/Tiling.html

saikrishnadas commented 3 years ago

Mine is 416x416 layer with 1020 x 720p image. And I'm trying to detect groundnut (say 30x30 object size). So, 1020/416 = 2.45 30 /2.45 = 12.24 x 12.24

Is it possible ? @stephanecharette

stephanecharette commented 3 years ago

In the readme, there is brief mention of 16x16 minimum. But I don't know what the actual minimum might be, and it also depends on which .cfg file you are using.