Closed MarkDana closed 5 years ago
@MarkDana try this tutorial. https://github.com/ultralytics/yolov3/wiki/Example:-Train-Single-Class
The https://github.com/ultralytics/yolov3 repository also includes a YOLOv3 realtime iPhone app:
@MarkDana try this tutorial. https://github.com/ultralytics/yolov3/wiki/Example:-Train-Single-Class
The https://github.com/ultralytics/yolov3 repository also includes a YOLOv3 realtime iPhone app:
Thks and I've tried this tutorial. Training now, waiting to see the result. What's more, the two bugs mentioned in issue127 also work for me.
I had same questiones with me before.
I think the reason is that "save_weights" function in trian.py doesn't match "load_weights" function in detect.py. You can replace
model.apply(weights_init_normal)
with
model.apply(weights_init_normal)
model.load_state_dict(torch.load(opt.weights_path))
and replace
model.save_weights("%s/%d.weights" % (opt.checkpoint_dir, epoch))
with
torch.save(model.state_dict(), "%s/%d.weights" % (opt.checkpoint_dir, epoch))
in train.py.
in detect.py, replace
model.load_weights(opt.weights_path)
with
model.load_state_dict(torch.load(opt.weights_path))
Use transfer learning as mentioned by @gfjiangly it wont show results otherwise
Both @gfjiangly and @fourth-archive 's method work well. I'll close this issue, thx.
I've used this model to train for a single-class dataset, which contains 300 images. After 500 epochs of training, total loss has been reduced to a fairly low level (min=0.011), with precision up to 0.887.
However when I use the generated weights to detect images in the train-val set, nothing can be detected for each image. When running
detect.py
,All images show
[None]
.Below is some changes I made to the original project:
yolov3.cfg
,detect.py
, to test the probability, I editednon_max_suppression(detections, num_classes=1, opt.conf_thres=0, opt.nms_thres=0)
, but nothing detected, still.One of the reason may be that, the weights were initialized from yolov9.weights, and that may be different in network structure I edited in
yolov3.cfg
.What's more, exploding gradient problem happened 3 times in the 500 epochs.
Anyone in same situation or can help me? thks.