Spaces:
Paused
Paused
Download model.py from bankba/pipecounting: direct link, hf CLI and curl.
- Browser
- Download file 753 Bytes
-
https://huggingface.co/spaces/bankba/pipecounting/resolve/main/model.py
- Command line
-
hf download hf://spaces/bankba/pipecounting/model.py
-
curl -L -o model.py https://huggingface.co/spaces/bankba/pipecounting/resolve/main/model.py
753 Bytes
| import torch | |
| ## เราสร้างฟังก์ชั่นโดยรับตัวแปรเป็น confident value เข้าไป ซึ่งจะมีค่าตั้งแต่ 0-1 ไว้สำหรับเป็นค่า threshold prediction | |
| def get_yolov5(confident_val): | |
| ## path ในที่นี้คือจะเป็น path ที่ไปยังโมเดลของเราที่วางไว้ครับ ถ้ามีชื่ออื่น จะต้องเปลี่ยนให้ตรงด้วย | |
| model = torch.hub.load('./yolov5', 'custom', path='./countmodel.pt', source='local') | |
| model.conf = confident_val | |
| model.max_det = 4000 | |
| return model |