YOLO V4 Darknet error location: ./src/image.c, make_image, line #797 Calloc error - possibly out of CPU RAM: File exists Error - object-detection

I have trained my YOLO V4 model and it can predict the objects but it is not able to create predictions.jpg. I think there is a problem with darknet. I have added my output below. It gives an Out of CPU error. Also, it is not creating an prediciton image with bboxes. In my previous tests, model was creating an predictions.jpg file. I don't understand what is going on. Thanks for your help..
CUDA-version: 11010 (11020), cuDNN: 7.6.5, CUDNN_HALF=1, GPU count: 1
CUDNN_HALF=1
OpenCV version: 3.2.0
0 : compute_capability = 600, cudnn_half = 0, GPU: Tesla P100-PCIE-16GB
net.optimized_memory = 0
mini_batch = 1, batch = 1, time_steps = 1, train = 0
layer filters size/strd(dil) input output
0 Create CUDA-stream - 0
Create cudnn-handle 0
conv 32 3 x 3/ 1 288 x 288 x 3 -> 288 x 288 x 32 0.143 BF
1 conv 64 3 x 3/ 2 288 x 288 x 32 -> 144 x 144 x 64 0.764 BF
2 conv 64 1 x 1/ 1 144 x 144 x 64 -> 144 x 144 x 64 0.170 BF
3 route 1 -> 144 x 144 x 64
4 conv 64 1 x 1/ 1 144 x 144 x 64 -> 144 x 144 x 64 0.170 BF
5 conv 32 1 x 1/ 1 144 x 144 x 64 -> 144 x 144 x 32 0.085 BF
6 conv 64 3 x 3/ 1 144 x 144 x 32 -> 144 x 144 x 64 0.764 BF
7 Shortcut Layer: 4, wt = 0, wn = 0, outputs: 144 x 144 x 64 0.001 BF
8 conv 64 1 x 1/ 1 144 x 144 x 64 -> 144 x 144 x 64 0.170 BF
9 route 8 2 -> 144 x 144 x 128
10 conv 64 1 x 1/ 1 144 x 144 x 128 -> 144 x 144 x 64 0.340 BF
11 conv 128 3 x 3/ 2 144 x 144 x 64 -> 72 x 72 x 128 0.764 BF
12 conv 64 1 x 1/ 1 72 x 72 x 128 -> 72 x 72 x 64 0.085 BF
13 route 11 -> 72 x 72 x 128
14 conv 64 1 x 1/ 1 72 x 72 x 128 -> 72 x 72 x 64 0.085 BF
15 conv 64 1 x 1/ 1 72 x 72 x 64 -> 72 x 72 x 64 0.042 BF
16 conv 64 3 x 3/ 1 72 x 72 x 64 -> 72 x 72 x 64 0.382 BF
17 Shortcut Layer: 14, wt = 0, wn = 0, outputs: 72 x 72 x 64 0.000 BF
18 conv 64 1 x 1/ 1 72 x 72 x 64 -> 72 x 72 x 64 0.042 BF
19 conv 64 3 x 3/ 1 72 x 72 x 64 -> 72 x 72 x 64 0.382 BF
20 Shortcut Layer: 17, wt = 0, wn = 0, outputs: 72 x 72 x 64 0.000 BF
21 conv 64 1 x 1/ 1 72 x 72 x 64 -> 72 x 72 x 64 0.042 BF
22 route 21 12 -> 72 x 72 x 128
23 conv 128 1 x 1/ 1 72 x 72 x 128 -> 72 x 72 x 128 0.170 BF
24 conv 256 3 x 3/ 2 72 x 72 x 128 -> 36 x 36 x 256 0.764 BF
25 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
26 route 24 -> 36 x 36 x 256
27 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
28 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
29 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
30 Shortcut Layer: 27, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
31 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
32 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
33 Shortcut Layer: 30, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
34 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
35 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
36 Shortcut Layer: 33, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
37 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
38 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
39 Shortcut Layer: 36, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
40 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
41 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
42 Shortcut Layer: 39, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
43 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
44 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
45 Shortcut Layer: 42, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
46 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
47 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
48 Shortcut Layer: 45, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
49 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
50 conv 128 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.382 BF
51 Shortcut Layer: 48, wt = 0, wn = 0, outputs: 36 x 36 x 128 0.000 BF
52 conv 128 1 x 1/ 1 36 x 36 x 128 -> 36 x 36 x 128 0.042 BF
53 route 52 25 -> 36 x 36 x 256
54 conv 256 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 256 0.170 BF
55 conv 512 3 x 3/ 2 36 x 36 x 256 -> 18 x 18 x 512 0.764 BF
56 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
57 route 55 -> 18 x 18 x 512
58 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
59 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
60 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
61 Shortcut Layer: 58, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
62 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
63 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
64 Shortcut Layer: 61, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
65 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
66 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
67 Shortcut Layer: 64, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
68 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
69 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
70 Shortcut Layer: 67, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
71 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
72 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
73 Shortcut Layer: 70, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
74 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
75 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
76 Shortcut Layer: 73, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
77 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
78 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
79 Shortcut Layer: 76, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
80 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
81 conv 256 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.382 BF
82 Shortcut Layer: 79, wt = 0, wn = 0, outputs: 18 x 18 x 256 0.000 BF
83 conv 256 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 256 0.042 BF
84 route 83 56 -> 18 x 18 x 512
85 conv 512 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 512 0.170 BF
86 conv 1024 3 x 3/ 2 18 x 18 x 512 -> 9 x 9 x1024 0.764 BF
87 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
88 route 86 -> 9 x 9 x1024
89 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
90 conv 512 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.042 BF
91 conv 512 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.382 BF
92 Shortcut Layer: 89, wt = 0, wn = 0, outputs: 9 x 9 x 512 0.000 BF
93 conv 512 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.042 BF
94 conv 512 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.382 BF
95 Shortcut Layer: 92, wt = 0, wn = 0, outputs: 9 x 9 x 512 0.000 BF
96 conv 512 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.042 BF
97 conv 512 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.382 BF
98 Shortcut Layer: 95, wt = 0, wn = 0, outputs: 9 x 9 x 512 0.000 BF
99 conv 512 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.042 BF
100 conv 512 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.382 BF
101 Shortcut Layer: 98, wt = 0, wn = 0, outputs: 9 x 9 x 512 0.000 BF
102 conv 512 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.042 BF
103 route 102 87 -> 9 x 9 x1024
104 conv 1024 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x1024 0.170 BF
105 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
106 conv 1024 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x1024 0.764 BF
107 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
108 max 5x 5/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.001 BF
109 route 107 -> 9 x 9 x 512
110 max 9x 9/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.003 BF
111 route 107 -> 9 x 9 x 512
112 max 13x13/ 1 9 x 9 x 512 -> 9 x 9 x 512 0.007 BF
113 route 112 110 108 107 -> 9 x 9 x2048
114 conv 512 1 x 1/ 1 9 x 9 x2048 -> 9 x 9 x 512 0.170 BF
115 conv 1024 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x1024 0.764 BF
116 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
117 conv 256 1 x 1/ 1 9 x 9 x 512 -> 9 x 9 x 256 0.021 BF
118 upsample 2x 9 x 9 x 256 -> 18 x 18 x 256
119 route 85 -> 18 x 18 x 512
120 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
121 route 120 118 -> 18 x 18 x 512
122 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
123 conv 512 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 512 0.764 BF
124 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
125 conv 512 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 512 0.764 BF
126 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
127 conv 128 1 x 1/ 1 18 x 18 x 256 -> 18 x 18 x 128 0.021 BF
128 upsample 2x 18 x 18 x 128 -> 36 x 36 x 128
129 route 54 -> 36 x 36 x 256
130 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
131 route 130 128 -> 36 x 36 x 256
132 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
133 conv 256 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 256 0.764 BF
134 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
135 conv 256 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 256 0.764 BF
136 conv 128 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 128 0.085 BF
137 conv 256 3 x 3/ 1 36 x 36 x 128 -> 36 x 36 x 256 0.764 BF
138 conv 27 1 x 1/ 1 36 x 36 x 256 -> 36 x 36 x 27 0.018 BF
139 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.20
nms_kind: greedynms (1), beta = 0.600000
140 route 136 -> 36 x 36 x 128
141 conv 256 3 x 3/ 2 36 x 36 x 128 -> 18 x 18 x 256 0.191 BF
142 route 141 126 -> 18 x 18 x 512
143 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
144 conv 512 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 512 0.764 BF
145 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
146 conv 512 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 512 0.764 BF
147 conv 256 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 256 0.085 BF
148 conv 512 3 x 3/ 1 18 x 18 x 256 -> 18 x 18 x 512 0.764 BF
149 conv 27 1 x 1/ 1 18 x 18 x 512 -> 18 x 18 x 27 0.009 BF
150 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.10
nms_kind: greedynms (1), beta = 0.600000
151 route 147 -> 18 x 18 x 256
152 conv 512 3 x 3/ 2 18 x 18 x 256 -> 9 x 9 x 512 0.191 BF
153 route 152 116 -> 9 x 9 x1024
154 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
155 conv 1024 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x1024 0.764 BF
156 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
157 conv 1024 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x1024 0.764 BF
158 conv 512 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 512 0.085 BF
159 conv 1024 3 x 3/ 1 9 x 9 x 512 -> 9 x 9 x1024 0.764 BF
160 conv 27 1 x 1/ 1 9 x 9 x1024 -> 9 x 9 x 27 0.004 BF
161 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.05
nms_kind: greedynms (1), beta = 0.600000
Total BFLOPS 28.558
avg_outputs = 234935
Allocate additional workspace_size = 52.43 MB
Loading weights from /content/drive/MyDrive/Data/Backup/yolov4-custom_best.weights...
seen 64, trained: 468 K-images (7 Kilo-batches_64)
Done! Loaded 162 layers from weights-file
Detection layer: 139 - type = 28
Detection layer: 150 - type = 28
Detection layer: 161 - type = 28
frame_007376.jpg: Predicted in 16.638000 milli-seconds.
UAİ: 100%
UAİ: 72%
UAİ: 99%
UAİ: 97%
UAİ: 96%
UAİ: 39%
Taşıt: 99%
UAİ: 100%
UAİ: 99%
UAİ: 95%
UAİ: 100%
UAİ: 100%
UAİ: 100%
UAİ: 100%
UAİ: 100%
UAİ: 98%
Taşıt: 92%
UAİ: 99%
UAİ: 100%
UAİ: 100%
Failed to calloc 17179869184.0 GiB
Darknet error location: ./src/image.c, make_image, line #797
Calloc error - possibly out of CPU RAM: File exists

