Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
klemen1999 committed May 31, 2024
1 parent 0269143 commit d38d395
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
27 changes: 13 additions & 14 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ Here you can change everything related to actual training of the model.

We use [Albumentations](https://albumentations.ai/docs/) library for `augmentations`. [Here](https://albumentations.ai/docs/api_reference/full_reference/#pixel-level-transforms) you can see a list of all pixel level augmentations supported, and [here](https://albumentations.ai/docs/api_reference/full_reference/#spatial-level-transforms) you see all spatial level transformations. In config you can specify any augmentation from this lists and their params. Additionaly we support `Mosaic4` batch augmentation and letterbox resizing if `keep_aspect_ratio: True`.

| Key | Type | Default value | Description |
| ----------------- | ------------------------------------------------------------------------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| train_image_size | list\[int\] | \[256, 256\] | image size used for training \[height, width\] |
| keep_aspect_ratio | bool | True | bool if keep aspect ration while resizing |
| train_rgb | bool | True | bool if train on rgb or bgr |
| normalize.active | bool | True | bool if use normalization |
| normalize.params | dict | {} | params for normalization, see [documentation](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Normalize) |
| Key | Type | Default value | Description |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| train_image_size | list\[int\] | \[256, 256\] | image size used for training \[height, width\] |
| keep_aspect_ratio | bool | True | bool if keep aspect ration while resizing |
| train_rgb | bool | True | bool if train on rgb or bgr |
| normalize.active | bool | True | bool if use normalization |
| normalize.params | dict | {} | params for normalization, see [documentation](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Normalize) |
| augmentations | list\[{"name": Name of the augmentation, "active": Bool if aug is active, by default set to True, "params": Parameters of the augmentation}\] | \[\] | list of Albumentations augmentations |

### Optimizer
Expand Down Expand Up @@ -241,17 +241,16 @@ Option specific for ONNX export.

Here you can specify options for tuning.

| Key | Type | Default value | Description |
| ---------- | ----------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| study_name | str | "test-study" | Name of the study. |
| use_pruner | bool | True | Whether to use the MedianPruner. |
| n_trials | int \| None | 15 | Number of trials for each process. `None` represents no limit in terms of numbner of trials. |
| timeout | int \| None | None | Stop study after the given number of seconds. |
| Key | Type | Default value | Description |
| ---------- | ----------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| study_name | str | "test-study" | Name of the study. |
| use_pruner | bool | True | Whether to use the MedianPruner. |
| n_trials | int \| None | 15 | Number of trials for each process. `None` represents no limit in terms of numbner of trials. |
| timeout | int \| None | None | Stop study after the given number of seconds. |
| params | dict\[str, list\] | {} | Which parameters to tune. The keys should be in the format `key1.key2.key3_<type>`. Type can be one of `[categorical, float, int, longuniform, uniform, subset]`. For more information about the types, visit [Optuna documentation](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.trial.Trial.html). |

**Note**: "subset" sampling is currently only supported for augmentations. You can specify a set of augmentations defined in `trainer` to choose from and every run subset of random N augmentations will be active.


Example of params for tuner block:

```yaml
Expand Down
4 changes: 2 additions & 2 deletions luxonis_train/core/tuner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os.path as osp
import random
from logging import getLogger
import os.path as osp
from typing import Any

import lightning.pytorch as pl
Expand Down Expand Up @@ -203,7 +203,7 @@ def _get_trial_params(self, trial: optuna.trial.Trial) -> dict[str, Any]:
return new_params

def _augs_to_indices(self, aug_names: list[str]) -> list[int]:
"""Maps augmentation names to indices"""
"""Maps augmentation names to indices."""
all_augs = self.cfg.trainer.preprocessing.augmentations
aug_indices = []
for aug_name in aug_names:
Expand Down

0 comments on commit d38d395

Please sign in to comment.