pjreddie / darknet

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

Trained model is not working #1158

Open PiyalGeorge opened 5 years ago

PiyalGeorge commented 5 years ago

Hi i'm trying to do training on custom dataset as per the https://pjreddie.com/darknet/yolov2/ .

I have an image dataset of 9 objects in train(69K) and test(10K) folder. i also have annotation files for all these images in another separate folders train(69K) and test(10K). The Annotation files have same name as that of image with .txt format.


eg of an annotation file is and see the its format below-: 2 0.398 0.451 0.026 0.036 8 0.331 0.451 0.047 0.062 2 0.170 0.459 0.075 0.081 class_no xmin_yolo ymin xmax_yolo ymax_yolo

where - class_no is the classnumber of object(starting from 0, 1, 2, 3, 4.....8, assigned to each object as their unique identifier) xmin_yolo = float((float((xmax-xmin)/2) + xmin)/width) ymin_yolo = float((float((ymax-ymin)/2) + ymin)/height) xmax_yolo = float((xmax-xmin)/width) ymax_yolo = float((ymax-ymin)/height)

In above equation- xmin, ymin is the x1, y1 coordinates of the bounding box. xmax, ymax is the x2, y2 coordinates of the bounding box for example, xmin=393, ymin=302, xmax=453, ymax=347, height=720 , width=1280 gives this - 8 0.331 0.451 0.047 0.062, where 8 is the class number


Next created a train.txt, and test.txt file which has path to all images in text and test folders. train.txt looks like:- /Image-dataset/images/val/ca4071a6-6fa1a1c8.jpg /Image-dataset/images/val/ca40ddd3-102f3b02.jpg


I created a objects.names file and added these:-

man
book
radio
table
cycle
woman
bottle
trafficlight
tree

Then i created a objects.data file and added these:-

classes= 9
train  = /new-dataset/Image-dataset/trainval.txt
valid  = /new-dataset/Image-dataset/testval.txt
names = /Yolo/darknet/cfg/objects.names
backup = backup

And the objects.cfg file is this which is yolov2-voc.cfg, modified with classnumber and filter only:-

[net]
batch=20
subdivisions=10
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
burn_in=1000
max_batches = 80200
policy=steps
steps=40000,60000
scales=.1,.1

[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

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

[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

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

[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

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

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

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

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

[maxpool]
size=2
stride=2

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

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

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

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

[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]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[route]
layers=-9

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

[reorg]
stride=2

[route]
layers=-1,-4

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

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

[region]
anchors =  1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071
bias_match=1
classes=9
coords=4
num=5
softmax=1
jitter=.3
rescore=1

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

absolute=1
thresh = .6
random=1

I also downloaded a pre-trained model - darknet19_448.conv.23


Now i enter the command - _./darknet detector train cfg/objects.data cfg/objects.cfg darknet19_448.conv.23_ .

After so many hours i the iteration where completed successfully without any errors(memory errors was cleared) and got inside backup folder. Next i tried the the testing with this command:- _./darknet detector demo cfg/objects.data cfg/objects.cfg backup/vehicles-yolov2-voc80000.weights '/Test-data/Driving.mp4'

But im not getting any results. also tried with image and webcam. i tried this in command - -thresh 0 . still no results. Do i need to make any change in objects.cfg or any files?

Please help me. @pjreddie @lilohuang @Broham Please help me

hejia-zhang commented 5 years ago

Same thing happened to me, have you solved it?