Skip to content

Commit

Permalink
Fix tests for the new default configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemellophone committed Oct 18, 2022
1 parent c9bc9bc commit 1cc1d56
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 101 deletions.
8 changes: 4 additions & 4 deletions tests/test_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_agg_compute_phase1():
]
loc_tile_grids = ut.compress(tile_grids, flags)
loc_tile_filepaths = ut.compress(tile_filepaths, flags)
assert sum(flags) == 15
assert sum(flags) >= 10

# Run localizer
loc_outputs = loc.post(loc.predict(loc.pre(loc_tile_filepaths, config='phase1')))
Expand All @@ -33,13 +33,13 @@ def test_agg_compute_phase1():
# Aggregate
detects = agg.compute(img_shape, loc_tile_grids, loc_outputs, config='phase1')

assert len(detects) in [3, 4]
assert len(detects) >= 3

targets = [
{'l': 'elephant', 'c': 0.9299, 'x': 4597, 'y': 2322, 'w': 72, 'h': 149},
{'l': 'elephant', 'c': 0.8739, 'x': 4865, 'y': 2422, 'w': 97, 'h': 109},
{'l': 'elephant', 'c': 0.7115, 'x': 4806, 'y': 2476, 'w': 66, 'h': 119},
{'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
# {'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
]

for output, target in zip(detects, targets):
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_agg_compute_mvp():
# Aggregate
detects = agg.compute(img_shape, loc_tile_grids, loc_outputs, config='mvp')

assert len(detects) in [7, 8]
assert len(detects) >= 6

# fmt: off
targets = [
Expand Down
133 changes: 42 additions & 91 deletions tests/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def test_loc_onnx_pipeline_phase1():
outputs = post(preds)

assert len(outputs) == 1
assert len(outputs[0]) == 5
# assert len(outputs[0]) == 7
assert len(outputs[0]) >= 250

# fmt: off
targets = [
Expand All @@ -76,38 +75,38 @@ def test_loc_onnx_pipeline_phase1():
'w': 53.78145658,
'h': 66.46106896,
},
{
'l': 'elephant',
'c': 0.61152166,
'x': 216.61065204,
'y': 193.30525090,
'w': 42.83404541,
'h': 62.44728440,
},
{
'l': 'elephant',
'c': 0.50862342,
'x': 51.61210749,
'y': 235.37819260,
'w': 79.69709660,
'h': 17.41258826,
},
{
'l': 'elephant',
'c': 0.44841822,
'x': 57.47630427,
'y': 236.92587515,
'w': 94.69935960,
'h': 16.03246718,
},
{
'l': 'elephant',
'c': 0.44012001,
'x': 37.07233605,
'y': 230.39122596,
'w': 105.40560208,
'h': 24.81017362,
},
# {
# 'l': 'elephant',
# 'c': 0.61152166,
# 'x': 216.61065204,
# 'y': 193.30525090,
# 'w': 42.83404541,
# 'h': 62.44728440,
# },
# {
# 'l': 'elephant',
# 'c': 0.50862342,
# 'x': 51.61210749,
# 'y': 235.37819260,
# 'w': 79.69709660,
# 'h': 17.41258826,
# },
# {
# 'l': 'elephant',
# 'c': 0.44841822,
# 'x': 57.47630427,
# 'y': 236.92587515,
# 'w': 94.69935960,
# 'h': 16.03246718,
# },
# {
# 'l': 'elephant',
# 'c': 0.44012001,
# 'x': 37.07233605,
# 'y': 230.39122596,
# 'w': 105.40560208,
# 'h': 24.81017362,
# },
# {
# 'l': 'elephant',
# 'c': 0.38498798,
Expand Down Expand Up @@ -170,7 +169,7 @@ def test_loc_onnx_pipeline_mvp():
outputs = post(preds)

assert len(outputs) == 1
assert len(outputs[0]) == 8
assert len(outputs[0]) >= 1

# fmt: off
targets = [
Expand All @@ -182,62 +181,14 @@ def test_loc_onnx_pipeline_mvp():
'w': 52.55188457,
'h': 56.18781456,
},
{
'l': 'elephant',
'c': 0.54303294,
'x': 213.27392578,
'y': 195.15114182,
'w': 48.83143498,
'h': 61.92804424,
},
{
'l': 'elephant',
'c': 0.25485479,
'x': 39.34061373,
'y': 227.89024939,
'w': 99.23480694,
'h': 26.51788095,
},
{
'l': 'elephant',
'c': 0.24082227,
'x': 56.96651517,
'y': 229.90174278,
'w': 62.85778339,
'h': 23.15211838,
},
{
'l': 'elephant',
'c': 0.22669222,
'x': 213.39426832,
'y': 200.48779296,
'w': 36.94954974,
'h': 57.41221266,
},
{
'l': 'elephant',
'c': 0.19940485,
'x': 219.36613581,
'y': 205.06403996,
'w': 41.39131986,
'h': 46.13519756,
},
{
'l': 'kob',
'c': 0.17925532,
'x': 6.99571814,
'y': 0.92224179,
'w': 43.32685734,
'h': 18.18345876,
},
{
'l': 'elephant',
'c': 0.15872234,
'x': 160.69904972,
'y': 235.63134765,
'w': 51.77306659,
'h': 19.74641535,
}
# {
# 'l': 'elephant',
# 'c': 0.54303294,
# 'x': 213.27392578,
# 'y': 195.15114182,
# 'w': 48.83143498,
# 'h': 61.92804424,
# },
]
# fmt: on

Expand Down
12 changes: 6 additions & 6 deletions tests/test_scoutbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def test_pipeline_phase1():
wic_, detects = scoutbot.pipeline(img_filepath, config='phase1')

assert abs(wic_ - 1.0) < 1e-2
assert len(detects) in [3, 4]
assert len(detects) >= 3

targets = [
{'l': 'elephant', 'c': 0.9299, 'x': 4597, 'y': 2322, 'w': 72, 'h': 149},
{'l': 'elephant', 'c': 0.8739, 'x': 4865, 'y': 2422, 'w': 97, 'h': 109},
{'l': 'elephant', 'c': 0.7115, 'x': 4806, 'y': 2476, 'w': 66, 'h': 119},
{'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
# {'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
]

for output, target in zip(detects, targets):
Expand All @@ -52,13 +52,13 @@ def test_batch_phase1():
detects = detects_list[0]

assert abs(wic_ - 1.0) < 1e-2
assert len(detects) in [3, 4]
assert len(detects) >= 3

targets = [
{'l': 'elephant', 'c': 0.9299, 'x': 4597, 'y': 2322, 'w': 72, 'h': 149},
{'l': 'elephant', 'c': 0.8739, 'x': 4865, 'y': 2422, 'w': 97, 'h': 109},
{'l': 'elephant', 'c': 0.7115, 'x': 4806, 'y': 2476, 'w': 66, 'h': 119},
{'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
# {'l': 'elephant', 'c': 0.5236, 'x': 3511, 'y': 1228, 'w': 47, 'h': 78},
]

for output, target in zip(detects, targets):
Expand All @@ -77,7 +77,7 @@ def test_pipeline_mvp():
wic_, detects = scoutbot.pipeline(img_filepath, config='mvp')

assert abs(wic_ - 1.0) < 1e-2
assert len(detects) in [7, 8]
assert len(detects) >= 6

# fmt: off
targets = [
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_batch_mvp():
detects = detects_list[0]

assert abs(wic_ - 1.0) < 1e-2
assert len(detects) in [7, 8]
assert len(detects) >= 6

# fmt: off
targets = [
Expand Down

0 comments on commit 1cc1d56

Please sign in to comment.