Related

No signal screen on Ubuntu when start training YOLOv4 model on GPU

I'm working on Ubuntu 20.04 with Geforce 3060 Ti GPU.
I followed this link step by step.
When i run the below training command
./darknet detector train data/obj.data cfg/yolov4-custom.cfg ../training/yolov4-custom_last.weights -dont_show -map
The training process started, but the screen went off shortly after the start.
After restarting the system, no checkpoints are saved.
Also there is no error or warning when training start:
CUDA-version: 11080 (11080), cuDNN: 8.5.0, CUDNN_HALF=1, GPU count: 1
CUDNN_HALF=1
OpenCV version: 4.2.0
Prepare additional network for mAP calculation...
0 : compute_capability = 860, cudnn_half = 1, GPU: NVIDIA GeForce RTX 3060 Ti
net.optimized_memory = 0
mini_batch = 1, batch = 24, time_steps = 1, train = 0
layer filters size/strd(dil) input output
0 Create CUDA-stream - 0
Create cudnn-handle 0
conv 32 3 x 3/ 2 416 x 416 x 3 -> 208 x 208 x 32 0.075 BF
1 conv 64 3 x 3/ 2 208 x 208 x 32 -> 104 x 104 x 64 0.399 BF
2 conv 64 3 x 3/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BF
3 route 2 1/2 -> 104 x 104 x 32
4 conv 32 3 x 3/ 1 104 x 104 x 32 -> 104 x 104 x 32 0.199 BF
5 conv 32 3 x 3/ 1 104 x 104 x 32 -> 104 x 104 x 32 0.199 BF
6 route 5 4 -> 104 x 104 x 64
7 conv 64 1 x 1/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.089 BF
8 route 2 7 -> 104 x 104 x 128
9 max 2x 2/ 2 104 x 104 x 128 -> 52 x 52 x 128 0.001 BF
10 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
11 route 10 1/2 -> 52 x 52 x 64
12 conv 64 3 x 3/ 1 52 x 52 x 64 -> 52 x 52 x 64 0.199 BF
13 conv 64 3 x 3/ 1 52 x 52 x 64 -> 52 x 52 x 64 0.199 BF
14 route 13 12 -> 52 x 52 x 128
15 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
16 route 10 15 -> 52 x 52 x 256
17 max 2x 2/ 2 52 x 52 x 256 -> 26 x 26 x 256 0.001 BF
18 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
19 route 18 1/2 -> 26 x 26 x 128
20 conv 128 3 x 3/ 1 26 x 26 x 128 -> 26 x 26 x 128 0.199 BF
21 conv 128 3 x 3/ 1 26 x 26 x 128 -> 26 x 26 x 128 0.199 BF
22 route 21 20 -> 26 x 26 x 256
23 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
24 route 18 23 -> 26 x 26 x 512
25 max 2x 2/ 2 26 x 26 x 512 -> 13 x 13 x 512 0.000 BF
26 conv 512 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BF
27 conv 256 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BF
28 conv 512 3 x 3/ 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BF
29 conv 24 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 24 0.004 BF
30 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.05
nms_kind: greedynms (1), beta = 0.600000
31 route 27 -> 13 x 13 x 256
32 conv 128 1 x 1/ 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BF
33 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128
34 route 33 23 -> 26 x 26 x 384
35 conv 256 3 x 3/ 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BF
36 conv 24 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 24 0.008 BF
37 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.05
nms_kind: greedynms (1), beta = 0.600000
Total BFLOPS 6.790
avg_outputs = 299930
Allocate additional workspace_size = 134.22 MB
custom-yolov4-tiny-detector
0 : compute_capability = 860, cudnn_half = 1, GPU: NVIDIA GeForce RTX 3060 Ti
net.optimized_memory = 0
mini_batch = 2, batch = 48, time_steps = 1, train = 1
What I try so far:
Reinstalling the Ubuntu
Turn off the GUI and using the command line only
Thanks in advance

