sahi

Framework agnostic sliced/tiled inference + interactive ui + error analysis plots

MIT License

Downloads
160.6K
Stars
3.6K
Committers
38

Bot releases are visible (Hide)

sahi - v0.8.11

Published by fcakyon almost 3 years ago

What's Changed

Full Changelog: https://github.com/obss/sahi/compare/0.8.10...0.8.11

sahi - v0.8.10

Published by fcakyon almost 3 years ago

What's Changed

Full Changelog: https://github.com/obss/sahi/compare/0.8.9...0.8.10

sahi - v0.8.9

Published by fcakyon almost 3 years ago

What's Changed

Full Changelog: https://github.com/obss/sahi/compare/0.8.8...0.8.9

sahi - v0.8.8

Published by fcakyon almost 3 years ago

enhancement

  • add coco to yolov5 export utilty (#258)
  • shapely 2.0.0 support, supported fiftyone versions (#257)
  • update shapely to v1.8.0 (#259)

bugfixes

  • fix a bug in coco upsampling/downsampling (#253)
  • fix a bug in export_coco_as_yolov5 (#262)

ci

  • update yolov5 version in tests (#256)
sahi - v0.8.6

Published by fcakyon about 3 years ago

improvements

  • update postprocess behaviour (#247)

testing

  • update torch to 1.9.1 for workflows (#248)
  • update mmdet version to 2.17.0 for testing (#250)
  • add yolov5n weight download util (#251)
  • improve test durations (#252)
sahi - v0.8.5

Published by fcakyon about 3 years ago

bugfixes, enhancements

  • handle when image name is very short in yolov5 conversion (#230)
  • fix coco category creation without supercategory (#237)
  • fix yolov5 conf threshold (#242)
  • fix mmdet img size (#243)
  • handle when mmdet config contains resize with keep_ratio=False (#244)
  • update yolov5 version to 6.0.1 in ci tests (#245)
sahi - v0.8.4

Published by fcakyon about 3 years ago

  • handle predictions with negative bbox values (#225)
  • fix remove_invalid_coco_results (#227)
  • fix coco evaluation (#228)

Remove invalid coco results:

from sahi.utils.file import save_json
from sahi.utils.coco import remove_invalid_coco_results

# remove invalid predictions from COCO results JSON
coco_results = remove_invalid_coco_results("coco_result.json")

# export processed COCO results
save_json(coco_results, "fixed_coco_result.json")

# bonus: remove invalid predictions from COCO results JSON by giving COCO
# dataset path to also filter out bbox results exceeding image height&width
coco_results = remove_invalid_coco_results("coco_result.json", "coco_dataset.json")
sahi - v0.8.3

Published by fcakyon about 3 years ago

  • fix a bug in coco2fiftyone (#223)
sahi - v0.8.2

Published by fcakyon about 3 years ago

  • fix optional dependencies (#221)
  • move conda builds to conda-forge (#219)
sahi - v0.8.1

Published by fcakyon about 3 years ago

make repo compatible for conda-forge:

  • Include requirements.txt in sdist (#217) thanks to @weiji14
sahi - v0.8.0

Published by fcakyon about 3 years ago

new cli description:

Command Description
predict perform sliced/standard prediction using any yolov5/mmdet model
predict-fiftyone perform sliced/standard prediction using any yolov5/mmdet model and explore results in fiftyone app
coco slice automatically slice COCO annotation and image files
coco fiftyone explore multiple prediction results on your COCO dataset ordered by false positives
coco evaluate evaluate classwise COCO AP and AR for given predictions and ground truth
coco analyse calcualate and export many detection and segmentation error margin plots
coco yolov5 automatically convert any COCO dataset to yolov5 format

new cli usage:

predict

sahi predict --source image/file/or/folder --model_path path/to/model --model_config_path path/to/config

predict-fiftyone

sahi predict-fiftyone --image_dir image/file/or/folder --dataset_json_path dataset.json --model_path path/to/model --model_config_path path/to/config

coco slice

sahi coco slice --image_dir dir/to/images --dataset_json_path dataset.json

coco fiftyone

sahi coco fiftyone --image_dir dir/to/images --dataset_json_path dataset.json cocoresult1.json cocoresult2.json

coco evaluate

sahi coco evaluate --dataset_json_path dataset.json --result_json_path result.json

coco analyse

sahi coco analyse --dataset_json_path dataset.json --result_json_path result.json

coco yolov5

sahi coco yolov5 --image_dir dir/to/images --dataset_json_path dataset.json  --train_split 0.9

breaking changes in predict cli:

  • config_path to model_config_path
  • conf_thresh to model_confidence_threshold
  • match_metric to postprocess_match_metric
  • match_thresh to postprocess_match_threshold
  • class_agnostic to postprocess_class_agnostic
  • pickle to export_pickle, crop to export_crop
  • novisual to export_visual
  • no_sliced_pred to no_sliced_prediction
  • no_standard_pred to no_standard_prediction
  • coco_file to dataset_json_path
sahi - v0.7.4

Published by fcakyon about 3 years ago

enhancements

  • add script for inspecting cocoresults in fiftyone (#192)
  • create symlinks for mot utils (#199)
  • handle when iou_thrs is a single float (#196)
  • Update coco_evaluation.py (#197)

bugfix

  • fix coco_evaluation script (#195)
  • fix a typo in object annotation (#194)
sahi - v0.7.3

Published by fcakyon about 3 years ago

enhancements

  • handle negative bbox coords, utilize image_size param (#188)

  • add get_upsampled_coco utility to Coco (#189)

  • add category and negative sample based coco up/sub-sampling (#191)

  • Subsample COCO dataset file:

from sahi.utils.coco import Coco

# specify coco dataset path
coco_path = "coco.json"

# init Coco object
coco = Coco.from_coco_dict_or_path(coco_path)

# create a Coco object with 1/10 of total images
subsampled_coco = coco.get_subsampled_coco(subsample_ratio=10)

# export subsampled COCO dataset
save_json(subsampled_coco.json, "subsampled_coco.json")

# bonus: create a Coco object with 1/10 of total images that contain first category
subsampled_coco = coco.get_subsampled_coco(subsample_ratio=10, category_id=0)

# bonus2: create a Coco object with negative samples reduced to 1/10
subsampled_coco = coco.get_subsampled_coco(subsample_ratio=10, category_id=-1)
  • Upsample COCO dataset file:
from sahi.utils.coco import Coco

# specify coco dataset path
coco_path = "coco.json"

# init Coco object
coco = Coco.from_coco_dict_or_path(coco_path)

# create a Coco object with each sample is repeated 10 times
upsampled_coco = coco.get_upsampled_coco(upsample_ratio=10)

# export upsampled COCO dataset
save_json(upsampled_coco.json, "upsampled_coco.json")

# bonus: create a Coco object with images that contain first category repeated 10 times
subsampled_coco = coco.get_subsampled_coco(upsample_ratio=10, category_id=0)

# bonus2: create a Coco object with negative samples upsampled by 10 times
upsampled_coco = coco.get_upsampled_coco(upsample_ratio=10, category_id=-1)
sahi - v0.7.2

Published by fcakyon about 3 years ago

  • add large tiff image reading support (#183)
  • add concurrent slice export (#184)
sahi - v0.7.1

Published by fcakyon about 3 years ago

  • fix segmentation slicing (#174)
sahi - v0.7.0

Published by fcakyon over 3 years ago

  • refactor predict api (#170)

breaking changes

in predict and predict_fiftyone funtions:

  • replaced model_name arg with model_type
  • replaced model_parameters arg with model_path, model_config_path, model_confidence_threshold, model_device, model_category_mapping, model_category_remapping

in DetectionModel base class:

  • replaced prediction_score_threshold arg with confidence_threshold

updated demo notebooks accordingly

sahi - v0.6.2

Published by fcakyon over 3 years ago

  • add input size parameter for inference (#169)

Example usages:


detection_model = Yolov5DetectionModel(
    model_path=yolov5_model_path,
    device="cpu", # or 'cuda'
)

result = detection_model.perform_inference(
    image,
    image_size=1280
)

result = get_prediction(
    "demo_data/small-vehicles1.jpeg",
    detection_model,
    image_size=1280
)

result = get_sliced_prediction(
    "demo_data/small-vehicles1.jpeg",
    detection_model,
    image_size=1280,
    slice_height = 256,
    slice_width = 256,
    overlap_height_ratio = 0.2,
    overlap_width_ratio = 0.2
)

sahi - v0.6.1

Published by fcakyon over 3 years ago

  • refactor slice_coco script (#165)
  • make default for ignore_negative_samples, False (#166)
sahi - v0.6.0

Published by fcakyon over 3 years ago

enhancement

  • add coco_evaluation script, refactor coco_error_analysis script (#162)
    coco_evaluation.py script usage:
python scripts/coco_evaluation.py dataset.json results.json

will calculate coco evaluation and export them to given output folder directory.

If you want to specify mAP metric type, set it as --metric bbox mask.

If you want to also calculate classwise scores add --classwise argument.

If you want to specify max detections, set it as --proposal_nums 10 100 500.

If you want to specify a psecific IOU threshold, set it as --iou_thrs 0.5. Default includes 0.50:0.95 and 0.5 scores.

If you want to specify export directory, set it as --out_dir output/folder/directory .

coco_error_analysis.py script usage:

python scripts/coco_error_analysis.py dataset.json results.json

will calculate coco error plots and export them to given output folder directory.

If you want to specify mAP result type, set it as --types bbox mask.

If you want to export extra mAP bar plots and annotation area stats add --extraplots argument.

If you want to specify area regions, set it as --areas 1024 9216 10000000000.

If you want to specify export directory, set it as --out_dir output/folder/directory .

bugfixes

  • prevent empty bbox coco json creation (#164)
  • dont create mot info while when type='det' (#163)

breaking changes

  • refactor predict (#161)
    By default, scripts apply both standard and sliced prediction (multi-stage inference). If you don't want to perform sliced prediction add --no_sliced_pred argument. If you don't want to perform standard prediction add --no_standard_pred argument.
sahi - v0.5.2

Published by fcakyon over 3 years ago

  • fix negative bbox coord error (#160)
Package Rankings
Top 25.44% on Conda-forge.org
Top 1.59% on Pypi.org
Related Projects