0

此代码用于运行我训练的权重,文件夹 ckpt 包含 1050 步训练数据,此文件位于 darkflow 主文件夹的 cfg 文件夹之外。

import cv2
from darkflow.net.build import TFNet
import numpy as np
import time

options = { 'model': 'cfg/tiny-yolo-voc-1c.cfg', 'load': 1050, 'threshold': 0.2, 'gpu': 1.0 }

在原子编辑器中运行此代码后,显示以下错误
Parsing cfg//tiny-yolo-voc-1c.cfg
Traceback (most recent call last):
File "C:\Users\amard\Desktop\Hotel\darkflow\test.py", line 13, in <module> tfnet = TFNet(options)
File "C:\Users\amard\Desktop\Hotel\darkflow\darkflow\net\build.py", line 58, in __init__
darknet = Darknet(FLAGS) File "C:\Users\amard\Desktop\Hotel\darkflow\darkflow\dark\darknet.py", line 17, in __init__
src_parsed = self.parse_cfg(self.src_cfg, FLAGS)
File "C:\Users\amard\Desktop\Hotel\darkflow\darkflow\dark\darknet.py", line 68, in parse_cfg
for i, info in enumerate(cfg_layers):
File "C:\Users\amard\Desktop\Hotel\darkflow\darkflow\utils\process.py", line 66, in cfg_yielder
layers, meta = parser(model); yield meta; File "C:\Users\amard\Desktop\Hotel\darkflow\darkflow\utils\process.py", line 17, in parser
with open(model, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: 'cfg//tiny-yolo-voc-1c.cfg'
[Finished in 4.298s]

4

1 回答 1

0

通常我也被用来得到类似这个错误的东西

我的第一个错误是没有在我保存这些文件夹的目录中打开 Jupyter 笔记本,所以尝试从该目录打开笔记本

(在 Windows 中,只需在 shift+右键单击的位置栏上键入 cmd)

(在 MacOS 中有一些设置首先启用,然后右键单击该文件夹)

后来我使用了这个选项

选项={
    '模型':'cfg/yolo.cfg',
    '加载':'bin/yolov2.weights',
    “阈值”:0.3,
    'gpu':1.0
}

tfNet=TFNet(选项)

一切都按预期工作

希望对你有帮助

于 2019-01-25T09:47:31.243 回答