Extra class prediction result shown when testing on AlexeyAB Yolov4 Darknet package on Colab

I have done the model training for Yolov4 objection detection from AlexeyAB Darknet package on Colab.
(from https://github.com/AlexeyAB/darknet)
Two classes are defined named "scratch" and "blood".
Then run the following commands for testing on a single image:
!./darknet detector test data/obj.data cfg/yolo-obj.cfg backup/yolo-object_last.weights images/meat/test/376.jpg -dont show
and the result is shown below. It's expected that there are only one scratch and blood shown with probabilities in the result.
However, it shows so many scratch and blood predictions (the last few lines of this post)!
The number of classes (=2), class names, and shoud have been set properly in obj.data and yolo-obj.cfg.
Can anyone advice why and how to resolve it?
CUDA-version: 11010 (11020), cuDNN: 7.6.5, GPU count: 1
OpenCV version: 3.2.0
0 : compute_capability = 370, cudnn_half = 0, GPU: Tesla K80
net.optimized_memory = 0
mini_batch = 1, batch = 1, time_steps = 1, train = 0
layer filters size/strd(dil) input output
0 Create CUDA-stream - 0
Create cudnn-handle 0
conv 32 3 x 3/ 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BF
1 conv 64 3 x 3/ 2 416 x 416 x 32 -> 208 x 208 x 64 1.595 BF
2 conv 64 1 x 1/ 1 208 x 208 x 64 -> 208 x 208 x 64 0.354 BF
3 route 1 -> 208 x 208 x 64
4 conv 64 1 x 1/ 1 208 x 208 x 64 -> 208 x 208 x 64 0.354 BF
5 conv 32 1 x 1/ 1 208 x 208 x 64 -> 208 x 208 x 32 0.177 BF
6 conv 64 3 x 3/ 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BF
7 Shortcut Layer: 4, wt = 0, wn = 0, outputs: 208 x 208 x 64 0.003 BF
8 conv 64 1 x 1/ 1 208 x 208 x 64 -> 208 x 208 x 64 0.354 BF
9 route 8 2 -> 208 x 208 x 128
10 conv 64 1 x 1/ 1 208 x 208 x 128 -> 208 x 208 x 64 0.709 BF
11 conv 128 3 x 3/ 2 208 x 208 x 64 -> 104 x 104 x 128 1.595 BF
12 conv 64 1 x 1/ 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF
13 route 11 -> 104 x 104 x 128
14 conv 64 1 x 1/ 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF
15 conv 64 1 x 1/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.089 BF
16 conv 64 3 x 3/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BF
17 Shortcut Layer: 14, wt = 0, wn = 0, outputs: 104 x 104 x 64 0.001 BF
18 conv 64 1 x 1/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.089 BF
19 conv 64 3 x 3/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BF
20 Shortcut Layer: 17, wt = 0, wn = 0, outputs: 104 x 104 x 64 0.001 BF
21 conv 64 1 x 1/ 1 104 x 104 x 64 -> 104 x 104 x 64 0.089 BF
22 route 21 12 -> 104 x 104 x 128
23 conv 128 1 x 1/ 1 104 x 104 x 128 -> 104 x 104 x 128 0.354 BF
24 conv 256 3 x 3/ 2 104 x 104 x 128 -> 52 x 52 x 256 1.595 BF
25 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
26 route 24 -> 52 x 52 x 256
27 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
28 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
29 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
30 Shortcut Layer: 27, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
31 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
32 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
33 Shortcut Layer: 30, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
34 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
35 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
36 Shortcut Layer: 33, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
37 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
38 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
39 Shortcut Layer: 36, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
40 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
41 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
42 Shortcut Layer: 39, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
43 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
44 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
45 Shortcut Layer: 42, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
46 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
47 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
48 Shortcut Layer: 45, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
49 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
50 conv 128 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BF
51 Shortcut Layer: 48, wt = 0, wn = 0, outputs: 52 x 52 x 128 0.000 BF
52 conv 128 1 x 1/ 1 52 x 52 x 128 -> 52 x 52 x 128 0.089 BF
53 route 52 25 -> 52 x 52 x 256
54 conv 256 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 256 0.354 BF
55 conv 512 3 x 3/ 2 52 x 52 x 256 -> 26 x 26 x 512 1.595 BF
56 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
57 route 55 -> 26 x 26 x 512
58 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
59 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
60 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
61 Shortcut Layer: 58, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
62 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
63 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
64 Shortcut Layer: 61, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
65 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
66 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
67 Shortcut Layer: 64, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
68 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
69 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
70 Shortcut Layer: 67, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
71 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
72 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
73 Shortcut Layer: 70, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
74 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
75 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
76 Shortcut Layer: 73, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
77 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
78 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
79 Shortcut Layer: 76, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
80 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
81 conv 256 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BF
82 Shortcut Layer: 79, wt = 0, wn = 0, outputs: 26 x 26 x 256 0.000 BF
83 conv 256 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 256 0.089 BF
84 route 83 56 -> 26 x 26 x 512
85 conv 512 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 512 0.354 BF
86 conv 1024 3 x 3/ 2 26 x 26 x 512 -> 13 x 13 x1024 1.595 BF
87 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
88 route 86 -> 13 x 13 x1024
89 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
90 conv 512 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.089 BF
91 conv 512 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BF
92 Shortcut Layer: 89, wt = 0, wn = 0, outputs: 13 x 13 x 512 0.000 BF
93 conv 512 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.089 BF
94 conv 512 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BF
95 Shortcut Layer: 92, wt = 0, wn = 0, outputs: 13 x 13 x 512 0.000 BF
96 conv 512 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.089 BF
97 conv 512 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BF
98 Shortcut Layer: 95, wt = 0, wn = 0, outputs: 13 x 13 x 512 0.000 BF
99 conv 512 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.089 BF
100 conv 512 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BF
101 Shortcut Layer: 98, wt = 0, wn = 0, outputs: 13 x 13 x 512 0.000 BF
102 conv 512 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.089 BF
103 route 102 87 -> 13 x 13 x1024
104 conv 1024 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x1024 0.354 BF
105 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
106 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF
107 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
108 max 5x 5/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.002 BF
109 route 107 -> 13 x 13 x 512
110 max 9x 9/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.007 BF
111 route 107 -> 13 x 13 x 512
112 max 13x13/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.015 BF
113 route 112 110 108 107 -> 13 x 13 x2048
114 conv 512 1 x 1/ 1 13 x 13 x2048 -> 13 x 13 x 512 0.354 BF
115 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF
116 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
117 conv 256 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BF
118 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256
119 route 85 -> 26 x 26 x 512
120 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
121 route 120 118 -> 26 x 26 x 512
122 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
123 conv 512 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF
124 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
125 conv 512 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF
126 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
127 conv 128 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BF
128 upsample 2x 26 x 26 x 128 -> 52 x 52 x 128
129 route 54 -> 52 x 52 x 256
130 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
131 route 130 128 -> 52 x 52 x 256
132 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
133 conv 256 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF
134 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
135 conv 256 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF
136 conv 128 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF
137 conv 256 3 x 3/ 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF
138 conv 21 1 x 1/ 1 52 x 52 x 256 -> 52 x 52 x 21 0.029 BF
139 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.20
nms_kind: greedynms (1), beta = 0.600000
140 route 136 -> 52 x 52 x 128
141 conv 256 3 x 3/ 2 52 x 52 x 128 -> 26 x 26 x 256 0.399 BF
142 route 141 126 -> 26 x 26 x 512
143 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
144 conv 512 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF
145 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
146 conv 512 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF
147 conv 256 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF
148 conv 512 3 x 3/ 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF
149 conv 21 1 x 1/ 1 26 x 26 x 512 -> 26 x 26 x 21 0.015 BF
150 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.10
nms_kind: greedynms (1), beta = 0.600000
151 route 147 -> 26 x 26 x 256
152 conv 512 3 x 3/ 2 26 x 26 x 256 -> 13 x 13 x 512 0.399 BF
153 route 152 116 -> 13 x 13 x1024
154 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
155 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF
156 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
157 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF
158 conv 512 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF
159 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF
160 conv 21 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 21 0.007 BF
161 yolo
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.05
nms_kind: greedynms (1), beta = 0.600000
Total BFLOPS 59.570
avg_outputs = 489910
Allocate additional workspace_size = 12.46 MB
Loading weights from backup/yolo-object_last.weights...
seen 64, trained: 57 K-images (0 Kilo-batches_64)
Done! Loaded 160 layers from weights-file
Detection layer: 139 - type = 28
Detection layer: 150 - type = 28
Detection layer: 161 - type = 28
images/meat/13.jpg: Predicted in 101.928000 milli-seconds.
scratch: 52%
blood: 36%
scratch: 68%
blood: 68%
scratch: 42%
blood: 42%
scratch: 60%
blood: 60%
scratch: 43%
blood: 43%
scratch: 45%
blood: 45%
blood: 48%
scratch: 42%
scratch: 45%
blood: 45%
scratch: 65%
blood: 65%
scratch: 56%
.....(much more scratch and blood shown below....)
This is normal behaviour.
You are "always" going to get a lot of detections. But you can also see that some of your detections are below the 50% confidence score. Which should be discarded.
I think the pipeline already performs Non-maximum suppression (NMS) to remove duplicates and overlapping detections (not sure), but you can additionally set up confidence score threshold as well, to show only above 50% with -thresh 0.5
This will give you final expected results. Still, if you continue to obtain more than you should, well, this is the goal of everyone :)
It's all about hyperparameter tuning and more data to train our models to give our desired outcome.

