Skip to content

Commit

Permalink
round the predict output to float32 resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Ai committed Aug 20, 2024
1 parent db360b0 commit cb28745
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ odc-dscache>=0.2.3
odc-stac @ git+https://github.com/opendatacube/odc-stac@69bdf64

# odc-stac is in PyPI
odc-stats[ows]
odc-stats[ows] @ git+https://github.com/opendatacube/odc-stats@f3f3b91

# For ML
tflite-runtime
Expand Down
2 changes: 2 additions & 0 deletions odc/stats/plugins/lc_ml_treelite.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def mask_and_predict(
if block_masked.shape[0] > 0:
dmat = tl2cgen.DMatrix(block_masked)
output_data = predictor.predict(dmat).squeeze(axis=1)
# round the number to float32 resolution
output_data = np.round(output_data, 6)
if ptype == "categorical":
prediction[mask_flat] = output_data.argmax(axis=-1)[..., np.newaxis]
else:
Expand Down

0 comments on commit cb28745

Please sign in to comment.