Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README #101

Merged
merged 32 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
95fab66
version bump
kozlov721 Oct 3, 2024
4791b78
updated readme
kozlov721 Oct 3, 2024
8316ea8
fixed grammar and typos
kozlov721 Oct 3, 2024
a8dfba9
updated readme
kozlov721 Oct 3, 2024
a16b7f2
Merge branch 'dev' into docs/readme-updates
kozlov721 Oct 3, 2024
004d5bf
updated readme
kozlov721 Oct 6, 2024
3d32cfc
updated docstring
kozlov721 Oct 6, 2024
78b8a1c
Merge branch 'docs/readme-updates' of github.com:luxonis/luxonis-trai…
kozlov721 Oct 6, 2024
d77afcb
simplified credentials
kozlov721 Oct 6, 2024
737c2cb
changed types
kozlov721 Oct 6, 2024
e4f2850
removed old badges
kozlov721 Oct 6, 2024
0e6cd7f
unified readme styles
kozlov721 Oct 7, 2024
d60361b
updated pyproject.toml
kozlov721 Oct 7, 2024
8c1089c
formatted configs
kozlov721 Oct 7, 2024
70dcf6e
config examples
kozlov721 Oct 7, 2024
260e020
tutorials
kozlov721 Oct 7, 2024
f743a40
small updates
kozlov721 Oct 7, 2024
a0b2c41
updated readme
kozlov721 Oct 7, 2024
e395a66
updated complex example
kozlov721 Oct 7, 2024
1d78824
Merge branch 'dev' into docs/readme-updates
kozlov721 Oct 7, 2024
725fcc7
Update README.md
kozlov721 Oct 7, 2024
1547744
updated readme
kozlov721 Oct 7, 2024
e9e84e4
changed predefined model for example tuning
kozlov721 Oct 7, 2024
c4aa467
unified command arguments
kozlov721 Oct 7, 2024
0568a3d
Update README.md
kozlov721 Oct 7, 2024
396be8a
updated study name
kozlov721 Oct 8, 2024
98a2610
updated readme
kozlov721 Oct 8, 2024
f04e9a8
Update README.md
kozlov721 Oct 8, 2024
81581ca
fixed toc
kozlov721 Oct 8, 2024
66f086c
Update README.md
kozlov721 Oct 8, 2024
dd22395
updated command
kozlov721 Oct 8, 2024
74a9205
added weights to test
kozlov721 Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
718 changes: 603 additions & 115 deletions README.md

Large diffs are not rendered by default.

557 changes: 366 additions & 191 deletions configs/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions configs/classification_heavy_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: 200
Expand Down
4 changes: 2 additions & 2 deletions configs/classification_light_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: 200
Expand Down
57 changes: 29 additions & 28 deletions configs/complex_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ model:
- RepPANNeck

losses:
name: EfficientKeypointBboxLoss
- name: EfficientKeypointBBoxLoss

metrics:
- name: ObjectKeypointSimilarity
is_main_metric: true
- name: MeanAveragePrecisionKeypoints

visualizers:
name: MultiVisualizer
params:
visualizers:
- name: KeypointVisualizer
params:
nonvisible_color: blue
- name: BBoxVisualizer
params:
colors:
person: "#FF5055"
- name: MultiVisualizer
params:
visualizers:
- name: KeypointVisualizer
params:
nonvisible_color: blue
- name: BBoxVisualizer
params:
colors:
person: "#FF5055"

- name: SegmentationHead
inputs:
- RepPANNeck
losses:
name: BCEWithLogitsLoss
- name: BCEWithLogitsLoss
metrics:
- name: F1Score
params:
Expand All @@ -47,9 +47,9 @@ model:
params:
task: binary
visualizers:
name: SegmentationVisualizer
params:
colors: "#FF5055"
- name: SegmentationVisualizer
params:
colors: "#FF5055"

- name: EfficientBBoxHead
inputs:
Expand All @@ -58,18 +58,18 @@ model:
conf_thres: 0.75
iou_thres: 0.45
losses:
name: AdaptiveDetectionLoss
- name: AdaptiveDetectionLoss
metrics:
name: MeanAveragePrecision
- name: MeanAveragePrecision
visualizers:
name: BBoxVisualizer
- name: BBoxVisualizer

tracker:
project_name: coco_test
save_directory: output
is_tensorboard: True
is_wandb: False
is_mlflow: False
is_tensorboard: true
is_wandb: false
is_mlflow: false

loader:
train_view: train
Expand All @@ -86,23 +86,23 @@ trainer:

n_sanity_val_steps: 1
profiler: null
verbose: True
verbose: true
batch_size: 8
accumulate_grad_batches: 1
epochs: &epochs 200
n_workers: 8
validation_interval: 10
n_log_images: 8
skip_last_batch: True
log_sub_losses: True
skip_last_batch: true
log_sub_losses: true
save_top_k: 3

