如何修复此CUDA/Darknet安装错误?

2024-04-19 11:10:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在Google Collab上安装darknet,在安装过程中,我运行了以下代码/命令:

!git clone https://github.com/AlexeyAB/darknet
!apt-get update
!apt-get upgrade
!apt-get install build-essential
!apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
!apt-get install libavcodec-dev libavformat-dev libswscale-d
!apt-get install libopencv-dev
%cd darknet
!ls
!sed -i 's/OPENCV=0/OPENCV=1/g' Makefile
!sed -i 's/GPU=0/GPU=1/g' Makefile
!ls
%cd ../
!ls
!apt install g++-5
!apt install gcc-5
!apt update
!apt upgrade
import tensorflow as tf
device_name = tf.test.gpu_device_name()
!/usr/local/cuda/bin/nvcc --version
%cd darknet
!wget https://pjreddie.com/media/files/yolov3.weights
!make
!./darknet detect cfg/yolov3.cfg yolov3.weights data/person.jpg
def imShow(path):
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
image = cv2.imread(path)
height, width = image.shape[:2]
resized_image = cv2.resize(image,(3width, 3height), interpolation = cv2.INTER_CUBIC)
fig = plt.gcf()
fig.set_size_inches(18, 10)
plt.axis("off")
#plt.rcParams['figure.figsize'] = [10, 5]
plt.imshow(cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB))
plt.show()
def upload():
from google.colab import files
uploaded = files.upload()
for name, data in uploaded.items():
with open(name, 'wb') as f:
f.write(data)
print ('saved file', name)
def download(path):
from google.colab import files
files.download(path)
imShow('/content/drive/My Drive/face/img/bv.jpg')

从该命令字符串返回以下错误:

CUDA status Error: file: ./src/dark_cuda.c : () : line: 239 : build time: Jun 16 2020 - 20:18:49 

 CUDA Error: invalid argument
CUDA Error: invalid argument: File exists
darknet: ./src/utils.c:326: error: Assertion `0' failed.

我以前试过安装这个,以前也能用。显然,可能是最近的更新导致了这个错误,但我不确定


Tags: installpathnamedevimageimportgetas