Downsample a Tensor

Let's assume we have a 3D Tensor of shape a = [batch_size, length, 1] and we want to discard every 5th sample from the length axis. The new indices for every batch element could be calculated as indices = tf.where(tf.range(a.shape[1]) % 5 != 0).
Could you please help me with an operation that obtains the shorter Tensor shape b = [batch_size, length2, 1], where length2 = 4/5 * length ? I assume this is attainable with tf.gather_nd, but I am having an issue with providing the indices in the right format. It does not simply work to tile the indices Tensor batch_size times and provide the resulting 2D tensor to tf.gather_nd taking the 3D tensor as parameters.
Thank you.
You can simply do the following:
import tensorflow as tf
# Example data
a = tf.reshape(tf.range(60), [5, 12, 1])
print(a.numpy()[:, :, 0])
# [[ 0 1 2 3 4 5 6 7 8 9 10 11]
# [12 13 14 15 16 17 18 19 20 21 22 23]
# [24 25 26 27 28 29 30 31 32 33 34 35]
# [36 37 38 39 40 41 42 43 44 45 46 47]
# [48 49 50 51 52 53 54 55 56 57 58 59]]
# Mask every one in five items
mask = tf.not_equal(tf.range(tf.shape(a)[1]) % 5, 0)
b = tf.boolean_mask(a, mask, axis=1)
# Show result
print(b.numpy()[:, :, 0])
# [[ 1 2 3 4 6 7 8 9 11]
# [13 14 15 16 18 19 20 21 23]
# [25 26 27 28 30 31 32 33 35]
# [37 38 39 40 42 43 44 45 47]
# [49 50 51 52 54 55 56 57 59]]

