Download microprograms/temporal_segmentation/twist.py from X-NS/NSAQA: direct link, hf CLI and curl.
- Browser
- Download file 971 Bytes
-
https://huggingface.co/spaces/X-NS/NSAQA/resolve/main/microprograms/temporal_segmentation/twist.py
- Command line
-
hf download hf://spaces/X-NS/NSAQA/microprograms/temporal_segmentation/twist.py
-
curl -L -o twist.py https://huggingface.co/spaces/X-NS/NSAQA/resolve/main/microprograms/temporal_segmentation/twist.py
971 Bytes
| from microprograms.errors.angles_micro_programs import applyPositionTightnessError | |
| from models.pose_estimator.pose_estimator_model_setup import get_pose_estimation | |
| from microprograms.errors.distance_from_springboard_micro_program import board_end | |
| from microprograms.errors.distance_from_springboard_micro_program import find_which_side_board_on | |
| from models.detectron2.platform_detector_setup import get_platform_detector | |
| import cv2 | |
| import numpy as np | |
| def twist_microprogram_one_frame(filepath, on_board, expected_twists, petal_count, expected_som, half_som_count, pose_pred=None, diver_detector=None, pose_model=None): | |
| if on_board: | |
| return 0 | |
| if expected_twists <= petal_count or expected_som <= half_som_count: | |
| return 0 | |
| angle = applyPositionTightnessError(filepath, pose_pred=pose_pred, diver_detector=diver_detector, pose_model=pose_model) | |
| if angle is None: | |
| return 0 | |
| if angle > 80: | |
| return 1 | |
| else: | |
| return 0 |