Python 使用YOLOv3/Tensorflow检测时出现关键错误
每当我在自定义数据集上训练的模型检测到图像中的类时,我就会得到以下错误输出:Python 使用YOLOv3/Tensorflow检测时出现关键错误,python,tensorflow,object-detection,yolo,Python,Tensorflow,Object Detection,Yolo,每当我在自定义数据集上训练的模型检测到图像中的类时,我就会得到以下错误输出: 2020-10-14 19:47:45.924359: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such
2020-10-14 19:47:45.924359: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-10-14 19:47:45.924386: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-10-14 19:47:46.448878: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-10-14 19:47:46.451264: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2020-10-14 19:47:46.451281: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (jo-VirtualBox): /proc/driver/nvidia/version does not exist
2020-10-14 19:47:46.456495: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-10-14 19:47:46.460729: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 3500000000 Hz
2020-10-14 19:47:46.461061: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x41b2bc0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-14 19:47:46.461087: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
model_data/trade_names.txt
Traceback (most recent call last):
File "detection_custom.py", line 24, in <module>
detect_image(yolo, image_path, "./IMAGES/anf.jpg", input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255,0,0))
File "/home/jo/TensorFlow-2.x-YOLOv3/yolov3/utils.py", line 296, in detect_image
image = draw_bbox(original_image, bboxes, CLASSES=CLASSES, rectangle_colors=rectangle_colors)
File "/home/jo/TensorFlow-2.x-YOLOv3/yolov3/utils.py", line 157, in draw_bbox
label = "{}".format(NUM_CLASS[class_ind]) + score_str
KeyError: 14
2020-10-14 19:47:45.924359:W tensorflow/stream_executor/platform/default/dso_loader.cc:59]无法加载动态库'libcudart.so.10.1';dlerror:libcudart.so.10.1:无法打开共享对象文件:没有此类文件或目录
2020-10-14 19:47:45.924386:I tensorflow/stream_executor/cuda/cudart_stub.cc:29]如果您的机器上没有设置GPU,请忽略上面的cudart-dler错误。
2020-10-14 19:47:46.448878:I tensorflow/stream_executor/platform/default/dso_loader.cc:48]成功打开了动态库libcuda.so.1
2020-10-14 19:47:46.451264:E tensorflow/stream\u executor/cuda/cuda\u driver.cc:314]调用cuInit失败:cuda\u错误\u无设备:未检测到支持cuda的设备
2020-10-14 19:47:46.451281:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156]内核驱动程序似乎未在此主机上运行(jo VirtualBox):/proc/driver/nvidia/version不存在
2020-10-14 19:47:46.456495:I tensorflow/core/platform/cpu_feature_guard.cc:142]此tensorflow二进制文件使用oneAPI深度神经网络库(oneDNN)进行优化,以便在性能关键型操作中使用以下cpu指令:AVX2
要在其他操作中启用它们,请使用适当的编译器标志重新生成TensorFlow。
2020-10-14 19:47:46.460729:I tensorflow/core/platform/profile_utils/cpu_utils.cc:104]cpu频率:350000000 Hz
2020-10-1419:47:46.461061:I TysFrace/编译器/ XLA/Service / Service。CC:168)为平台主机初始化的XLA服务0x41B2B0(这不能保证XLA将被使用)。设备:
2020-10-14 19:47:46.461087:I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor设备(0):主机,默认版本
model_data/trade_names.txt
回溯(最近一次呼叫最后一次):
文件“detection_custom.py”,第24行,在
检测图像(yolo,图像路径,“./IMAGES/anf.jpg”,输入大小=yolo\u输入大小,显示=真,类=训练类,矩形颜色=(255,0,0))
文件“/home/jo/TensorFlow-2.x-YOLOv3/YOLOv3/utils.py”,第296行,在detect_图像中
图像=绘制框(原始图像,框,类=类,矩形颜色=矩形颜色)
文件“/home/jo/TensorFlow-2.x-YOLOv3/YOLOv3/utils.py”,第157行,在绘图框中
label=“{}”。格式(NUM_CLASS[CLASS_ind])+score_str
关键错误:14
也许有人知道我该怎么解决这个问题
作为参考,我使用了本教程:
文本形式:
我认为您的[pylession]代码中遗漏了一些内容 首先,您需要导入
from yolov3.yolov3 import Create_Yolov3
然后呢,
image_path = "./IMAGES/[Your_images].jpg"
及
pylession视频中的那个节目对我来说很管用
编辑1
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'