怎么训练自己的数据集?
Closed this issue · 20 comments
已经做成了VOC格式,应该怎么训练?
@wushilian 训练自己的数据集,这部分有个例子在 train 分支. 具体的README我将在今明两天补上哈.
@kuhung I change the code an train the model in my dataset,but the loss is 0,how can fix it?
@wushilian 可能是有几个细节问题,中午我抓紧写一下教程.主要可能是类别,还有文件路径的问题.
@kuhung ssd_box_encode_decode_utils.py in decode_y(y_pred, confidence_thresh, iou_threshold, top_k, input_coords, normalize_coords, img_height, img_width)
320 # Once we're through with all classes, keep only the top_k
maxima with the highest scores
321 pred = np.concatenate(pred, axis=0)
--> 322 if pred.shape[0] > top_k: # If we have more than top_k
results left at this point, otherwise there is nothing to filter,...
323 top_k_indices = np.argpartition(pred[:,1], kth=pred.shape[0]-top_k, axis=0)[pred.shape[0]-top_k:] # ...get the indices of the top_k
highest-score maxima...
324 pred = pred[top_k_indices] # ...and keep only those entries of pred
...
TypeError: '>' not supported between instances of 'int' and 'str'
@wushilian 刚刚加了新的分支 dev
,在里面有较为详细的教程. 你的上面的问题我遇到过,是种类数量没对上.
@kuhung ---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
in ()
----> 1 gt = pickle.load(open('data_convert/train.pkl', 'rb'))
2 keys = sorted(gt.keys())
3 num_train = int(round(0.8 * len(keys)))
4 train_keys = keys[:num_train]
5 val_keys = keys[num_train:]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa4 in position 2: ordinal not in range(128)
这个编码错误应该怎么改?
@wushilian 这个是Python版本的问题.我猜你是clone的我的项目在跑.我本地的Python是2.7,如果你用3.+,就会出现这种问题.解决方案有两种:
- 更换环境至 Python2.7
- 用你自己的环境,重新跑一次,生成train.pkl
@kuhung 非常感谢,刚才的问题解决拉,但载入模型又报错拉。---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 model = SSD300(input_shape, num_classes=NUM_CLASSES)
2 model.load_weights('weights_SSD300.hdf5', by_name=True)
~/detecttion/SSD_keras-dev/ssd_keras/ssd.py in SSD300(input_shape, num_classes)
271 net['pool6_mbox_priorbox']],
272 mode='concat', concat_axis=1,
--> 273 name='mbox_priorbox')
274 if hasattr(net['mbox_loc'], '_keras_shape'):
275 num_boxes = net['mbox_loc']._keras_shape[-1] // 4
~/anaconda3/lib/python3.6/site-packages/keras/legacy/layers.py in merge(inputs, mode, concat_axis, dot_axes, output_shape, output_mask, arguments, name)
462 node_indices=node_indices,
463 tensor_indices=tensor_indices,
--> 464 name=name)
465 return merge_layer._inbound_nodes[0].output_tensors[0]
466 else:
~/anaconda3/lib/python3.6/site-packages/keras/legacy/layers.py in init(self, layers, mode, concat_axis, dot_axes, output_shape, output_mask, arguments, node_indices, tensor_indices, name)
115 self._arguments_validation(layers, mode,
116 concat_axis, dot_axes,
--> 117 node_indices, tensor_indices)
118 self.built = True
119 input_tensors = []
~/anaconda3/lib/python3.6/site-packages/keras/legacy/layers.py in _arguments_validation(self, layers, mode, concat_axis, dot_axes, node_indices, tensor_indices)
195 'layers with matching '
196 'output shapes except for the concat axis. '
--> 197 'Layer shapes: %s' % (input_shapes))
198
199 def call(self, inputs, mask=None):
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 38, 38, 512), (None, 19, 19, 1024), (None, 10, 10, 512), (None, 5, 5, 256), (None, 3, 3, 256), (None, 1, 1, 256)]
@wushilian 你改动了些啥?这个错明显是输入输出不对应啊
@wushilian change the version of keras and tensorflow ,keras(1.2.2) tensor flow(1.0)
@wushilian 最好提一下你的版本、系统。按照master分支的要求配置依赖版本。另一个同学试了我的这套代码,是没有问题的。
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 512, 38, 1), (None, 1024, 19, 1), (None, 512, 10, 1), (None, 256, 5, 1), (None, 256, 3, 1), (None, 256, 1, 1)]
这个问题现在有解决的吗?