运行 python darknet.py 结果报错如下:

Traceback (most recent call last): 
File “darknet.py”, line 136, in 
net = load_net(“cfg/tiny-yolo.cfg”, “tiny-yolo.weights”, 0) 
ctypes.ArgumentError: argument 1:……….. : wrong type 

 

原因

  net = load_net(“cfg/tiny-yolo.cfg”, “tiny-yolo.weights”, 0)这个函数最后会将”cfg/tiny-yolo.cfg”, “tiny-yolo.weights”这些参数传给刚才说到的libdarknet.so这个库中,而这个库是用c/c++来写的,所以出现了这个错误。

解决方法

  在出错的字符串前面添加一个b就行了,如:

net = load_net(b"cfg/tiny-yolo.cfg", b"tiny-yolo.weights", 0)
meta = load_meta(b"cfg/coco.data")
r = detect(net, meta, b"data/dog.jpg")

 

 

        

相关文章:

  • 2022-01-12
  • 2021-11-04
  • 2021-11-10
  • 2021-05-17
  • 2022-12-23
  • 2021-05-06
  • 2021-05-20
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-08-14
相关资源
相似解决方案