Skip to content
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

Unify the metrics implementation between low-level and high-level API. #26158

Merged
merged 21 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
16974da
Refine paddle/metrics
qingqing01 Aug 10, 2020
43d8b64
Move paddle/incubate/hapi/metrics to paddle/metric
qingqing01 Aug 11, 2020
ad32568
Add Precision, Recall and Auc metric
qingqing01 Aug 15, 2020
20b4936
Update unit testing
qingqing01 Aug 17, 2020
1d7dce5
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
qingqing01 Aug 17, 2020
6b9e9d7
Update code to latest develop
qingqing01 Aug 17, 2020
a6235a4
Follow comments
qingqing01 Aug 17, 2020
362d914
Update API to 2.0
qingqing01 Aug 18, 2020
562bd14
--amend
qingqing01 Aug 18, 2020
e2dd416
Fix unit testing after updating API
qingqing01 Aug 18, 2020
c30a961
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
qingqing01 Aug 18, 2020
4faabe3
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
qingqing01 Aug 19, 2020
6d66305
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
qingqing01 Aug 19, 2020
180a95f
Update test_metrics
qingqing01 Aug 19, 2020
08308fd
Enhance unit testing
qingqing01 Aug 19, 2020
52b9f20
Fix code style
qingqing01 Aug 19, 2020
24c3849
Fix sample code
qingqing01 Aug 19, 2020
15420d8
Merge branch 'develop' into hapi_metrics
qingqing01 Aug 20, 2020
553cb01
Update code sample in metric.Recall
qingqing01 Aug 21, 2020
d5c31c0
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
qingqing01 Aug 24, 2020
0fb112c
Fix code sample about Adam after develop code is updated
qingqing01 Aug 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ set(PADDLE_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/)
if (WITH_TESTING)
add_subdirectory(paddle/reader/tests)
add_subdirectory(paddle/dataset/tests)
add_subdirectory(paddle/tests)
add_subdirectory(paddle/fluid/tests)
add_subdirectory(paddle/fluid/contrib/tests)
add_subdirectory(paddle/fluid/contrib/slim/tests)
Expand Down
27 changes: 27 additions & 0 deletions python/paddle/fluid/tests/unittests/test_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3686,5 +3686,32 @@ def test_basic_gru(self):
batch_first=batch_first)


class TestMetricsDetectionMap(unittest.TestCase):
def test_detection_map(self):
program = fluid.Program()
with program_guard(program):
detect_res = fluid.layers.data(
name='detect_res',
shape=[10, 6],
append_batch_size=False,
dtype='float32')
label = fluid.layers.data(
name='label',
shape=[10, 1],
append_batch_size=False,
dtype='float32')
box = fluid.layers.data(
name='bbox',
shape=[10, 4],
append_batch_size=False,
dtype='float32')
map_eval = fluid.metrics.DetectionMAP(
detect_res, label, box, class_num=21)
cur_map, accm_map = map_eval.get_map_var()
self.assertIsNotNone(cur_map)
self.assertIsNotNone(accm_map)
print(str(program))


if __name__ == '__main__':
unittest.main()
49 changes: 0 additions & 49 deletions python/paddle/fluid/tests/unittests/test_metrics.py

This file was deleted.

2 changes: 0 additions & 2 deletions python/paddle/incubate/hapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from . import model
from .model import *

from . import metrics
from . import datasets
from . import distributed
from . import vision
Expand All @@ -39,7 +38,6 @@
'datasets',
'distributed',
'download',
'metrics',
'vision',
'text',
'utils',
Expand Down
8 changes: 4 additions & 4 deletions python/paddle/incubate/hapi/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ class ProgBarLogger(Callback):

optim = fluid.optimizer.Adam(0.001)
model.prepare(optimizer=optim,
loss_function=paddle.nn.CrossEntropyLoss(),
metrics=hapi.metrics.Accuracy())
loss=paddle.nn.CrossEntropyLoss(),
metrics=paddle.metric.Accuracy())

callback = hapi.callbacks.ProgBarLogger(log_freq=10)
model.fit(train_dataset, batch_size=64, callbacks=callback)
Expand Down Expand Up @@ -441,8 +441,8 @@ class ModelCheckpoint(Callback):

optim = fluid.optimizer.Adam(0.001)
model.prepare(optimizer=optim,
loss_function=paddle.nn.CrossEntropyLoss(),
metrics=hapi.metrics.Accuracy())
loss=paddle.nn.CrossEntropyLoss(),
metrics=paddle.metric.Accuracy())

callback = hapi.callbacks.ModelCheckpoint(save_dir='./temp')
model.fit(train_dataset, batch_size=64, callbacks=callback)
Expand Down
233 changes: 0 additions & 233 deletions python/paddle/incubate/hapi/metrics.py

This file was deleted.

Loading