I use yolo3 to train my own dataset, I have modified the voc.data, voc.names and yolov3-voc.cfg files, and the labels generate from voc_label.py is right. But after 30000 iterations, when testing a single image, the object bounding box is right, whereas the object class still belongs to the orignal VOC dataset, how to solve this problem? @pjreddie
Try to give exact filepath of your names file in detector.c 's function:
void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile, int fullscreen)
I give exact filepath in detector.c 's function like this
void test_detector(char datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile, int fullscreen)
{
list *options = read_data_cfg(datacfg);
char *name_list = option_find_str(options, "names", "/home/lx/code/darknet/data/voc.names");
char *names = get_labels(name_list);
and also give the exact path in run_detector() and validate_detector(), but still got the wrong class. I use this command to do the test:
./darknet detect cfg/yolov3-voc400.cfg /home/lx/code/darknet/backup/yolov3-voc400_30000.weights /home/lx/code/darknet/003106.jpg
and the following command shows" segmentation default"
./darknet detector test cfg/yolov3-voc400.cfg cfg/yolov3-voc400.cfg /home/lx/code/darknet/backup/yolov3-voc400_30000.weights /home/lx/code/darknet/003106.jpg
./darknet detector valid cfg/yolov3-voc400.cfg cfg/yolov3-voc400.cfg /home/lx/code/darknet/backup/yolov3-voc400_30000.weights /home/lx/code/darknet/003106.jpg
Here is my voc.names:
biker
bus
car
cart
pedestrian
skateboarder
and here is my voc.data
classes= 6
train = /home/lx/code/darknet/scripts/train.txt
valid = /home/lx/code/darknet/scripts/test.txt
names = /home/lx/code/darknet/data/voc.names
backup = /home/lx/code/darknet/backup
@liangxi627
please use this command
./darknet detector test data/voc.data cfg/yolov3-voc400.cfg /home/lx/code/darknet/backup/yolov3-voc400_30000.weights /home/lx/code/darknet/003106.jpg
It works! Thanks a lot!But I want to know why I got the wrong class label when I not define the parameter"data/voc.data". Since the example on the official website use "./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg" to test the model, where can I modify the default setting to make the "./darknet detect" command workable?
because detect automatically takes voc.names (original voc names ) so if you have customized names , it is always suggested to use detector test or detector demo
@liangxi627 had the same problem, here is the solution https://github.com/pjreddie/darknet/issues/628
Most helpful comment
@liangxi627
please use this command
./darknet detector test data/voc.data cfg/yolov3-voc400.cfg /home/lx/code/darknet/backup/yolov3-voc400_30000.weights /home/lx/code/darknet/003106.jpg