Download tests/helpers.py from sunnycloudhust/TrafficVision: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/datasets/sunnycloudhust/TrafficVision/resolve/main/tests/helpers.py
- Command line
-
hf download hf://datasets/sunnycloudhust/TrafficVision/tests/helpers.py
-
curl -L -o helpers.py https://huggingface.co/datasets/sunnycloudhust/TrafficVision/resolve/main/tests/helpers.py
488 Bytes
| """Small deterministic fixtures shared by pipeline tests.""" | |
| import torch | |
| class SyntheticDetector: | |
| """Return a known moving box so tests can verify tracking and speed export.""" | |
| def __init__(self): | |
| self.index = 0 | |
| def predict(self, image): | |
| x = 20 + self.index * 2 | |
| self.index += 1 | |
| return dict( | |
| boxes=torch.tensor([[x, 50.0, x + 30, 80.0]]), | |
| scores=torch.tensor([0.9]), | |
| labels=torch.tensor([1]), | |
| ) | |