Skip to main content

Plugin to easly test a yolo model and retrain it

Project description

License MIT Python 3.10–3.12 tests

Simple napari annotator

Minimal napari plugin for YOLO bbox detection + quick correction + retraining.

No dataset browser, no extra workflow logic. User provides the image in napari.

UI flow

  1. Path to model (.pt) or model folder
  2. Load model
  3. Predict
  4. Optional destination folder for retrained model (browse or type)
  5. Edit boxes in napari shapes layer (yolo_bboxes)
  6. Add correction
  7. Retrain

UI

Starting from scratch

The model input supports either:

  • A .pt model file, or
  • A folder path.

Folder behavior on Load model:

  • If the folder already contains one or more .pt files, the first one is loaded.
  • If the folder contains no .pt file, the plugin copies the bundled yolov8n.pt into that folder and loads it.
  • Empty model input is invalid and will show an error.

If you do not have a model yet, start from a pretrained YOLOv8 nano checkpoint and use it as your initial file:

After downloading, select that yolov8n.pt file in the Model field and continue with the correction/retrain loop.

Loading a model

Assumptions

  • Input image is already RGB 8-bit (or compatible with clipping/conversion).
  • Single class (0: LABEL) for now.
  • Exactly one image layer should be present when using Add correction.

Predicting label

Folder behavior

Given a model path like:

.../my_model/best.pt

The plugin uses .../my_model as root.

Add correction

Each click saves:

  • Image to my_model/corrections/<image_name>_<timestamp>.png
  • Labels to my_model/corrections/<image_name>_<timestamp>.txt
  • Training config to my_model/corrections/training_config.json (created/updated)

Image layer behavior:

  • If no image layer exists, Add correction shows an error.
  • If more than one image layer exists, Add correction shows an error.
  • If exactly one image layer exists, that image layer is used for saving correction image data.

training_config.json defaults:

  • image_size: prefilled from the current image size using max(height, width)
  • batch: 8
  • epochs: 100
  • patience: 30

You can edit this file before clicking Retrain.

Label format is YOLO detection:

class x_center y_center width height

normalized to [0, 1].

Retrain

Each click creates:

  • <retrain_root>/dataset/
    • images/train, images/val
    • labels/train, labels/val
    • dataset.yaml
  • Trains YOLO from those corrections
  • Copies best model to:
    • <retrain_root>/best.pt
  • Deletes training traces folder after extracting best.pt

<retrain_root> resolution:

  • If destination field is set, retraining outputs there.
  • Otherwise it defaults to my_model/retrained_<timestamp>.

So the retrained folder keeps a clean dataset + final model, without run artifacts.

Warning: Data labeled will be equally divided between traning and validation (50%).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_napari_cci_annotator-0.0.2.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_napari_cci_annotator-0.0.2-py3-none-any.whl (6.0 MB view details)

Uploaded Python 3

File details

Details for the file simple_napari_cci_annotator-0.0.2.tar.gz.

File metadata

File hashes

Hashes for simple_napari_cci_annotator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 309290e039127f7159b1afeac7720fdfaa33f2b9b19c330e2c001f64f70e9844
MD5 7680e5a25155f1877ffd0940e49be104
BLAKE2b-256 07ebd02a6e53e1520a4889b3799bbea2533cb4a05c79545fe6bb05d2c8cebfa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_napari_cci_annotator-0.0.2.tar.gz:

Publisher: test_and_deploy.yml on CCI-GU-Sweden/simple-napari-cci-annotator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_napari_cci_annotator-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_napari_cci_annotator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4555da51a674a1e4e991cc0b6b4c7404668e65694f277fdd978afdb3095e2e36
MD5 bb5ca883919f464e9bcafd921da68129
BLAKE2b-256 16b274e542bea4acbf4d319c8fe962a2dc13311e08646deaa4d6eef70a4033d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_napari_cci_annotator-0.0.2-py3-none-any.whl:

Publisher: test_and_deploy.yml on CCI-GU-Sweden/simple-napari-cci-annotator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page