Skip to content

tech-sketch/SegAL

Repository files navigation

SegAL

CI Status Poetry black pre-commit

PyPI Version Supported Python versions License

SegAL is an active learning freamwork for semantice segmentation.

Installation

SegAL is available on PyPI:

pip install segal

SegAL officially supports Python 3.8.

Active Learning Cycle

To understand what SegAL can do, we first introduce the pool-based active learning cycle.

al_cycle

  • Step 0: Prepare seed data (a small number of labeled data used for training)
  • Step 1: Train the model with seed data
    • Step 2: Predict unlabeled data with the trained model
    • Step 3: Query informative samples based on predictions
    • Step 4: Annotator (Oracle) annotate the selected samples
    • Step 5: Input the new labeled samples to labeled dataset
    • Step 6: Retrain model
  • Repeat step2~step6 until the f1 score of the model beyond the threshold or annotation budget is no left

SegAL can simulate the whole active learning cycle.

Usage

The user can execute the below command to run the active learning cycle.

python examples/run_al_cycle.py --dataset CamVid  --data_path ./data/CamVid/ --model_name Unet --encoder resnet34 --encoder_weights imagenet --num_classes 12 --strategy LeastConfidence --seed_ratio 0.02 --query_ratio 0.02 --n_epoch 1
  • dataset: which dataset to use, CamVidVOCCityScapes
  • data_path: the path where the data store
  • num_classes: number of classes
  • model_name: name of segmentation model. More model names can be found in architectures
  • encoder: name of encoder used in model. More encoder names can be found in encoders
  • encoder_weights: pretrained weights. See encoder table with available weights for each encoder
  • strategy: name of sampling strategy. Available strategies: RandomSampling, LeastConfidence, MarginSampling, EntropySampling, CealSampling, VoteSampling. You can find the papers for these strategy in here
  • seed_ratio: percentage of seed data. The used for initial training.
  • query_ratio: percentage of queried data in each round
  • n_epoch: number of epoch in each round

More explanation can be found in usage

Contributing

If you have suggestions for how SeqAL could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

Credits

About

Semantic Segmentation Active Learning

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published