Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,108 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
```
|
| 13 |
-
Test script
|
| 14 |
-
```bash
|
| 15 |
-
import requests
|
| 16 |
-
|
| 17 |
-
SERVER_URL = "http://localhost:7860"
|
| 18 |
-
|
| 19 |
-
image_file = "20230825_122540_jpg.rf.f0620856e7afdbd116ceffdfd512b03a.jpg"
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
with open(image_file, 'rb') as f:
|
| 23 |
-
files = {'file': f}
|
| 24 |
-
response = requests.post(f"{SERVER_URL}/image", files=files)
|
| 25 |
-
|
| 26 |
-
print(response.status_code)
|
| 27 |
-
print(response.json())
|
| 28 |
-
|
| 29 |
-
```
|
| 30 |
-
Mapping Name to ID
|
| 31 |
-
```bash
|
| 32 |
-
name_to_id = {
|
| 33 |
-
"NA": 'NA',
|
| 34 |
-
"Bullseye": 10,
|
| 35 |
-
"One": 11,
|
| 36 |
-
"Two": 12,
|
| 37 |
-
"Three": 13,
|
| 38 |
-
"Four": 14,
|
| 39 |
-
"Five": 15,
|
| 40 |
-
"Six": 16,
|
| 41 |
-
"Seven": 17,
|
| 42 |
-
"Eight": 18,
|
| 43 |
-
"Nine": 19,
|
| 44 |
-
"A": 20,
|
| 45 |
-
"B": 21,
|
| 46 |
-
"C": 22,
|
| 47 |
-
"D": 23,
|
| 48 |
-
"E": 24,
|
| 49 |
-
"F": 25,
|
| 50 |
-
"G": 26,
|
| 51 |
-
"H": 27,
|
| 52 |
-
"S": 28,
|
| 53 |
-
"T": 29,
|
| 54 |
-
"U": 30,
|
| 55 |
-
"V": 31,
|
| 56 |
-
"W": 32,
|
| 57 |
-
"X": 33,
|
| 58 |
-
"Y": 34,
|
| 59 |
-
"Z": 35,
|
| 60 |
-
"Up": 36,
|
| 61 |
-
"Down": 37,
|
| 62 |
-
"Right": 38,
|
| 63 |
-
"Left": 39,
|
| 64 |
-
"Up Arrow": 36,
|
| 65 |
-
"Down Arrow": 37,
|
| 66 |
-
"Right Arrow": 38,
|
| 67 |
-
"Left Arrow": 39,
|
| 68 |
-
"Stop": 40}
|
| 69 |
-
```
|
| 70 |
-
# Training
|
| 71 |
-
```bash
|
| 72 |
-
git clone https://github.com/ultralytics/yolov5 # clone repo
|
| 73 |
-
cd yolov5
|
| 74 |
-
pip install -qr requirements.txt # install dependencies
|
| 75 |
-
```
|
| 76 |
-
Prepare dataset, pretrained model and config
|
| 77 |
-
```bash
|
| 78 |
-
data.yaml
|
| 79 |
-
!cp "Week_8.pt" "best.pt"
|
| 80 |
-
```
|
| 81 |
-
Train
|
| 82 |
-
|
| 83 |
-
# Demo Web
|
| 84 |
-
Now deployed In huggingface https://huggingface.co/spaces/Mahiruoshi/mdpg4
|
| 85 |
-
## Test directly
|
| 86 |
-
```
|
| 87 |
-
import requests
|
| 88 |
-
|
| 89 |
-
url = "https://mahiruoshi-mdpg4.hf.space/" # 你的 Space 地址
|
| 90 |
-
file_path = "20230825_122540_jpg.rf.f0620856e7afdbd116ceffdfd512b03a.jpg"
|
| 91 |
-
|
| 92 |
-
with open(file_path, "rb") as f:
|
| 93 |
-
files = {"file": f}
|
| 94 |
-
response = requests.post(url, files=files)
|
| 95 |
-
|
| 96 |
-
print("Status:", response.status_code)
|
| 97 |
-
try:
|
| 98 |
-
print("Response:", response.json())
|
| 99 |
-
except:
|
| 100 |
-
print("Response:", response.text)
|
| 101 |
-
```
|
| 102 |
-
|
| 103 |
-
```bash
|
| 104 |
-
# First time
|
| 105 |
-
python train.py --img 416 --batch 128 --epochs 150 --data E:/workspace/mdp/data.yaml --weights best.pt --cache
|
| 106 |
-
|
| 107 |
-
#python train.py --img 416 --batch 128 --epochs 150 --data E:/workspace/mdp/data.yaml --weights best.pt --cache --hyp hyp.yaml
|
| 108 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Mdpg4
|
| 3 |
+
emoji: 🔥
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.43.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|