Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting predictions after training using darknet

I am new to CNN, I'm trying to train a classifier using CIFAR-10 dataset. I follow Pjreddie's Tutorial to train a simple classifier of 10 class dataset .

I trained the model using the code below, i got cifar_small.weights which i later used for detection

./darknet classifier train cfg/cifar.data cfg/cifar_small.cfg

after training the simple network,i try to detect using cifar_small.cfg and cifar_small.weigths

./darknet detect cfg/cifar_small.cfg cifar_small.weights data/dog.jpg

layer filters size input output
0 conv 32 3 x 3 / 1 28 x 28 x 3 -> 28 x 28 x 32
1 max 2 x 2 / 2 28 x 28 x 32 -> 14 x 14 x 32
2 conv 64 3 x 3 / 1 14 x 14 x 32 -> 14 x 14 x 64
3 max 2 x 2 / 2 14 x 14 x 64 -> 7 x 7 x 64
4 conv 128 3 x 3 / 1 7 x 7 x 64 -> 7 x 7 x 128
5 conv 10 1 x 1 / 1 7 x 7 x 128 -> 7 x 7 x 10
6 avg 7 x 7 x 10 -> 10
7 softmax 10
8 cost 10 Loading weights
from cifar_small.weights...Done!
data/dog.jpg: Predicted in 0.007035 seconds.
Not compiled with OpenCV, saving to predictions.png instead

It does not predict the values in the terminal and does not draw bounding box on output image. The output of the image is same as the input.

When i try prediction for the same image with yolo.cfg and pre-trained yolo.weights, it works as shown below.

layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32
1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32
2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64
3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64
4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128
5 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64
6 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128
7 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128
8 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256
9 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128
10 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256
11 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256
12 conv 512 3 x 3 / 1 26 x 26 x 256 ->
26 x 26 x 512
13 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256
14 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512
15 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256
16 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512
17 max 2 x 2 / 2 26 x 26 x 512 -> 13 x 13 x 512
18 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024
19 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512
20 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024
21 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512
22 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024
23 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024
24 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024
25 route 16
26 reorg / 2
26 x 26 x 512 -> 13 x 13 x2048
27 route 26 24
28 conv 1024 3 x 3 / 1 13 x 13 x3072 -> 13 x 13 x1024

29 conv 425 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 425
30 detection
Loading weights from yolo.weights...Done!
data/dog.jpg: Predicted in 11.057513 seconds.
car: 54%
bicycle: 51%
dog: 56%

it predicts as expected along with a bounding box in the output image.

like image 962
Suraksha Ajith Avatar asked Nov 09 '22 00:11

Suraksha Ajith


1 Answers

I think you should use this command:

./darknet classify cfg/cifar_small.cfg cifar_small.weights data/dog.jpg

Check here: https://pjreddie.com/darknet/tiny-darknet/

like image 190
myaug Avatar answered Nov 15 '22 13:11

myaug