Closed panyan928 closed 6 years ago
SSD prototxt is generated by ssd/ssd_hardcode/ssd_pascal_512.py
. Run touch products/VGG_ILSVRC_16_layers_fc_reduced.caffemodel products/val.txt && python3 train.py
and you will get everything.
Run cp ../data/annotations/downloads/train.jsonl ../data/annotations/downloads/val.jsonl ../data/annotations/ && python3 decide_cates.py
and you will get products/cates.json
, the map from label ID to character category.
Please let me know if you have problem using trained models.
I don't want to run train, I just detect images.
I have got cates.json. When I run eval.py, it shows no deploy.prototxt
F0328 06:13:51.207175 24 io.cpp:45] Check failed: fd != -1 (-1 vs. -1) File not found: products/models/SSD_512x512/deploy.prototxt
Run train to generate prototxt, and then CTRL+C.
Okay,I will try. Thank you very much.
Sorry, I met another problem. It needs labelmap.prototxt.
Call function write_caffe_labelmap
, which is in ssd/prepare_train_data.py
.
Sorry so many problems in the tutorial, I will update it and address all problems you met.
Hi, I find another problem. After run prepare_train_data.py, It showsname_size_file: "products/val_name_size.txt"
in deploy.prototxt. But when test, we need test_name_size.txt
, it isn't created in your code.
Maybe you can write test.py
not eval.py
for test if have time.
val_name_size.txt
is only used in training steps, just touch this file. Maybe test_name_size is not necessary.
I didn't download your train data, so after runprepare_train_data.py
, val_name_size.txt
is empty.
When I run eval.py, caffe errors, as follows:
F0329 02:41:16.516167 266 detection_output_layer.cpp:98] Check failed: num_test_image_ <= names_.size() (1000 vs. 0)
So I go to check detection_output_layer
if (save_output_param.has_name_size_file()) { string name_size_file = save_output_param.name_size_file(); if (name_size_file.empty()) { // Ignore saving if there is no name_size_file provided. LOG(WARNING) << "Provide name_size_file if output results to files."; needsave = false; } else { std::ifstream infile(name_size_file.c_str()); CHECK(infile.good()) << "Failed to open name size file: " << name_sizefile; // The file is in the following format: // name height width // ... string name; int height, width; while (infile >> name >> height >> width) { names.pushback(name); sizes.push_back(std::make_pair(height, width)); } infile.close(); if (save_output_param.has_num_test_image()) { num_testimage = save_output_param.num_test_image(); } else { num_testimage = names_.size(); } CHECK_LE(num_testimage, names_.size()); } } else { needsave = false; }
It shows it needs image sizes.
The idea is to replace training data with an fake empty data, and produce everything you need. Here is the full solution I have tested:
cp ../data/annotations/downloads/train.jsonl ../data/annotations/downloads/val.jsonl ../data/annotations/ && python3 decide_cates.py
echo '{"train":[],"val":[],"test_cls":[],"test_det":[{"image_id":"0000001","file_name":"0000001.jpg"}]}' >../data/annotations/info.json
head ../data/annotations/downloads/train.jsonl -n1 >../data/annotations/train.jsonl
,
head ../data/annotations/downloads/val.jsonl -n1 >../data/annotations/val.jsonl
python3 prepare_train_data.py
,
touch products/VGG_ILSVRC_16_layers_fc_reduced.caffemodel && python3 train.py
,
These 2 commands will result in failure, but .prototxt
you need have been generated.products/models/SSD_512x512/
python3 prepare_test_data.py
python3 eval.py
python3 merge_results.py
Please let me know if you have problem with this solution.
Thank you for detailed steps. I have solved it successfully.
The key is to change the parameter num_test_images
in deploy.prototxt
. It must be less than the size of val data in file val.txt
, otherwise it will show errors as shown above.
Okay,I will try. Thank you very much.
can you share the deploy.prototxt to me use the google drive ? Thank you :)
Hello, I want to detect my images using SDD model you trained, but I can't find deploy.prototxt. Can you provide ? Thank you very much.