Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python YOLO darkent_images.py无法检测到对象_Python_Object Detection_Yolo_Inference_Darknet - Fatal编程技术网

Python YOLO darkent_images.py无法检测到对象

Python YOLO darkent_images.py无法检测到对象,python,object-detection,yolo,inference,darknet,Python,Object Detection,Yolo,Inference,Darknet,我训练了一个YOLOv3模型。当我尝试使用darknet可执行文件在测试图像上测试我的模型时,我可以得到检测到的对象。我使用以下命令: ./darknet detector test /home/goktug/projects/darknet/training/model/model_kitti.data /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg /home/goktug/projects/d

我训练了一个YOLOv3模型。当我尝试使用darknet可执行文件在测试图像上测试我的模型时,我可以得到检测到的对象。我使用以下命令:

./darknet detector test /home/goktug/projects/darknet/training/model/model_kitti.data /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights /home/goktug/projects/darknet/training/test_data/000001.png
python3 darknet_images.py --input /home/goktug/projects/darknet/training/test_data/000001.png --batch_size 1 --weights /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights  --dont_show  --ext_output  --save_labels  --config_file /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg --data_file /home/goktug/projects/darknet/training/model/model_kitti.data
输出为:

CUDA-version: 11000 (11000), cuDNN: 8.0.4, GPU count: 1  
 OpenCV version: 3.2.0
 0 : compute_capability = 750, cudnn_half = 0, GPU: GeForce GTX 1650 with Max-Q Design 
net.optimized_memory = 0 
mini_batch = 1, batch = 64, time_steps = 1, train = 0 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    416 x 416 x   3 ->  416 x 416 x  16 0.150 BF
   1 max                2x 2/ 2    416 x 416 x  16 ->  208 x 208 x  16 0.003 BF
   2 conv     32       3 x 3/ 1    208 x 208 x  16 ->  208 x 208 x  32 0.399 BF
   3 max                2x 2/ 2    208 x 208 x  32 ->  104 x 104 x  32 0.001 BF
   4 conv     64       3 x 3/ 1    104 x 104 x  32 ->  104 x 104 x  64 0.399 BF
   5 max                2x 2/ 2    104 x 104 x  64 ->   52 x  52 x  64 0.001 BF
   6 conv    128       3 x 3/ 1     52 x  52 x  64 ->   52 x  52 x 128 0.399 BF
   7 max                2x 2/ 2     52 x  52 x 128 ->   26 x  26 x 128 0.000 BF
   8 conv    256       3 x 3/ 1     26 x  26 x 128 ->   26 x  26 x 256 0.399 BF
   9 max                2x 2/ 2     26 x  26 x 256 ->   13 x  13 x 256 0.000 BF
  10 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  11 max                2x 2/ 1     13 x  13 x 512 ->   13 x  13 x 512 0.000 BF
  12 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  13 conv    256       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 256 0.089 BF
  14 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  15 conv     42       1 x 1/ 1     13 x  13 x 512 ->   13 x  13 x  42 0.007 BF
  16 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
  17 route  13                                 ->   13 x  13 x 256 
  18 conv    128       1 x 1/ 1     13 x  13 x 256 ->   13 x  13 x 128 0.011 BF
  19 upsample                 2x    13 x  13 x 128 ->   26 x  26 x 128
  20 route  19 8                               ->   26 x  26 x 384 
  21 conv    256       3 x 3/ 1     26 x  26 x 384 ->   26 x  26 x 256 1.196 BF
  22 conv     42       1 x 1/ 1     26 x  26 x 256 ->   26 x  26 x  42 0.015 BF
  23 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 5.460 
avg_outputs = 326536 
 Allocate additional workspace_size = 52.43 MB 
Loading weights from /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights...
 seen 64, trained: 2432 K-images (38 Kilo-batches_64) 
Done! Loaded 24 layers from weights-file 
 Detection layer: 16 - type = 28 
 Detection layer: 23 - type = 28 
/home/goktug/projects/darknet/training/test_data/000001.png: Predicted in 278.641000 milli-seconds.
Car: 90%
Car: 97%
Car: 98%
 Try to load cfg: /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg, weights: /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights, clear = 0 
 0 : compute_capability = 750, cudnn_half = 1, GPU: GeForce GTX 1650 with Max-Q Design 
