Download microprograms/temporal_segmentation/entry.py from X-NS/NSAQA: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/X-NS/NSAQA/resolve/main/microprograms/temporal_segmentation/entry.py
- Command line
-
hf download hf://spaces/X-NS/NSAQA/microprograms/temporal_segmentation/entry.py
-
curl -L -o entry.py https://huggingface.co/spaces/X-NS/NSAQA/resolve/main/microprograms/temporal_segmentation/entry.py
1.13 kB
| from microprograms.errors.splash_micro_program import get_splash_from_one_frame | |
| from microprograms.errors.angles_micro_programs import applyPositionTightnessError | |
| import numpy as np | |
| def entry_microprogram_one_frame(filepath, above_board, on_board, pose_pred, expected_twists, petal_count, expected_som, half_som_count, frame=None, splash_detector=None, visualize=False, dive_folder_num=None): | |
| if above_board: | |
| return 0 | |
| if on_board: | |
| return 0 | |
| splash = get_splash_from_one_frame(filepath, im=frame, predictor=splash_detector, visualize=visualize, dive_folder_num=dive_folder_num) | |
| if splash: | |
| return 1 | |
| # if completed with somersaults, we know we're in entry phase | |
| if not expected_som > half_som_count: | |
| return 1 | |
| if expected_twists > petal_count or expected_som > half_som_count: | |
| return 0 | |
| return 1 | |
| # if pose_pred is None: | |
| # return 1 | |
| # else: | |
| # angle = applyPositionTightnessError(filepath, pose_pred) | |
| # if angle > 90: | |
| # return 1 | |
| # if splash is not None: | |
| # return 1 | |
| # else: | |
| # return 0 | |