preprocessing:
train_image_size: [&height 384, &width 384]
keep_aspect_ratio: True
train_rgb: True
keep_aspect_ratio: true
train_rgb: true
normalize:
active: True
active: true
augmentations:
- name: Defocus
params:
Expand Down Expand Up @@ -131,14 +131,15 @@ trainer:
mode: min
verbose: true
- name: ExportOnTrainEnd
- name: ArchiveOnTrainEnd
- name: TestOnTrainEnd

optimizer:
name: SGD
params:
lr: 0.02
momentum: 0.937
nesterov: True
nesterov: true
weight_decay: 0.0005

scheduler:
Expand Down
4 changes: 2 additions & 2 deletions configs/detection_heavy_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
4 changes: 2 additions & 2 deletions configs/detection_light_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
6 changes: 3 additions & 3 deletions configs/example_export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down Expand Up @@ -46,5 +46,5 @@ exporter:
onnx:
opset_version: 11
blobconverter:
active: True
active: true
shaves: 8
10 changes: 5 additions & 5 deletions configs/example_tuning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@


model:
name: segmentation_light
name: detection_light
predefined_model:
name: SegmentationModel
name: DetectionModel
params:
variant: light

Expand All @@ -15,9 +15,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true
augmentations:
- name: Defocus
params:
Expand All @@ -40,7 +40,7 @@ trainer:


tuner:
study_name: seg_study
study_name: det_study
n_trials: 10
storage:
storage_type: local
Expand Down
4 changes: 2 additions & 2 deletions configs/keypoint_bbox_heavy_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
4 changes: 2 additions & 2 deletions configs/keypoint_bbox_light_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
4 changes: 2 additions & 2 deletions configs/segmentation_heavy_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
4 changes: 2 additions & 2 deletions configs/segmentation_light_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ loader:
trainer:
preprocessing:
train_image_size: [384, 512]
keep_aspect_ratio: True
keep_aspect_ratio: true
normalize:
active: True
active: true

batch_size: 8
epochs: &epochs 200
Expand Down
40 changes: 33 additions & 7 deletions luxonis_train/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ class _ViewType(str, Enum):
),
]

WeightsType = Annotated[
Path | None,
typer.Option(
help="Path to the model weights.",
show_default=False,
metavar="FILE",
),
]

ViewType = Annotated[
_ViewType, typer.Option(help="Which dataset view to use.")
]
Expand Down Expand Up @@ -77,12 +86,13 @@ def train(
def test(
config: ConfigType = None,
view: ViewType = _ViewType.VAL,
weights: WeightsType = None,
opts: OptsType = None,
):
"""Evaluate model."""
from luxonis_train.core import LuxonisModel

LuxonisModel(config, opts).test(view=view.value)
LuxonisModel(config, opts).test(view=view.value, weights=weights)


@app.command()
Expand All @@ -94,11 +104,21 @@ def tune(config: ConfigType = None, opts: OptsType = None):


@app.command()
def export(config: ConfigType = None, opts: OptsType = None):
def export(
config: ConfigType = None,
save_path: Annotated[
Path | None,
typer.Option(help="Path where to save the exported model."),
] = None,
weights: WeightsType = None,
opts: OptsType = None,
):
"""Export model."""
from luxonis_train.core import LuxonisModel

LuxonisModel(config, opts).export()
LuxonisModel(config, opts).export(
onnx_save_path=save_path, weights=weights
)


@app.command()
Expand All @@ -107,13 +127,17 @@ def infer(
view: ViewType = _ViewType.VAL,
save_dir: SaveDirType = None,
source_path: SourcePathType = None,
weights: WeightsType = None,
opts: OptsType = None,
):
"""Run inference."""
from luxonis_train.core import LuxonisModel

LuxonisModel(config, opts).infer(
view=view.value, save_dir=save_dir, source_path=source_path
view=view.value,
save_dir=save_dir,
source_path=source_path,
weights=weights,
)


Expand All @@ -138,7 +162,8 @@ def inspect(
"-s",
help=(
"Multiplier for the image size. "
"By default the images are shown in their original size."
"By default the images are shown in their original size. "
"Use this option to scale them."
),
show_default=False,
),
Expand Down Expand Up @@ -223,19 +248,20 @@ def inspect(

@app.command()
def archive(
config: ConfigType = None,
executable: Annotated[
str | None,
typer.Option(
help="Path to the model file.", show_default=False, metavar="FILE"
),
] = None,
config: ConfigType = None,
weights: WeightsType = None,
opts: OptsType = None,
):
"""Generate NN archive."""
from luxonis_train.core import LuxonisModel

LuxonisModel(str(config), opts).archive(executable)
LuxonisModel(str(config), opts).archive(path=executable, weights=weights)


def version_callback(value: bool):
Expand Down
Loading
Loading