pjreddie / darknet

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

Class value less than 1 always, and Anchor Values inside yolo-voc.2.0.cfg is unchanged. #451

Open arun-kumark opened 6 years ago

arun-kumark commented 6 years ago

Hi, I am new to darknet and I am training it for 8-Object classes. My Configuration files (copied from yolo-voc.2.0.cfg) is as below (Only upper and lower part), Batch size, Subdivision, Learning rate, Max Batches, threshold, random, filter and class values are changed by me according to my dataset for 8 object classes.

**UPPER PART**
[net]
_batch=256_
_subdivisions=32_
height=416
width=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 = 16000_
policy=steps
steps=100,25000,35000
scales=10,.1,.1

[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky
**LOWER PART**
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[convolutional]
size=1
stride=1
pad=1
_filters=65_
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=8_
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 = .8_
_random=0_

I also changed the Example/yolo.c with my class names for voc_names[]

My logs at 2650 iterations looks like:

Loaded: 0.000032 seconds
Region Avg IOU: 0.794050, Class: 0.941590, Obj: 0.652582, No Obj: 0.002487, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.833173, Class: 0.983865, Obj: 0.709260, No Obj: 0.002271, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.839909, Class: 0.993216, Obj: 0.809642, No Obj: 0.002103, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.779980, Class: 0.817886, Obj: 0.566256, No Obj: 0.002859, Avg Recall: 0.875000,  count: 8
Region Avg IOU: 0.871350, Class: 0.997406, Obj: 0.757228, No Obj: 0.002931, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.777548, Class: 0.868984, Obj: 0.704123, No Obj: 0.002567, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.839535, Class: 0.994415, Obj: 0.708936, No Obj: 0.002966, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.805211, Class: 0.978563, Obj: 0.791516, No Obj: 0.002801, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.816023, Class: 0.988161, Obj: 0.661551, No Obj: 0.003018, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.870706, Class: 0.991914, Obj: 0.696031, No Obj: 0.002547, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.867679, Class: 0.992734, Obj: 0.760600, No Obj: 0.002483, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.844499, Class: 0.976028, Obj: 0.757849, No Obj: 0.002231, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.827252, Class: 0.997624, Obj: 0.824051, No Obj: 0.002633, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.798136, Class: 0.893889, Obj: 0.685384, No Obj: 0.002215, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.857239, Class: 0.973052, Obj: 0.800445, No Obj: 0.002347, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.839075, Class: 0.991581, Obj: 0.601715, No Obj: 0.002862, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.840960, Class: 0.995053, Obj: 0.789573, No Obj: 0.002441, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.788998, Class: 0.984555, Obj: 0.754650, No Obj: 0.002615, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.850056, Class: 0.986587, Obj: 0.820493, No Obj: 0.002044, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.829866, Class: 0.891601, Obj: 0.664010, No Obj: 0.002821, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.844110, Class: 0.999358, Obj: 0.690339, No Obj: 0.003062, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.864714, Class: 0.961937, Obj: 0.699845, No Obj: 0.002499, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.832086, Class: 0.879637, Obj: 0.594311, No Obj: 0.002339, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.850188, Class: 0.983312, Obj: 0.771568, No Obj: 0.002539, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.857463, Class: 0.994070, Obj: 0.793598, No Obj: 0.002542, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.847674, Class: 0.941607, Obj: 0.784904, No Obj: 0.002572, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.841636, Class: 0.964138, Obj: 0.710751, No Obj: 0.003209, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.754331, Class: 0.880960, Obj: 0.716012, No Obj: 0.002238, Avg Recall: 0.875000,  count: 8
Region Avg IOU: 0.843838, Class: 0.978451, Obj: 0.768353, No Obj: 0.002626, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.892814, Class: 0.990697, Obj: 0.815058, No Obj: 0.002427, Avg Recall: 1.000000,  count: 7
Region Avg IOU: 0.888561, Class: 0.962271, Obj: 0.809738, No Obj: 0.002869, Avg Recall: 1.000000,  count: 8
Region Avg IOU: 0.850652, Class: 0.990568, Obj: 0.586725, No Obj: 0.002600, Avg Recall: 1.000000,  count: 7
2648: 1.951361, 1.764111 avg, 0.010000 rate, 6.411762 seconds, 677888 images
Loaded: 0.000035 seconds

Questions:

  1. I not changed the Anchor values, my image resolution is 1280x720. Should I need to change it?

  2. My class in logs are coming less than 1.0, I read in other comments, they should be 1-8 for my case as my label files having the first columns of this number as shown below:

4 0.6527343750000001 0.5 0.69453125 0.9972222222222222 What is wrong with the class names ?

  1. My objective is to reduce the false positive cases (which are coming in Faster RCNN version), what other changes should I do for training the Yolo to reduce the False positive cases.

Please help

Regards Arun

sivagnanamn commented 6 years ago

1.I not changed the Anchor values, my image resolution is 1280x720. Should I need to change it?

The default anchors box values mentioned in the cfg are from VOC data. Its better to generate your own anchors from your custom dataset. Use the script below to generate anchors for your custom dataset. https://github.com/Jumabek/darknet_scripts/blob/master/gen_anchors.py

  1. My class in logs are coming less than 1.0, I read in other comments, they should be 1-8 for my case as my label files having the first columns of this number as shown below:

Could you point out where you came across this ? I think Class is just the average across the true category predictions (this should be close to 1).

To validation whether your annotation are correct, you can use https://github.com/AlexeyAB/Yolo_mark

  1. My objective is to reduce the false positive cases (which are coming in Faster RCNN version), what other changes should I do for training the Yolo to reduce the False positive cases.

Reducing FP is case-to-case. A general suggestion would be to add negative samples (images without any of your objects of interest) to the training & increase variety in your background.