Skip to content

Commit

Permalink
ability to configure output names of exported models
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlov721 committed Jan 16, 2024
1 parent da01def commit 7517598
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion luxonis_train/models/luxonis_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,17 @@ def export_onnx(self, save_path: str, **kwargs) -> list[str]:
for i in range(len(out))
]
)
output_names = [

if self.cfg.exporter.output_names is not None:
len_names = len(self.cfg.exporter.output_names)
if len_names != len(output_order):
logger.warning(
f"Number of provided output names ({len_names}) does not match "
f"number of outputs ({len(output_order)}). Using default names."
)
self.cfg.exporter.output_names = None

output_names = self.cfg.exporter.output_names or [
f"{node_name}/{output_name}/{i}"
for node_name, output_name, i in output_order
]
Expand Down
1 change: 1 addition & 0 deletions luxonis_train/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class ExportConfig(BaseModel):
reverse_input_channels: bool = True
scale_values: list[float] | None = None
mean_values: list[float] | None = None
output_names: list[str] | None = None
onnx: OnnxExportConfig = OnnxExportConfig()
blobconverter: BlobconverterExportConfig = BlobconverterExportConfig()
upload_url: str | None = None
Expand Down

0 comments on commit 7517598

Please sign in to comment.