Getting predictions after training using darknet

I am new to CNN, I am trying to train a classifier using the CIFAR-10 dataset . I am following Pjreddie's tutorial to teach a simple classifier from a set of classes of 10 classes.

I trained the model using the code below, I got cifar_small.weightsthat later used to detect

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

after learning a simple network, I try to determine using cifar_small.cfgandcifar_small.weigths

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

Layers of input input size filters
    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 128 3 x 3/1 7 x 7 x 64 → 7 x 7 x 128
    5 conv 10 10 x 1/1 7 x 7 x 128 → 7 x 7 x 10
    6 average 7 x 7 x 10 → 10
    7 softmax 10
    8 cost 10 Load weights
from cifar_small.weights ... Done!
data / dog.jpg: predicted at 0.007035 seconds.
Not compiled with OpenCV, instead saved in Foretions.png

. .

yolo.cfg yolo.weights, , .


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

29 425 1 x 1/1 13 x 13 x1024 → 13 x 13 x 425
30
yolo.weights... !
data/dog.jpg: 11.057513 .
: 54%
: 51%
: 56%

, , .

+5
2

, :

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

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

+1

/examples/darknet.c ( 422 ~ 500) , darknet , "./darknet". "/.darknet classify ~" "_" examples/classifier.c.

601 ~ 606 ( classifier.c)

for(i = 0; i < top; ++i)
{
    int index = indexes[i];
    printf("%5.2f%%: %s\n", predictions[index] * 100, names[index]);
}
0

Source: https://habr.com/ru/post/1673084/


All Articles