net.optimized_memory = 0 
mini_batch = 2, batch = 128, time_steps = 1, train = 0 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    416 x 416 x   3 ->  416 x 416 x  16 0.150 BF
   1 max                2x 2/ 2    416 x 416 x  16 ->  208 x 208 x  16 0.003 BF
   2 conv     32       3 x 3/ 1    208 x 208 x  16 ->  208 x 208 x  32 0.399 BF
   3 max                2x 2/ 2    208 x 208 x  32 ->  104 x 104 x  32 0.001 BF
   4 conv     64       3 x 3/ 1    104 x 104 x  32 ->  104 x 104 x  64 0.399 BF
   5 max                2x 2/ 2    104 x 104 x  64 ->   52 x  52 x  64 0.001 BF
   6 conv    128       3 x 3/ 1     52 x  52 x  64 ->   52 x  52 x 128 0.399 BF
   7 max                2x 2/ 2     52 x  52 x 128 ->   26 x  26 x 128 0.000 BF
   8 conv    256       3 x 3/ 1     26 x  26 x 128 ->   26 x  26 x 256 0.399 BF
   9 max                2x 2/ 2     26 x  26 x 256 ->   13 x  13 x 256 0.000 BF
  10 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  11 max                2x 2/ 1     13 x  13 x 512 ->   13 x  13 x 512 0.000 BF
  12 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  13 conv    256       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 256 0.089 BF
  14 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  15 conv     42       1 x 1/ 1     13 x  13 x 512 ->   13 x  13 x  42 0.007 BF
  16 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
  17 route  13                                 ->   13 x  13 x 256 
  18 conv    128       1 x 1/ 1     13 x  13 x 256 ->   13 x  13 x 128 0.011 BF
  19 upsample                 2x    13 x  13 x 128 ->   26 x  26 x 128
  20 route  19 8                               ->   26 x  26 x 384 
  21 conv    256       3 x 3/ 1     26 x  26 x 384 ->   26 x  26 x 256 1.196 BF
  22 conv     42       1 x 1/ 1     26 x  26 x 256 ->   26 x  26 x  42 0.015 BF
  23 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 5.460 
avg_outputs = 326536 
 Allocate additional workspace_size = 52.43 MB 
 Try to load weights: /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights 
Loading weights from /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights...
 seen 64, trained: 2432 K-images (38 Kilo-batches_64) 
Done! Loaded 24 layers from weights-file 
Loaded - names_list: /home/goktug/projects/darknet/training/model/model_ktti.names, classes = 9 

 try to allocate additional workspace_size = 52.43 MB 
 CUDA allocate done! 
Objects:
FPS: 2
但是当我尝试在同一张图像上使用python接口时,该接口是darkent_images.py,并使用以下命令:

./darknet detector test /home/goktug/projects/darknet/training/model/model_kitti.data /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights /home/goktug/projects/darknet/training/test_data/000001.png
python3 darknet_images.py --input /home/goktug/projects/darknet/training/test_data/000001.png --batch_size 1 --weights /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights  --dont_show  --ext_output  --save_labels  --config_file /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg --data_file /home/goktug/projects/darknet/training/model/model_kitti.data
我无法获取对象信息,输出为:

CUDA-version: 11000 (11000), cuDNN: 8.0.4, GPU count: 1  
 OpenCV version: 3.2.0
 0 : compute_capability = 750, cudnn_half = 0, GPU: GeForce GTX 1650 with Max-Q Design 
net.optimized_memory = 0 
mini_batch = 1, batch = 64, time_steps = 1, train = 0 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    416 x 416 x   3 ->  416 x 416 x  16 0.150 BF
   1 max                2x 2/ 2    416 x 416 x  16 ->  208 x 208 x  16 0.003 BF
   2 conv     32       3 x 3/ 1    208 x 208 x  16 ->  208 x 208 x  32 0.399 BF
   3 max                2x 2/ 2    208 x 208 x  32 ->  104 x 104 x  32 0.001 BF
   4 conv     64       3 x 3/ 1    104 x 104 x  32 ->  104 x 104 x  64 0.399 BF
   5 max                2x 2/ 2    104 x 104 x  64 ->   52 x  52 x  64 0.001 BF
   6 conv    128       3 x 3/ 1     52 x  52 x  64 ->   52 x  52 x 128 0.399 BF
   7 max                2x 2/ 2     52 x  52 x 128 ->   26 x  26 x 128 0.000 BF
   8 conv    256       3 x 3/ 1     26 x  26 x 128 ->   26 x  26 x 256 0.399 BF
   9 max                2x 2/ 2     26 x  26 x 256 ->   13 x  13 x 256 0.000 BF
  10 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  11 max                2x 2/ 1     13 x  13 x 512 ->   13 x  13 x 512 0.000 BF
  12 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  13 conv    256       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 256 0.089 BF
  14 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  15 conv     42       1 x 1/ 1     13 x  13 x 512 ->   13 x  13 x  42 0.007 BF
  16 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
  17 route  13                                 ->   13 x  13 x 256 
  18 conv    128       1 x 1/ 1     13 x  13 x 256 ->   13 x  13 x 128 0.011 BF
  19 upsample                 2x    13 x  13 x 128 ->   26 x  26 x 128
  20 route  19 8                               ->   26 x  26 x 384 
  21 conv    256       3 x 3/ 1     26 x  26 x 384 ->   26 x  26 x 256 1.196 BF
  22 conv     42       1 x 1/ 1     26 x  26 x 256 ->   26 x  26 x  42 0.015 BF
  23 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 5.460 
