我做了this tutorial来训练我的模型以检测Hololens。
现在,我创建了一个新的“吉他”的Pascal Voc数据集。
我想采用检测电子节拍的实际模型来检测电子节拍和吉他。
在步骤3中,我更改了这些行:
trainer.setDataDirectory(data_directory="hololens")
trainer.setTrainconfig(object_names_array=["hololens"],batch_size=4,num_experiments=100,train_from_pretrained_model="pretrained-yolov3.h5")
收件人:
trainer.setDataDirectory(data_directory="violao")
trainer.setTrainconfig(object_names_array=["hololens","violao"],train_from_pretrained_model="drive/My Drive/PhoHast/my_model.h5")
“ violao”文件夹结构为:
-violao
--train
---anottations
----<xml_files>
---images
----<images_files>
我在这些图像中的注释是“ violao”。
当我运行此代码时:
from imageai.Detection.Custom import DetectionmodelTrainer
trainer = DetectionmodelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="violao")
trainer.setTrainconfig(object_names_array=["hololens",train_from_pretrained_model="my_model.h5")
trainer.trainmodel()
我收到此错误:
Generating anchor boxes for training images and annotation...
[Errno 21] Is a directory: 'violao/train/annotations/.ipynb_checkpoints'
Ignore this bad annotation: violao/train/annotations/.ipynb_checkpoints
Average IOU for 9 anchors: 0.96
Anchor Boxes generated.
Detection configuration saved in violao/json/detection_config.json
Some labels have no annotations! Please revise the list of labels in your configuration.
Training on: None
Training with Batch Size: 4
Number of Experiments: 100
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-2e7a3bd0b6ee> in <module>()
5 trainer.setDataDirectory(data_directory="violao")
6 trainer.setTrainconfig(object_names_array=["hololens",train_from_pretrained_model="drive/My Drive/PhoHast/PhoHastV1.h5")
----> 7 trainer.trainmodel()
1 frames
/usr/local/lib/python3.6/dist-packages/imageai/Detection/Custom/__init__.py in trainmodel(self)
231 shuffle=True,232 jitter=0.3,--> 233 norm=normalize
234 )
235
/usr/local/lib/python3.6/dist-packages/imageai/Detection/Custom/generator.py in __init__(self,instances,anchors,labels,downsample,max_box_per_image,batch_size,min_net_size,max_net_size,shuffle,jitter,norm)
34 self.net_w = 416
35
---> 36 if shuffle: np.random.shuffle(self.instances)
37
38 def __len__(self):
mtrand.pyx in numpy.random.mtrand.RandomState.shuffle()
TypeError: object of type 'NoneType' has no len()
我在做什么错??