-
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
Add eval.py and fix bug for MobileNet-SSD. #852
Conversation
fluid/object_detection/eval.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 | ||
# 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: enable
https://github.com/google/yapf#why-does-yapf-destroy-my-awesome-formatting
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.
Done.
fluid/object_detection/eval.py
Outdated
add_arg('dataset', str, 'pascalvoc', "coco or pascalvoc.") | ||
add_arg('batch_size', int, 32, "Minibatch size.") | ||
add_arg('use_gpu', bool, True, "Whether use GPU.") | ||
add_arg('data_dir', str, '', "The path to save model.") |
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 path to save model. Please update the comments.
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.
Done.
fluid/object_detection/eval.py
Outdated
add_arg('batch_size', int, 32, "Minibatch size.") | ||
add_arg('use_gpu', bool, True, "Whether use GPU.") | ||
add_arg('data_dir', str, '', "The path to save model.") | ||
add_arg('test_list', str, '', "The path to save model.") |
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.
Please update the comments.
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.
Done.
fluid/object_detection/eval.py
Outdated
|
||
place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace() | ||
exe = fluid.Executor(place) | ||
#exe.run(fluid.default_startup_program()) |
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.
Remove this line?
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.
Done. Thanks!
fluid/object_detection/eval.py
Outdated
return os.path.exists(os.path.join(model_dir, var.name)) | ||
|
||
fluid.io.load_vars(exe, model_dir, predicate=if_exist) | ||
#fluid.io.load_persistables(exe, model_dir, main_program=test_program) |
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.
Remove this line?
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.
Done. Thanks!
fluid/object_detection/train.py
Outdated
|
||
best_map = 0. | ||
|
||
def test(pass_id, best_map): | ||
_, accum_map = map_eval.get_map_var() | ||
map_eval.reset(exe) | ||
test_map = None | ||
for _, data in enumerate(test_reader()): |
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.
这里为什么要用enumerate呢?
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.
Done. Thanks!
fluid/object_detection/reader.py
Outdated
img = img[[2, 1, 0], :, :] | ||
img = img.astype('float32') | ||
img -= settings.img_mean | ||
#img = img.flatten() |
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.
Removed. Thanks!
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.
LGTM.
Fix #853