Commit Graph

45 Commits

Author SHA1 Message Date
Kwabena W. Agyeman
9fa764035b scripts/libraries: Fix postprocess arg default. 2025-10-24 20:44:02 -07:00
Kwabena W. Agyeman
c4b0b5a3dc scripts/libraries: Fix issue with using YOLOV2. 2025-10-19 15:58:23 +04:00
Kwabena W. Agyeman
c8fc7903f4 scripts/libraries: Add hand landmark post-processing. 2025-10-18 10:17:56 -07:00
Kwabena W. Agyeman
55488e08a5 modules/py_ml: Add support for passing post-processor in Model(). 2025-10-18 10:11:42 -07:00
Kwabena W. Agyeman
8ece14c1a7 scripts/libraries: Add draw_keypoints() utils. 2025-10-18 10:11:41 -07:00
Kwabena W. Agyeman
bb8ed01a23 scripts/libraries: Add palm detector post-processing support. 2025-10-16 04:13:24 -07:00
iabdalkader
4944c157b0 scripts/libraries/ml: Split ml module into components.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-10-09 09:46:45 +02:00
Kwabena W. Agyeman
1e8eb2ec2f scripts/libraries: Move _NO_DETECTION into post-processors.
MicroPython doesn't import _NO_DETECTION from utils using the wildcard
operator. Importing it by name works, but, only after removing the
const() part in the call.
2025-10-08 08:36:24 +02:00
iabdalkader
a4ee9f0a3c lib/ml: Refactor postprocessing module into vendor-specific subpackages.
This commit restructures the ml.postprocessing module for better organization:

- Moved common utility functions (logit, sigmoid, threshold, quantize,
  dequantize, mod) from postprocessing.py to utils.py to avoid duplication
- Created vendor-specific subpackages:
  - ultralytics.py: YoloV2, YoloLC, YoloV5, YoloV8 classes
  - edgeimpulse.py: Fomo class
  - mediapipe.py: BlazeFace class
- Converted postprocessing.py file to postprocessing/ package directory
- Updated all class names to follow PascalCase convention
- Maintained full backwards compatibility via aliased imports in __init__.py

New usage:
  from ml.postprocessing import ultralytics
  ultralytics.YoloV2()

Backwards compatible:
  from ml.postprocessing import yolo_v2_postprocess

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-10-08 00:00:20 +02:00
Kwabena W. Agyeman
f6f39f924b lib/models: Add blazeface model. 2025-09-18 13:41:56 -07:00
Kwabena W. Agyeman
65829023f0 scripts/libraries: Add face detection post-processing. 2025-09-18 13:30:14 -07:00
Kwabena W. Agyeman
7124b5134d scripts/libraries: Add keypoint support to NMS.
NMS will now pass-through keypoints along with scaling/offsetting
them to be drawn correctly on the image.
2025-09-18 13:30:14 -07:00
Kwabena W. Agyeman
eccb90699d scripts/libraries: Fix pre-processing float input array normalization.
ULAB only does simple assignment operator operations in-place.
2025-09-18 13:30:14 -07:00
Kwabena W. Agyeman
e64877bbea scripts/libraries: Quantize threshold instead of dequantizing scores.
Compare a quantized threshold against the scores to save having to
dequantized all the scores which takes a significant amount of time
the more classes there are in the score array output.
2025-08-24 15:22:52 -07:00
Kwabena W. Agyeman
de7a761d3b scipts/libraries: Update fomo post-processor to use numpy vectors. 2025-08-24 15:22:51 -07:00
Kwabena W. Agyeman
84e6ee6507 modules/py_ml: Return tensor references for post-processors.
Converting the output tensors into floats for the prost-processors
causes memory exhaustion when models become very large. Additionally,
it wastes processing time converting values which may not be used. By
moving the conversion step into the post-processors we avoid this issue.

