Skip to content

CLI#72

Open
brohoya wants to merge 28 commits intomainfrom
40-add-a-cli
Open

CLI#72
brohoya wants to merge 28 commits intomainfrom
40-add-a-cli

Conversation

@brohoya
Copy link
Copy Markdown
Contributor

@brohoya brohoya commented Mar 29, 2026

No description provided.

@brohoya brohoya linked an issue Mar 29, 2026 that may be closed by this pull request
@EHxuban11
Copy link
Copy Markdown
Contributor

I have tried the cli and noted the following things:

libreyolo models:

It would be desirable for sizes to be ordered by parameters: e.g. Yolo9 has t,s,m,c
image

I also got this error, but the libreyolo models command still worked. Maybe we can add a warning filter so the cli output looks cleaner?
% libreyolo models
/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/albumentations/check_version.py:147: UserWarning: Error fetching version info <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)>
data = fetch_version_info()

libreyolo info --model MODEL_NAME

It works well if the name exists, but if the name doesn't exist, it still tries to load it then throws an error. Instead it could check if the model exists before trying to load it, and if it doesn't exist, it could say something like: "Unknown model yolo9t. Available: libreyolo9t, libreyolo9s, ..."

image

Libreyolo predict with the --save option

After saving, it should print the output path

Libreyolo train

instead of:
Missing option '--data' (env var: 'None').
It could say something like:

Missing required option '--data'.                      
Expects a YAML dataset config (YOLO format).           
Try: libreyolo train --data coco8.yaml --model yolox-s 
--epochs 3

@EHxuban11
Copy link
Copy Markdown
Contributor

Generally speaking the errors are not very helpful/actionable. They should tell you what you did wrong and what the library expects.

@brohoya
Copy link
Copy Markdown
Contributor Author

brohoya commented Apr 4, 2026

@EHxuban11

  • Reordered the model sizes
  • Cleared the warnings on the CLI
  • For model names: it now finds a close match suggestion and shows available models:
libreyolo info --model yolo9t
2026-04-04 12:31:53 | ERROR    | Error [model_not_found]: Unknown model 'yolo9t'. Did you mean 'yolo9-t'?
2026-04-04 12:31:53 | INFO     |   Suggestion: Available: yolox-n, yolox-t, yolox-s, yolox-m, yolox-l, yolox-x, yolo9-t, yolo9-s, yolo9-m, yolo9-c, rfdetr-n, rfdetr-s, rfdetr-m, rfdetr-l

libreyolo info --model banana
2026-04-04 12:32:28 | ERROR    | Error [model_not_found]: Unknown model 'banana'.
2026-04-04 12:32:28 | INFO     |   Suggestion: Available: yolox-n, yolox-t, yolox-s, yolox-m, yolox-l, yolox-x, yolo9-t, yolo9-s, yolo9-m, yolo9-c, rfdetr-n, rfdetr-s, rfdetr-m, rfdetr-l
  • The predict command now shows the path where the output is saved:
libreyolo predict --source libreyolo/assets/parkour.jpg --save
2026-04-04 12:33:10 | INFO     | Loading yolox-s...
2026-04-04 12:33:10 | INFO     | Running inference on libreyolo/assets/parkour.jpg...
image 1/1 parkour.jpg: 1280x852 3 persons, 2 skateboards, 103.1ms
Results saved to runs/detect/predict3
  • About the train command, the CLI is showing this now:
