我正在使用Darkflow在自定义数据集上进行对象检测。虽然所有迭代后的训练模型都没有保存到ckpt文件夹,但在darkflow中没有这样的文件夹。所以我创建了一个,但仍然抛出一个错误:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import cv2
from darkflow.net.build import TFNet
history = {"model": "C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/yolov2.cfg",
"load": "C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/yolov2.weights",
"batch": 8,
"epoch": 2,
"gpu": 1.0,
"train": True,
"annotation": "C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/Stumps/voc",
"dataset": "C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/Stumps/images"}
tfnet = TFNet(history)
tfnet.train()
C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/yolov2.cfg parsing C:/Users/Jayachander/Desktop/Desktop/Object-Detection/Dataset/Stumps/voc
Parsing for ['Ball', 'Bat', 'Batsman', 'Stumps', 'Stumpsdown', 'keeper', 'person', 'Player']
[====================>]100% VRP9621.xml2.xml
Statistics:
keeper: 13
person: 5
Dataset size: 50
Dataset of 50 instance(s)
Training statistics:
Learning rate : 1e-05
Batch size : 8
Epoch number : 2
Backup every : 2000
step 1 - loss 226.4876251220703 - moving ave loss 226.48762512207034
step 2 - loss 226.22042846679688 - moving ave loss 226.460905456543
step 3 - loss 226.63307189941406 - moving ave loss 226.47812210083012
step 4 - loss 226.4044647216797 - moving ave loss 226.4707563629151
step 5 - loss 226.2371826171875 - moving ave loss 226.44739898834234
step 6 - loss 226.49505615234375 - moving ave loss 226.4521647047425
Finish 1 epoch(es)
step 7 - loss 226.44583129882812 - moving ave loss 226.45153136415107
step 8 - loss 226.27183532714844 - moving ave loss 226.4335617604508
step 9 - loss 226.13697814941406 - moving ave loss 226.40390339934714
step 10 - loss 226.24066162109375 - moving ave loss 226.38757922152183
step 11 - loss 226.10202026367188 - moving ave loss 226.35902332573687
step 12 - loss 226.3309326171875 - moving ave loss 226.35621425488193
Finish 2 epoch(es)
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-5-b9fb94a28d0a> in <module>
----> 1 tfnet.train()
~\Anaconda3\lib\site-packages\darkflow\net\flow.py in train(self)
72 if not ckpt: _save_ckpt(self, *args)
73
---> 74 if ckpt: _save_ckpt(self, *args)
75
76 def return_predict(self, im):
~\Anaconda3\lib\site-packages\darkflow\net\flow.py in _save_ckpt(self, step, loss_profile)
21 profile = file.format(model, step, '.profile')
22 profile = os.path.join(self.FLAGS.backup, profile)
---> 23 with open(profile, 'wb') as profile_ckpt:
24 pickle.dump(loss_profile, profile_ckpt)
25
FileNotFoundError: [Errno 2] No such file or directory: './ckpt/yolov2-12.profile'