Skip to content

Commit 0102c15

Browse files
authored
Minor fixes
1 parent 64dc804 commit 0102c15

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

examples/yolo/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cargo run -r --example yolo -- --task detect --ver v9 --scale t # YOLOv9
4141
cargo run -r --example yolo -- --task detect --ver v10 --scale n # YOLOv10
4242
cargo run -r --example yolo -- --task detect --ver v11 --scale n # YOLOv11
4343
cargo run -r --example yolo -- --task detect --ver rtdetr --scale l # RTDETR
44-
cargo run -r --example yolo -- --task detect --ver v8 --nc 1 --model yolov8s-world-v2-shoes.onnx # YOLOv8-world <local file>
44+
cargo run -r --example yolo -- --task detect --ver v8 --model yolo/v8-s-world-v2-shoes.onnx # YOLOv8-world
4545

4646
# Pose
4747
cargo run -r --example yolo -- --task pose --ver v8 --scale n # YOLOv8-Pose
@@ -51,7 +51,7 @@ cargo run -r --example yolo -- --task pose --ver v11 --scale n # YOLOv11-Pose
5151
cargo run -r --example yolo -- --task segment --ver v5 --scale n # YOLOv5-Segment
5252
cargo run -r --example yolo -- --task segment --ver v8 --scale n # YOLOv8-Segment
5353
cargo run -r --example yolo -- --task segment --ver v11 --scale n # YOLOv8-Segment
54-
cargo run -r --example yolo -- --task segment --ver v8 --model FastSAM-s-dyn-f16.onnx # FastSAM <local file>
54+
cargo run -r --example yolo -- --task segment --ver v8 --model yolo/FastSAM-s-dyn-f16.onnx # FastSAM
5555

5656
# Obb
5757
cargo run -r --example yolo -- --ver v8 --task obb --scale n --width 1024 --height 1024 --source images/dota.png # YOLOv8-Obb
@@ -70,8 +70,6 @@ cargo run -r --example yolo -- --ver v11 --task obb --scale n --width 1024 --hei
7070
let options = Options::default()
7171
.with_yolo_version(YOLOVersion::V5) // YOLOVersion: V5, V6, V7, V8, V9, V10, RTDETR
7272
.with_yolo_task(YOLOTask::Classify) // YOLOTask: Classify, Detect, Pose, Segment, Obb
73-
// .with_nc(80)
74-
// .with_names(&COCO_CLASS_NAMES_80)
7573
.with_model("xxxx.onnx")?;
7674

7775
```
@@ -94,6 +92,8 @@ let options = Options::default()
9492
..Default::default()
9593
}
9694
)
95+
// .with_nc(80)
96+
// .with_names(&COCO_CLASS_NAMES_80)
9797
.with_model("xxxx.onnx")?;
9898
```
9999
</details>

examples/yolo/main.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,30 @@ pub struct Args {
105105
fn main() -> Result<()> {
106106
let args = Args::parse();
107107

108-
// path
109-
let path = args.model.unwrap_or({
110-
format!(
108+
// model path
109+
let path = match &args.model {
110+
None => format!(
111111
"yolo/{}-{}-{}.onnx",
112112
args.ver.name(),
113113
args.scale.name(),
114114
args.task.name()
115-
)
116-
});
115+
),
116+
Some(x) => x.to_string(),
117+
};
117118

118119
// saveout
119-
let saveout = format!(
120-
"{}-{}-{}",
121-
args.ver.name(),
122-
args.scale.name(),
123-
args.task.name()
124-
);
120+
let saveout = match &args.model {
121+
None => format!(
122+
"{}-{}-{}",
123+
args.ver.name(),
124+
args.scale.name(),
125+
args.task.name()
126+
),
127+
Some(x) => {
128+
let p = std::path::PathBuf::from(&x);
129+
p.file_stem().unwrap().to_str().unwrap().to_string()
130+
}
131+
};
125132

126133
// device
127134
let device = if args.cuda {

0 commit comments

Comments
 (0)