libreyolo train
Usage: libreyolo train [OPTIONS]
Try 'libreyolo train --help' for help.
╭─ Error ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Missing option '--data'.                                                                                                    │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
libreyolo train --help
                                                                                                                               
 Usage: libreyolo train [OPTIONS]                                                                                              
                                                                                                                               
 Train a detection model on a dataset.                                                                                         
                                                                                                                               
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --data                                  TEXT     Path to dataset YAML (YOLO format, e.g. coco8.yaml) [required]          │
│    --model                                 TEXT     Model name or path to weights [default: yolox-s]                        │
│    --epochs                                INTEGER  Training epochs [default: 300]                                          │
│    --batch                                 INTEGER  Batch size per device [default: 16]                                     │
│    --imgsz                                 INTEGER  Training image size [default: 640]                                      │
│    --device                                TEXT     Device: 0, cpu, mps, auto [default: auto]                               │
│    --workers                               INTEGER  Dataloader workers [default: 4]                                         │
│    --seed                                  INTEGER  Random seed [default: 0]                                                │
│    --resume                                TEXT     Resume training: true, or path to checkpoint                            │
│    --amp                --no-amp                    Automatic Mixed Precision [default: amp]                                │
│    --pretrained         --no-pretrained             Use pretrained weights [default: pretrained]                            │
│    --optimizer                             TEXT     Optimizer: sgd, adam, adamw [default: sgd]                              │
│    --lr0                                   FLOAT    Initial learning rate [default: 0.01]                                   │
│    --momentum                              FLOAT    SGD momentum / Adam beta1 [default: 0.937]                              │
│    --weight-decay                          FLOAT    L2 regularization [default: 0.0005]                                     │
│    --nesterov           --no-nesterov               Nesterov momentum [default: nesterov]                                   │
│    --scheduler                             TEXT     LR schedule type [default: yoloxwarmcos]                                │
│    --warmup-epochs                         INTEGER  Warmup duration [default: 5]                                            │
│    --warmup-lr-start                       FLOAT    Initial warmup LR [default: 0.0]                                        │
│    --min-lr-ratio                          FLOAT    Minimum LR ratio [default: 0.05]                                        │
│    --mosaic                                FLOAT    Mosaic probability [default: 1.0]                                       │
│    --mixup                                 FLOAT    Mixup probability [default: 1.0]                                        │
│    --hsv-prob                              FLOAT    HSV jitter probability [default: 1.0]                                   │
│    --flip-prob                             FLOAT    Horizontal flip probability [default: 0.5]                              │
│    --degrees                               FLOAT    Rotation +/- degrees [default: 10.0]                                    │
│    --translate                             FLOAT    Translation ratio [default: 0.1]                                        │
│    --shear                                 FLOAT    Shear angle [default: 2.0]                                              │
│    --mosaic-scale                          TEXT     Mosaic scale range [default: (0.1,2.0)]                                 │
│    --mixup-scale                           TEXT     Mixup scale range [default: (0.5,1.5)]                                  │
│    --no-aug-epochs                         INTEGER  Disable augmentation for final N epochs [default: 15]                   │
│    --ema                --no-ema                    Exponential Moving Average [default: ema]                               │
│    --ema-decay                             FLOAT    EMA decay factor [default: 0.9998]                                      │
│    --val                --no-val                    Validate during training [default: val]                                 │
│    --eval-interval                         INTEGER  Validate every N epochs [default: 10]                                   │
│    --patience                              INTEGER  Early stopping patience (0=disabled) [default: 50]                      │
│    --project                               TEXT     Output directory root [default: runs/train]                             │
│    --name                                  TEXT     Experiment name [default: exp]                                          │
│    --exist-ok           --no-exist-ok               Reuse existing output directory [default: no-exist-ok]                  │
│    --save-period                           INTEGER  Save checkpoint every N epochs [default: 10]                            │
│    --log-interval                          INTEGER  Log loss every N batches [default: 10]                                  │
│    --json                                           JSON output to stdout                                                   │
│    --quiet                                          Suppress stderr                                                         │
│    --dry-run                                        Validate without executing                                              │
│    --help-json                                      Dump command schema as JSON                                             │
│    --help                                           Show this message and exit.                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@brohoya brohoya closed this Apr 4, 2026
@brohoya brohoya reopened this Apr 4, 2026
@brohoya brohoya marked this pull request as ready for review April 4, 2026 10:50
brohoya added 23 commits April 4, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CLI

2 participants