Upload 6 files
Browse files- cut-onnx.py +14 -0
- ssd_horse.jpg +0 -0
- yolo11-seg-test.py +16 -0
- yolo11_seg_config.json +52 -0
- yolo11s-seg-cut.onnx +3 -0
- yolo11s-seg.onnx +3 -0
cut-onnx.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import onnx
|
| 2 |
+
|
| 3 |
+
input_path = "yolo11s-seg.onnx"
|
| 4 |
+
output_path = "yolo11s-seg-cut.onnx"
|
| 5 |
+
input_names = ["images"]
|
| 6 |
+
output_names = ["/model.23/Concat_1_output_0",
|
| 7 |
+
"/model.23/Concat_2_output_0",
|
| 8 |
+
"/model.23/Concat_3_output_0",
|
| 9 |
+
"/model.23/cv4.0/cv4.0.2/Conv_output_0",
|
| 10 |
+
"/model.23/cv4.1/cv4.1.2/Conv_output_0",
|
| 11 |
+
"/model.23/cv4.2/cv4.2.2/Conv_output_0",
|
| 12 |
+
"output1"]
|
| 13 |
+
|
| 14 |
+
onnx.utils.extract_model(input_path, output_path, input_names, output_names)
|
ssd_horse.jpg
ADDED
|
yolo11-seg-test.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ultralytics import YOLO
|
| 2 |
+
|
| 3 |
+
# Load a model
|
| 4 |
+
model = YOLO("yolo11s-seg.pt")
|
| 5 |
+
model.info()
|
| 6 |
+
|
| 7 |
+
# Use the model
|
| 8 |
+
results = model("./images/ssd_horse.jpg")
|
| 9 |
+
|
| 10 |
+
# Save the results
|
| 11 |
+
results[0].save("yolo11s-seg-result.jpg")
|
| 12 |
+
|
| 13 |
+
# Export to onnx with simplify
|
| 14 |
+
model.export(format='onnx', simplify=True)
|
| 15 |
+
|
| 16 |
+
|
yolo11_seg_config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "ONNX",
|
| 3 |
+
"npu_mode": "NPU1",
|
| 4 |
+
"quant": {
|
| 5 |
+
"input_configs": [
|
| 6 |
+
{
|
| 7 |
+
"tensor_name": "images",
|
| 8 |
+
"calibration_dataset": "./dataset/coco_1000.tar",
|
| 9 |
+
"calibration_size": 32,
|
| 10 |
+
"calibration_mean": [0, 0, 0],
|
| 11 |
+
"calibration_std": [255.0, 255.0, 255.0]
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"calibration_method": "MinMax",
|
| 15 |
+
"precision_analysis": true,
|
| 16 |
+
"precision_analysis_method":"EndToEnd"
|
| 17 |
+
},
|
| 18 |
+
"input_processors": [
|
| 19 |
+
{
|
| 20 |
+
"tensor_name": "images",
|
| 21 |
+
"tensor_format": "BGR",
|
| 22 |
+
"src_format": "BGR",
|
| 23 |
+
"src_dtype": "U8",
|
| 24 |
+
"src_layout": "NHWC"
|
| 25 |
+
}
|
| 26 |
+
],
|
| 27 |
+
"output_processors": [
|
| 28 |
+
{
|
| 29 |
+
"tensor_name": "/model.23/Concat_1_output_0",
|
| 30 |
+
"dst_perm": [0, 2, 3, 1]
|
| 31 |
+
}, {
|
| 32 |
+
"tensor_name": "/model.23/Concat_2_output_0",
|
| 33 |
+
"dst_perm": [0, 2, 3, 1]
|
| 34 |
+
}, {
|
| 35 |
+
"tensor_name": "/model.23/Concat_3_output_0",
|
| 36 |
+
"dst_perm": [0, 2, 3, 1]
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"tensor_name": "/model.23/cv4.0/cv4.0.2/Conv_output_0",
|
| 40 |
+
"dst_perm": [0, 2, 3, 1]
|
| 41 |
+
}, {
|
| 42 |
+
"tensor_name": "/model.23/cv4.1/cv4.1.2/Conv_output_0",
|
| 43 |
+
"dst_perm": [0, 2, 3, 1]
|
| 44 |
+
}, {
|
| 45 |
+
"tensor_name": "/model.23/cv4.2/cv4.2.2/Conv_output_0",
|
| 46 |
+
"dst_perm": [0, 2, 3, 1]
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"compiler": {
|
| 50 |
+
"check": 0
|
| 51 |
+
}
|
| 52 |
+
}
|
yolo11s-seg-cut.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17c958a92905a17f085056fd678259b754942db803210d7cae38ff8978a51307
|
| 3 |
+
size 40482328
|
yolo11s-seg.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f1d774af7212af31a43c6a658660c7beeee89b04bc669bf7583680f97ffc694
|
| 3 |
+
size 40657019
|