processer=[]for i in range(len(out_size_ratio)):kwargs=dict(image_dir="dataset/pqdetection_voc/images/",dataset_json_path="dataset/pqdetection_coco/pddetection.json",output_dir=out_size_ratio[i][0],slice_size=out_size_ratio[i][1],overlap_ratio=out_size_ratio[i][2],ignore_negative_samples=True,min_area_ratio=0.1 )p = Process(target=slice_my,kwargs=kwargs)processer.append(p)p.start()for p in processer: #等待所有进程都结速p.join()
以上输出会比较乱,在中执行会有问题 , 要放到脚本中执行.最后生成的文件结构是:
pqdetection_sliced├── pq_160_75│├── pddetection_160_075.json│└── pddetection_images_160_075├── pq_192_75│├── pddetection_192_075.json│└── pddetection_images_192_075├── pq_224_75│├── pddetection_224_075.json│└── pddetection_images_224_075├── pq_256_75│├── pddetection_256_075.json│└── pddetection_images_256_075├── pq_288_75│├── pddetection_288_075.json│└── pddetection_images_288_075├── pq_320_75│├── pddetection_320_075.json│└── pddetection_images_320_075├── pq_352_75│├── pddetection_352_075.json│└── pddetection_images_352_075├── pq_384_75│├── pddetection_384_075.json│└── pddetection_images_384_075├── pq_416_75│├── pddetection_416_075.json│└── pddetection_images_416_075├── pq_448_75│├── pddetection_448_075.json│└── pddetection_images_448_075├── pq_480_75│├── pddetection_480_075.json│└── pddetection_images_480_075└── pq_512_75├── pddetection_512_075.json└── pddetection_images_512_07525 directories, 12 files
2.3 对各个数据集的状态进行查看
import osimport globfrom pprint import pprintfrom sahi.utils.coco import Cocofor i in out_size_ratio:jsonpath = glob.glob(os.path.join(i[0],'*.json'))[0]coco=Coco.from_coco_dict_or_path(jsonpath)pprint(f"{os.path.basename(i[0])}:")pprint(coco.stats)
indexing coco dataset annotations...Loading coco annotations: 100%|██████████| 60068/60068 [00:05<00:00, 10029.56it/s]'pq_160_75:'{'avg_annotation_area': 2752.9663472653942,'avg_num_annotations_in_image': 1.296097755876673,'max_annotation_area': 25600,'max_annotation_area_per_category': {'ball': 25600},'max_num_annotations_in_image': 9,'min_annotation_area': 6,'min_annotation_area_per_category': {'ball': 6},'min_num_annotations_in_image': 1,'num_annotations': 77854,'num_annotations_per_category': {'ball': 77854},'num_categories': 1,'num_images': 60068,'num_images_per_category': {'ball': 60068},'num_negative_images': 0}indexing coco dataset annotations...Loading coco annotations: 100%|██████████| 52959/52959 [00:05<00:00, 9287.43it/s] 'pq_192_75:'{'avg_annotation_area': 3227.159324899192,'avg_num_annotations_in_image': 1.3626956702354651,'max_annotation_area': 36864,'max_annotation_area_per_category': {'ball': 36864},'max_num_annotations_in_image': 10,'min_annotation_area': 7,'min_annotation_area_per_category': {'ball': 7},'min_num_annotations_in_image': 1,'num_annotations': 72167,'num_annotations_per_category': {'ball': 72167},'num_categories': 1,'num_images': 52959,'num_images_per_category': {'ball': 52959},'num_negative_images': 0}indexing coco dataset annotations...Loading coco annotations: 100%|██████████| 47829/47829 [00:05<00:00, 8223.08it/s] 'pq_224_75:'{'avg_annotation_area': 3784.9258265381764,'avg_num_annotations_in_image': 1.41023228585168,'max_annotation_area': 50176,'max_annotation_area_per_category': {'ball': 50176},'max_num_annotations_in_image': 10,'min_annotation_area': 6,'min_annotation_area_per_category': {'ball': 6},'min_num_annotations_in_image': 1,'num_annotations': 67450,'num_annotations_per_category': {'ball': 67450},'num_categories': 1,'num_images': 47829,'num_images_per_category': {'ball': 47829},'num_negative_images': 0}indexing coco dataset annotations...Loading coco annotations: 100%|██████████| 44695/44695 [00:05
- 假期第一天哪座城市最堵 提前1天出发竟堵了19个小时
- 零基础小白想学习并且从事次世代游戏建模都会遇到的6个问题,看看你有没有
- 三 Linux 网络驱动-MAC、PHY层驱动框架
- Python with 工作原理、装饰器、回收机制、内存管理机制、拷贝、作用域等
- 测试思维和基础测试方法
- python在线环境
- 小程序 动态绑定class
- 脚背疼痛是什么原因 脚背疼痛是什么原因
- 蜡笔小新游戏可以变蟑螂的是第几部?
- 小区有人养鸡扰民,报警警察该管吗?