Inference time of tiny-yolo-v3 on GPU

I am doing inference of tiny-yolo-v3 on google collab using GPU runtime.
GPU used was Tesla P100-PCIE-16GB.
After running the darknet inference command , The predicted time shown was 0.91 seconds.
I could see from code that this time stamp is the processing time of the network on GPU which excludes pre and post processing of image.
I have created cells which contains the same results.
Now, I am little confused regarding this . I know these GPUs are very costly and gives good performance. But 0.91 seconds inference time accounts to performance of 0.9 frames/second , which is not significant.
Can anyone tell me whether I am doing something wrong here?
Or It is the actual performance of GPUs?
I know inference time depends on lot of parameters like network size etc, but how fast GPUs can process data in terms of Frames/second in networks like tiny-yolo-v3?
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 4007284112891679343, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 16862634677760767602
physical_device_desc: "device: XLA_CPU device", name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 10729193134179919719
physical_device_desc: "device: XLA_GPU device", name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 15701463552
locality {
bus_id: 1
links {
}
}
incarnation: 8937778522862983933
physical_device_desc: "device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0"]
import tensorflow as tf
tf.test.gpu_device_name()
/device:GPU:0'
!./darknet detector test cfg/coco.data cfg/yolov3-tiny.cfg /yolov3-tiny.weights data/dog.jpg
layer filters size input output
0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs
1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs
3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs
5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs
7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs
9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs
14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
15 conv 255 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 255 0.044 BFLOPs
16 yolo
17 route 13
18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs
19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128
20 route 19 8
21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs
22 conv 255 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 255 0.088 BFLOPs
23 yolo
Loading weights from /content/gdrive/My Drive/Darknet/yolov3-tiny.weights...Done!
data/dog.jpg: Predicted in 0.917487 seconds.
dog: 57%
car: 52%
truck: 56%
car: 62%
bicycle: 59%
You have to make the darknet with GPU enabled, in order to be able to use GPU to perform inference, and the time you get for inference currently, is because the inference is being done by CPU, rather than GPU.
I came across this problem, and on my own laptop, I got an inference time of 1.2 seconds. After I enabled CUDA and made the project with GPU enabled, I got an inference time of approximately 0.2 seconds on Nvidia Geforce GTX 960.
In order to make darknet with GPU, open the Makefile, and change the line GPU=0 to GPU=1. Then make the project again. I assume that you would get an inference time of 0.05 seconds if you run the code on colab.

Darkflow's .pb model unable to detect objects whereas the original darknet weights file is able to

I'm creating a custom training model using darknet and am trying to convert the weights file generated to a tensorflow weights file using this command:
flow --model cfg/custom.cfg --load bin/custom.weights --savepb
The execution is successful and a .pb file is generated. The original weights file is able to detect objects but when I run the .pb file there is no detection.
This is the output when I run the .pb file:
./darknet detector test cfg/obj.data cfg/tiny-yolo-obj.cfg tiny-yolo-obj.weights pos-1.jpg --threshold 0
layer filters size input output
0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs
1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs
3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs
5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs
7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs
9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs
11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
13 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 3.190 BFLOPs
14 conv 30 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 30 0.010 BFLOPs
15 detection
mask_scale: Using default '1.000000'
Loading weights from tiny-yolo-obj.weights...Done!
pos-1.jpg: Predicted in 0.010284 seconds.