avg_outputs = 326536 
 Allocate additional workspace_size = 52.43 MB 
Loading weights from /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights...
 seen 64, trained: 2432 K-images (38 Kilo-batches_64) 
Done! Loaded 24 layers from weights-file 
 Detection layer: 16 - type = 28 
 Detection layer: 23 - type = 28 
/home/goktug/projects/darknet/training/test_data/000001.png: Predicted in 278.641000 milli-seconds.
Car: 90%
Car: 97%
Car: 98%
 Try to load cfg: /home/goktug/projects/darknet/training/model/yolov3-tiny_model_kitti.cfg, weights: /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights, clear = 0 
 0 : compute_capability = 750, cudnn_half = 1, GPU: GeForce GTX 1650 with Max-Q Design 
net.optimized_memory = 0 
mini_batch = 2, batch = 128, time_steps = 1, train = 0 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    416 x 416 x   3 ->  416 x 416 x  16 0.150 BF
   1 max                2x 2/ 2    416 x 416 x  16 ->  208 x 208 x  16 0.003 BF
   2 conv     32       3 x 3/ 1    208 x 208 x  16 ->  208 x 208 x  32 0.399 BF
   3 max                2x 2/ 2    208 x 208 x  32 ->  104 x 104 x  32 0.001 BF
   4 conv     64       3 x 3/ 1    104 x 104 x  32 ->  104 x 104 x  64 0.399 BF
   5 max                2x 2/ 2    104 x 104 x  64 ->   52 x  52 x  64 0.001 BF
   6 conv    128       3 x 3/ 1     52 x  52 x  64 ->   52 x  52 x 128 0.399 BF
   7 max                2x 2/ 2     52 x  52 x 128 ->   26 x  26 x 128 0.000 BF
   8 conv    256       3 x 3/ 1     26 x  26 x 128 ->   26 x  26 x 256 0.399 BF
   9 max                2x 2/ 2     26 x  26 x 256 ->   13 x  13 x 256 0.000 BF
  10 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  11 max                2x 2/ 1     13 x  13 x 512 ->   13 x  13 x 512 0.000 BF
  12 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  13 conv    256       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 256 0.089 BF
  14 conv    512       3 x 3/ 1     13 x  13 x 256 ->   13 x  13 x 512 0.399 BF
  15 conv     42       1 x 1/ 1     13 x  13 x 512 ->   13 x  13 x  42 0.007 BF
  16 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
  17 route  13                                 ->   13 x  13 x 256 
  18 conv    128       1 x 1/ 1     13 x  13 x 256 ->   13 x  13 x 128 0.011 BF
  19 upsample                 2x    13 x  13 x 128 ->   26 x  26 x 128
  20 route  19 8                               ->   26 x  26 x 384 
  21 conv    256       3 x 3/ 1     26 x  26 x 384 ->   26 x  26 x 256 1.196 BF
  22 conv     42       1 x 1/ 1     26 x  26 x 256 ->   26 x  26 x  42 0.015 BF
  23 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 5.460 
avg_outputs = 326536 
 Allocate additional workspace_size = 52.43 MB 
 Try to load weights: /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights 
Loading weights from /home/goktug/projects/darknet/training/trained_weights_1/yolov3-tiny_model_kitti_19000.weights...
 seen 64, trained: 2432 K-images (38 Kilo-batches_64) 
Done! Loaded 24 layers from weights-file 
Loaded - names_list: /home/goktug/projects/darknet/training/model/model_ktti.names, classes = 9 

 try to allocate additional workspace_size = 52.43 MB 
 CUDA allocate done! 
Objects:
FPS: 2
我怎样才能解决这个问题