If no callback is passed for post-processing the converted output to
a floating point ndarray is returned still.
2025-08-24 14:43:24 -07:00
Kwabena W. Agyeman
5e72cdbde9 scripts/libraries: Add support for yolo_lc post-processing. 2025-05-15 20:58:23 -07:00
Kwabena W. Agyeman
5ec0bcfdfa scripts/libraries: Fix axis used for gathering bounding box results.
len(bb) returns the row count but bb.shape[0] is better to use.
2025-05-15 20:58:23 -07:00
Kwabena W. Agyeman
3d6ea57ad4 scripts/libraries: Remove tuple detection for np.nonzero.
np.nonzero always outputs a tuple.
2025-05-15 20:58:23 -07:00
Kwabena W. Agyeman
727d3200a2 scripts/libraries: Fix yolov2 and yolov5 variable naming. 2025-05-15 20:58:23 -07:00
Kwabena W. Agyeman
3e46eee35a scripts/libraries: Add support for yolov8 post-processing. 2025-05-15 20:58:22 -07:00
iabdalkader
416bc46136 scripts/examples: Update examples.
Use romfs paths.
2025-03-29 09:24:31 +01:00
iabdalkader
3f55d956c5 scripts/libraries: Load model's labels from file.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-03-29 08:41:28 +01:00
Kwabena W. Agyeman
979b4e8ee6 scripts/libraries: Simplify YOLO post-processing using keepdims. 2025-01-26 16:36:41 -08:00
Kwabena W. Agyeman
6d21326233 scripts/libraries: Expose nms settings in yolo post-processing callbacks. 2025-01-26 15:44:50 -08:00
Kwabena W. Agyeman
d67bd1ad7c scripts/libraries: Cleanup yolo v2 post-processing. 2024-12-30 00:20:31 -08:00
Kwabena W. Agyeman
2b98a4e963 scripts/libraries: Add yolo v5 post processing support. 2024-12-30 00:20:28 -08:00
iabdalkader
823da8dea0 scripts/libraries: Revert fully vectorize and cleanup yolo_v2.
This reverts commit 5394a3d32f.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-11-28 08:31:18 +01:00
Kwabena W. Agyeman
5394a3d32f scripts/libraries: Fully vectorize and cleanup yolo_v2 post-processing. 2024-11-24 14:29:48 -08:00
Kwabena W. Agyeman
73acc05ae8 scripts: Add yolov2 post-processor. 2024-11-23 23:02:31 -08:00
iabdalkader
dc2d466226 scripts/libraries: Add ml postprocessing module. 2024-10-18 20:43:11 +02:00
iabdalkader
5c2f4388cf scripts/libraries: Pass extra kwargs to audio from ml. 2024-10-18 20:27:07 +02:00
iabdalkader
6671d9df50 libraries/ml/ml/apps: Allow passing gain to audio init. 2024-10-09 19:40:49 +02:00
iabdalkader
3dd5cc3b26 misc: Update licenses. 2024-10-04 20:55:40 +02:00
Kwabena W. Agyeman
6b041409df scripts/libraries: Add missing return in microspeech.listen(). 2024-07-28 21:11:00 -07:00
Kwabena W. Agyeman
9848eed128 modules/py_image: Replace unpack with ndarray creation. 2024-07-18 16:36:16 -07:00
Kwabena W Agyeman
072db9647e
scripts/libraries: Update normalization to handle 3D/4D image tensors. (#2258)
* scripts/libraries: Add sanity checks to image Normalization.
2024-07-16 21:48:57 +02:00
Ibrahim Abdelkader
357b6f9b07
modules/py_ml: Fix model kwargs. (#2280)
* modules/py_ml: Fix model kwargs.
2024-07-14 23:44:37 +02:00
iabdalkader
6fd7d56a85 scripts: Update ML examples and library. 2024-07-13 00:33:32 +03:00
Ibrahim Abdelkader
c15bc9cdf4
Merge pull request #2260 from kwagyeman/kwabena/move_nms_to_utils
scripts/libraries: Moved nms class to ml/utils.
2024-07-08 22:37:04 +02:00
Kwabena W. Agyeman
6041c58294 scripts/libraries: Moved nms class to ml/utils. 2024-07-08 13:26:14 -07:00
iabdalkader
3b0e06587a scripts/libraries: Fix Normalization image format. 2024-07-08 23:21:16 +03:00
Kwabena W. Agyeman
3f8491cb0e scripts/libraries: Move nms to python. 2024-07-07 23:02:15 -07:00
Kwabena W. Agyeman
068c7c11f3 scripts/libraries: Fix bug in ml model.py assignment. 2024-07-07 15:41:03 -07:00
iabdalkader
9a186f4e27 libraries/ml: Convert ml to a package.
Add preprocessing, model wrapper and utils.
2024-07-07 21:48:38 +03:00