Releases: obss/sahi
Releases · obss/sahi
v0.3.19
v0.3.18
- utilize ignore_negative_samples property (#90):
Filter out images that does not contain any annotation
from sahi.utils.coco import Coco
# set ignore_negative_samples as False if you want images without annotations present in json and yolov5 exports
coco = Coco.from_coco_dict_or_path("coco.json", ignore_negative_samples=True)
- fix typo in get_area_filtered_coco (#89)
v0.3.17
- improve .stats (#85):
from sahi.utils.coco import Coco
# init Coco object
coco = Coco.from_coco_dict_or_path("coco.json")
# get dataset stats
coco.stats
{
'num_images': 6471,
'num_annotations': 343204,
'num_categories': 2,
'num_negative_images': 0,
'num_images_per_category': {'human': 5684, 'vehicle': 6323},
'num_annotations_per_category': {'human': 106396, 'vehicle': 236808},
'min_num_annotations_in_image': 1,
'max_num_annotations_in_image': 902,
'avg_num_annotations_in_image': 53.037243084530985,
'min_annotation_area': 3,
'max_annotation_area': 328640,
'avg_annotation_area': 2448.405738278109,
'min_annotation_area_per_category': {'human': 3, 'vehicle': 3},
'max_annotation_area_per_category': {'human': 72670, 'vehicle': 328640},
}
- add category based annotation area filtering (#86):
# filter out images with seperate area intervals per category
intervals_per_category = {
"human": {"min": 20, "max": 10000},
"vehicle": {"min": 50, "max": 15000},
}
area_filtered_coco = coco.get_area_filtered_coco(intervals_per_category=intervals_per_category)
v0.3.15
- add get_area_filtered_coco method to Coco class (#75):
from sahi.utils.coco import Coco
from sahi.utils.file import save_json
# init Coco objects by specifying coco dataset paths and image folder directories
coco = Coco.from_coco_dict_or_path("coco.json")
# filter out images that contain annotations with smaller area than 50
area_filtered_coco = coco.get_area_filtered_coco(min=50)
# filter out images that contain annotations with smaller area than 50 and larger area than 10000
area_filtered_coco = coco.get_area_filtered_coco(min=50, max=10000)
# export filtered COCO dataset
save_json(area_filtered_coco.json, "area_filtered_coco.json")
- faster yolov5 conversion with mp argument (#80):
# multiprocess support
if __name__ == __main__:
coco = Coco.from_coco_dict_or_path(
"coco.json",
image_dir="coco_images/"
mp=True
)
coco.export_as_yolov5(
output_dir="output/folder/dir",
train_split_rate=0.85,
mp=True
)
v0.3.14
- add stats property for Coco class (#70)
from sahi.utils.coco import Coco
# init Coco object
coco = Coco.from_coco_dict_or_path("coco.json")
# get dataset stats
coco.stats
{
'avg_annotation_area': 2448.405738278109,
'avg_num_annotations_in_image': 53.037243084530985,
'max_annotation_area': 328640,
'max_num_annotations_in_image': 902,
'min_annotation_area': 3,
'min_num_annotations_in_image': 1,
'num_annotations': 343204,
'num_annotations_per_category': {
'human': 106396,
'vehicle': 236808
},
'num_categories': 2,
'num_images': 6471,
'num_images_per_category': {
'human': 5684,
'vehicle': 6323
}
}