-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COCO dataset for SSD and update README.md #844
Conversation
…to ssd_coco_reader
f927827
to
46db499
Compare
fluid/object_detection/eval.py
Outdated
@@ -13,27 +13,27 @@ | |||
parser = argparse.ArgumentParser(description=__doc__) | |||
add_arg = functools.partial(add_arguments, argparser=parser) | |||
# yapf: disable | |||
add_arg('dataset', str, 'pascalvoc', "coco or pascalvoc.") | |||
add_arg('dataset', str, 'coco2014', "coco2014, coco2017, and pascalvoc.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use pascalvoc
as default training for all arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/eval.py
Outdated
add_arg('mean_value_R', float, 127.5, "mean value for R channel which will be subtracted") #103.94 | ||
add_arg('model_dir', str, '', "The model path.") | ||
add_arg('nms_threshold', float, 0.5, "nms threshold") | ||
add_arg('ap_version', str, 'integral', "integral, 11points, and cocoMAP") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VOC use 11point
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/eval.py
Outdated
add_arg('nms_threshold', float, 0.5, "nms threshold") | ||
add_arg('ap_version', str, 'integral', "integral, 11points, and cocoMAP") | ||
add_arg('resize_h', int, 300, "resize image size") | ||
add_arg('resize_w', int, 300, "resize image size") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize image size -> The resized image width.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/eval.py
Outdated
add_arg('model_dir', str, '', "The model path.") | ||
add_arg('nms_threshold', float, 0.5, "nms threshold") | ||
add_arg('ap_version', str, 'integral', "integral, 11points, and cocoMAP") | ||
add_arg('resize_h', int, 300, "resize image size") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize image size -> The resized image height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/eval.py
Outdated
add_arg('resize_w', int, 300, "resize image size") | ||
add_arg('mean_value_B', float, 127.5, "mean value for B channel which will be subtracted") #123.68 | ||
add_arg('mean_value_G', float, 127.5, "mean value for G channel which will be subtracted") #116.78 | ||
add_arg('mean_value_R', float, 127.5, "mean value for R channel which will be subtracted") #103.94 | ||
# yapf: enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yapf: enable -> yapf: enable
fluid/object_detection/reader.py
Outdated
else: | ||
return pascalvoc(settings, file_list, 'test', False) | ||
return _reader_creator(test_settings, file_list, 'test', False) | ||
elif 'pascalvoc' in settings.dataset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/train.py
Outdated
add_arg('mean_value_G', float, 127.5, "mean value which will be subtracted") #116.78 | ||
add_arg('mean_value_R', float, 127.5, "mean value which will be subtracted") #103.94 | ||
add_arg('is_toy', int, 0, "Toy for quick debug, 0 means using all data, while n means using only n sample") | ||
# yapf: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yapf: disable -> yapf: enable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/train.py
Outdated
add_arg('mean_value_B', float, 127.5, "mean value which will be subtracted") #123.68 | ||
add_arg('mean_value_G', float, 127.5, "mean value which will be subtracted") #116.78 | ||
add_arg('mean_value_R', float, 127.5, "mean value which will be subtracted") #103.94 | ||
add_arg('is_toy', int, 0, "Toy for quick debug, 0 means using all data, while n means using only n sample") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面默认参数 请统一按照VOC来设置。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/train.py
Outdated
add_arg('nms_threshold', float, 0.5, "nms threshold") | ||
add_arg('ap_version', str, 'integral', "integral, 11points") | ||
add_arg('resize_h', int, 300, "resize image size") | ||
add_arg('resize_w', int, 300, "resize image size") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize image size 语法有误,请按照左边的改过来。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/reader.py
Outdated
apply_expand=True, | ||
toy=0): | ||
def __init__(self, dataset, ap_version, toy, data_dir, label_file, resize_h, | ||
resize_w, mean_value, apply_distort, apply_expand): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参数顺序请按照左边的吧,一些可以设置默认值的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/README.md
Outdated
``` | ||
|
||
TBD | ||
|
||
### Evaluate | ||
|
||
```python | ||
env CUDA_VISIABLE_DEVICES=0 python eval.py --model='model/90' --test_list='' | ||
env CUDA_VISIABLE_DEVICES=0 python eval.py --dataset='pascalvoc' --model_dir='train_pascal_model/90' --test_list='' --ap_version='11point' | ||
env CUDA_VISIABLE_DEVICES=0 python eval_cocoMAP.py --dataset='coco2014' --model_dir='train_coco_model/24' | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env CUDA_VISIABLE_DEVICES=0 python eval.py --model='model/90' --data_dir='data/pascalvoc' --test_list='test.txt'
VOC和COCO分开写吧。
coco的评估命令。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/README.md
Outdated
``` | ||
You can evaluate your trained model in difference metric like 11point, integral on both PASCAL VOC and COCO dataset. Moreover, we provide eval_cocoMAP.py which uses a COCO-specific mAP metric defined by [COCO committee](http://cocodataset.org/#detections-eval). To use this eval_cocoMAP.py, [cocoapi](https://github.com/cocodataset/cocoapi) is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- in difference metric -> in different metric
- eval_cocoMAP.py ->
eval_coco.py
脚本名字也换下吧,觉得不要大小写混合。 - 告诉用户如何安装 cocoapi ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
<img src="images/COCO_val2014_000000142324.jpg" height=300 width=400 hspace='10'/> | ||
<img src="images/COCO_val2014_000000144003.jpg" height=300 width=400 hspace='10'/> <br /> | ||
MobileNet-SSD300x300 Visualization Examples | ||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是否要提供VOC的数据可视化?
@@ -0,0 +1,154 @@ | |||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eval_cocoMAP.py -> eval_coco_map.py ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
def if_exist(var): | ||
return os.path.exists(os.path.join(model_dir, var.name)) | ||
|
||
fluid.io.load_vars(exe, model_dir, predicate=if_exist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉 line 62和line65多余的空格。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was added by yapf, revised as comments
'bbox': bbox, | ||
'score': score | ||
} | ||
dts_res.append(dt_res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 85到line113数据重组是否要单独放个函数调用?使得代码结构清晰点。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/infer.py
Outdated
def if_exist(var): | ||
return os.path.exists(os.path.join(model_dir, var.name)) | ||
|
||
fluid.io.load_vars(exe, model_dir, predicate=if_exist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉多余的空格。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/train.py
Outdated
add_arg('is_toy', int, 0, "Toy for quick debug, 0 means using all data, while n means using only n sample") | ||
# yapf: enable | ||
|
||
add_arg('num_passes', int, 25, "Epoch number.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
25 -> 120 设置成VOC默认的吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
fluid/object_detection/train.py
Outdated
if test_map[0] > best_map: | ||
best_map = test_map[0] | ||
save_model('best_model') | ||
print("Test {0}, map {1}".format(pass_id, test_map[0])) | ||
print("Pass {0}, map {1}".format(pass_id, test_map[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map -> test map ? log中体现是test集。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
81b6707
to
b016ed6
Compare
No description provided.