i modify the classes in yolov3-tiny.cfg. Then I run the model with errors.
`/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/huangfu/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Namespace(batch_size=2, checkpoint_interval=1, compute_map=False, data_config='config/coco.data', epochs=10, evaluation_interval=1, gradient_accumulations=2, img_size=416, model_def='config/yolov3-tiny_my.cfg', multiscale_training=True, n_cpu=8, pretrained_weights=None)
WARNING:tensorflow:From /home/huangfu/github/PyTorch-YOLOv3/utils/logger.py:7: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.
Traceback (most recent call last):
File "train.py", line 107, in
loss, outputs = model(imgs, targets)
File "/home/huangfu/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(input, *kwargs)
File "/home/huangfu/github/PyTorch-YOLOv3/models.py", line 259, in forward
x, layer_loss = module0
File "/home/huangfu/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(input, *kwargs)
File "/home/huangfu/github/PyTorch-YOLOv3/models.py", line 147, in forward
x.view(num_samples, self.num_anchors, self.num_classes + 5, grid_size, grid_size)
RuntimeError: shape '[2, 3, 7, 14, 14]' is invalid for input of size 99960
`
Have you solved the problem?Can you tell me the solution,please?
try changing the classes number in cfg
modify yolov3-tiny.cfg total three part in last conv.
[convolutional]
filters=3*(classes+1+4)
try changing the classes number in cfg
Have you solved the problem?Can you tell me the solution,please?
modify yolov3-tiny.cfg total three part in last conv.
[convolutional]
filters=3*(classes+1+4)
First, you need to modify yolov3-tiny.cfg(or better to create another one yolov3-tiny-custom.cfg):
For full yolo-v3 you have an option to train with pretrain weights - darknet53.conv.74. And if you want smth like this for tiny yolo-v3 you should do the following:
git clone https://github.com/pjreddie/darknet.gitcd darknetmake./darknet partial cfg/yolov3-tiny-custom.cfg yolov3-tiny.weights yolov3-tiny.conv.15 15
elif "yolov3-tiny.conv.15" in weights_path:
cutoff = 15
python3 train.py --model_def config/yolov3-tiny-custom.cfg --data_config config/custom.data --pretrained_weights weights/yolov3-tiny.conv.15
Most helpful comment
First, you need to modify yolov3-tiny.cfg(or better to create another one yolov3-tiny-custom.cfg):
255 means 3(80 + 5). Coco dataset has 80 classes
For full yolo-v3 you have an option to train with pretrain weights - darknet53.conv.74. And if you want smth like this for tiny yolo-v3 you should do the following:
git clone https://github.com/pjreddie/darknet.gitcd darknetmakefrom https://pjreddie.com/media/files/yolov3-tiny.weights
and place it in darknet folder
./darknet partial cfg/yolov3-tiny-custom.cfg yolov3-tiny.weights yolov3-tiny.conv.15 15elif "yolov3-tiny.conv.15" in weights_path: cutoff = 15row number - 280
python3 train.py --model_def config/yolov3-tiny-custom.cfg --data_config config/custom.data --pretrained_weights weights/yolov3-tiny.conv.15