Closed sukkyusun1 closed 4 years ago
If you use deploy/python/infer.py, you need to export inference model at first. Please refer to the instruction here https://github.com/PaddlePaddle/PaddleDetection/blob/master/docs/advanced_tutorials/deploy/EXPORT_MODEL.md
If you want to visualize the detection result, you could also use infer.py https://github.com/PaddlePaddle/PaddleDetection/blob/master/docs/tutorials/GETTING_STARTED_cn.md#%E6%A8%A1%E5%9E%8B%E9%A2%84%E6%B5%8B
If you use deploy/python/infer.py, you need to export inference model at first. Please refer to the instruction here https://github.com/PaddlePaddle/PaddleDetection/blob/master/docs/advanced_tutorials/deploy/EXPORT_MODEL.md
If you want to visualize the detection result, you could also use infer.py https://github.com/PaddlePaddle/PaddleDetection/blob/master/docs/tutorials/GETTING_STARTED_cn.md#%E6%A8%A1%E5%9E%8B%E9%A2%84%E6%B5%8B
i tried it but following occured
python -u tools/export_model.py -c configs/ppyolo/ppyolo.yml --output_dir=./inference_model -o weights=output/ppyolo1/model_final
Traceback (most recent call last):
File "tools/export_model.py", line 225, in
0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const, int) 2 paddle::operators::ConcatOp::InferShape(paddle::framework::InferShapeContext*) const 3 paddle::framework::OpDesc::InferShape(paddle::framework::BlockDesc const&) const
File "/home/sk/anaconda3/envs/paddle3.6/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2610, in append_op
attrs=kwargs.get("attrs", None))
File "/home/sk/anaconda3/envs/paddle3.6/lib/python3.6/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/home/sk/anaconda3/envs/paddle3.6/lib/python3.6/site-packages/paddle/fluid/layers/tensor.py", line 375, in concat
type='concat', inputs=inputs, outputs={'Out': [out]}, attrs=attrs)
File "/home/sk/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 147, in _add_coord
return fluid.layers.concat([input, x_range, y_range], axis=1)
File "/home/sk/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 226, in _detection_block
conv = self._add_coord(conv, is_test=is_test)
File "/home/sk/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 341, in _get_outputs
name=self.prefix_name + "yolo_block.{}".format(i))
File "/home/sk/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 416, in get_prediction
outputs = self._get_outputs(input, is_train=False)
File "/home/sk/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 93, in build
body_feats, im_size, exclude_nms=exclude_nms)
File "/home/sk/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 165, in test
return self.build(feed_vars, mode='test', exclude_nms=exclude_nms)
File "tools/export_model.py", line 200, in main
test_fetches = model.test(feed_vars, exclude_nms=FLAGS.exclude_nms)
File "tools/export_model.py", line 225, in
InvalidArgumentError: The 2-th dimension of input[0] and input[2] is expected to be equal.But received input[0]'s shape = [-1, 2048, 81, 54], input[2]'s shape = [1, 1, 54, 81]. [Hint: Expected inputs_dims[0][j] == inputs_dims[i][j], but received inputs_dims[0][j]:81 != inputs_dims[i][j]:54.] at (/paddle/paddle/fluid/operators/concat_op.h:63) [operator < concat > error]
The problem is the same as #1290 , please refer to it.
Closed due to repeat with https://github.com/PaddlePaddle/PaddleDetection/issues/1290
i have tried to training pp yolo with my own data
here is my training result 2020-08-25 16:14:57,807-INFO: Save model to output/ppyolo/model_final. 2020-08-25 16:15:11,572-INFO: Test iter 0 2020-08-25 16:15:12,218-INFO: Test finish iter 3 2020-08-25 16:15:12,219-INFO: Total number of images: 10, inference time: 7.289463352593803 fps. 2020-08-25 16:15:12,219-INFO: Start evaluate... 2020-08-25 16:15:12,269-INFO: Accumulating evaluatation results... 2020-08-25 16:15:12,271-INFO: mAP(0.50, 11point) = 26.00 2020-08-25 16:15:12,273-INFO: Save model to output/ppyolo/best_model. 2020-08-25 16:15:17,056-INFO: Best test box ap: 25.99969811499025, in iter: 4999
when infering with test set. no object was detected.
python deploy/python/infer.py --model_dir=./output/ppyolo/ --image_file=/home/sk/PaddleDetection/dataset/voc/VOCdevkit/VOC2007/JPEGImages/7578154304132.jpg --use_gpu=True
run it and result is following ----------- Running Arguments ----------- image_file: /home/sk/PaddleDetection/dataset/voc/VOCdevkit/VOC2007/JPEGImages/7578154304132.jpg model_dir: ./output/ppyolo/ output_dir: output run_benchmark: False run_mode: fluid threshold: 0.5 use_gpu: True video_file:
----------- Model Configuration ----------- Model Arch: YOLO Use Padddle Executor: False Transform Order: --transform op: Resize --transform op: Normalize --transform op: Permute
Inference: 24.036645889282227 ms per batch image save result to: output/7578154304132.jpg