AlexeyAB / darknet

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

Differences among the yolov2.cfg,yolov2-tiny.cfg and yolov2-tiny-voc? #1064

Open abdulkalam1233 opened 6 years ago

abdulkalam1233 commented 6 years ago

@AlexeyAB I want to make use of yolov2 for mobile application can you suggest me which .cfg i have to use to train and test yolo?

AlexeyAB commented 6 years ago

You can use any of these file: yolov2-voc.cfg, yolov2-tiny-voc.cfg, yolo-voc.cfg, yolo-voc.2.0.cfg

How to train Yolo v2: https://github.com/AlexeyAB/darknet/tree/47c7af1cea5bbdedf1184963355e6418cb8b1b4f#how-to-train-to-detect-your-custom-objects

Accuracy comparison: https://pjreddie.com/darknet/yolov2/

abdulkalam1233 commented 6 years ago

Thank you @AlexeyAB I have trained individual multi object while testing i am getting large bounding box can help me get rid of it (first object trained) 0_1 (2nd object trained) 1_2 (predictions) predictions

AlexeyAB commented 6 years ago

@abdulkalam1233

abdulkalam1233 commented 6 years ago

@AlexeyAB Yeah i am using some different way to approach to get bounding boxes. I have trained 40000 iterations sorry i haven't noticed the mAP ########## This i my cfg file looks like

[net]
# Testing
batch=64
subdivisions=8
# Training
# batch=64
# subdivisions=2
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.001
max_batches = 40200
policy=steps
steps=-1,100,20000,30000
scales=.1,10,.1,.1

[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=1

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky

###########

[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=35
activation=linear

[region]
anchors = 1.08,1.19,  3.42,4.41,  6.63,11.38,  9.42,5.11,  16.62,10.52
bias_match=1
classes=2
coords=4
num=5
softmax=1
jitter=.2
rescore=1

object_scale=5
noobject_scale=1
class_scale=1
coord_scale=1

absolute=1
thresh = .6
random=1

Any modifications are needed in above cfg file to get correct output or else i need to increase number of images for training. Currently for training i am using 25 images for a class.(for sample)

AlexeyAB commented 6 years ago

Looks like your dataset is wrong.

abdulkalam1233 commented 6 years ago

@AlexeyAB Can you suggest me how to choose the proper training dataset for training yolo.

Thank you Kalam

On Thu 21 Jun, 2018, 5:28 PM Alexey, notifications@github.com wrote:

Looks like your dataset is wrong.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AlexeyAB/darknet/issues/1064#issuecomment-399078452, or mute the thread https://github.com/notifications/unsubscribe-auth/AlagUNtWOn4gp6Aj6IeVScn8J5OnQxjqks5t-4pLgaJpZM4Utsej .

AlexeyAB commented 6 years ago

@abdulkalam1233 Use: https://github.com/AlexeyAB/Yolo_mark

https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

check that each object are mandatory labeled in your dataset - no one object in your data set should not be without label. In the most training issues - there are wrong labels in your dataset (got labels by using some conversion script, marked with a third-party tool, ...). Always check your dataset by using: https://github.com/AlexeyAB/Yolo_mark

abdulkalam1233 commented 6 years ago

@AlexeyAB

Thank you so much AlexeyAB

On Thu 21 Jun, 2018, 5:52 PM Alexey, notifications@github.com wrote:

@abdulkalam1233 https://github.com/abdulkalam1233 Use: https://github.com/AlexeyAB/Yolo_mark

https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

check that each object are mandatory labeled in your dataset - no one object in your data set should not be without label. In the most training issues - there are wrong labels in your dataset (got labels by using some conversion script, marked with a third-party tool, ...). Always check your dataset by using: https://github.com/AlexeyAB/Yolo_mark

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AlexeyAB/darknet/issues/1064#issuecomment-399084816, or mute the thread https://github.com/notifications/unsubscribe-auth/AlagUJObqgAgTCfVucccHMybPojFjB8Fks5t-5APgaJpZM4Utsej .

abdulkalam1233 commented 6 years ago

@AlexeyAB What is the meaning of following statement? "YOLO reframes object detection as a single regression problem,"

AlexeyAB commented 6 years ago

@abdulkalam1233

Are you about it? https://arxiv.org/pdf/1506.02640.pdf

We reframe object detection as a single regression problem, straight from image pixels to bounding box coordinates and class probabilities. Using our system, you only look once (YOLO) at an image to predict what objects are present and where they are

More about it: https://groups.google.com/d/msg/darknet/1siKv2Z_ReA/DV5-ZYjFAgAJ and: https://groups.google.com/d/msg/darknet/1siKv2Z_ReA/vDZtZooJAwAJ

abdulkalam1233 commented 6 years ago

@AlexeyAB Thanks again... I have a doubt? i will share some example image that i have trained which are giving perfect results for the images which are used to train only. When i am trying for not trained images there is now [detection.] 1 3 4 5

can you suggest me how to resolve it? can please forward your one dataset of multi class trained images that may help me? which is the perfect size of image to train?

AlexeyAB commented 6 years ago

which is the perfect size of image to train?

Any size. But you must follow the rules: https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

General rule - your training dataset should include such a set of relative sizes of objects that you want to detect:

  • train_network_width train_obj_width / train_image_width ~= detection_network_width detection_obj_width / detection_image_width

  • train_network_height train_obj_height / train_image_height ~= detection_network_height detection_obj_height / detection_image_height

Also:

desirable that your training dataset include images with objects at diffrent: scales, rotations, lightings, from different sides, on different backgrounds - you should preferably have 2000 images for each class or more

abdulkalam1233 commented 6 years ago

@AlexeyAB What you mean by "for training for small objects - set layers = -1, 11"

AlexeyAB commented 6 years ago

@abdulkalam1233

I mean:

So the last [yolo]-layer will look at the layer-11 (with 2 subsample-layers) instead of layer-36 (with 3 subsample-layers). So last [yolo]-layer will see smaller objects.

Note: subsample-layers - is any layer (conv, maxpool, ...) with stride=2 (more than 1)