使用detect.py检测图片,可以输出有框的图片:
因为框太多,想要直接看检测到的目标个数,但是没有生成txt文件
运行detect.py的过程如下:
detect: weights=fruit.pt, source=static, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False
CSU -- Object Detection 2021-10-19 torch 1.10.1+cu102 CUDA:0 (NVIDIA GeForce GTX 1050 Ti, 4095.875MB)
Fusing layers...
D:\Anaconda\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Model Summary: 392 layers, 46605951 parameters, 0 gradients, 114.1 GFLOPs
Model(...
输出模型,这里省略掉
...)
image 1/1 D:\PycharmProject\yolov5_flask\static\11111.jpg: 448x640 68 oranges, 1 sweet_orange, Done. (4.425s)
Speed: 686.5ms pre-process, 4424.9ms inference, 6498.7ms NMS per image at shape (1, 3, 640, 640)
Results saved to runs\detect\exp6
我使用的detect.py代码如该链接的:
https://blog.csdn.net/qq_38253797/article/details/119382661
输出检测目标个数的代码如下:
(感觉这段代码没有运行到)
也没有labels文件夹(上图结果中的labels文件夹是我自己建的)和txt文件生成
这是怎么回事啊,感觉代码也没什么要改的啊,图片也成功显示出来了,但是为什么会没有txt生成呢?