1. 找出损坏的图片,形成junk.txt
test_1346.jpg
test_184.jpg
test_2643.jpg
test_274.jpg
test_2878.jpg
train_2376.jpg
train_2986.jpg
train_305.jpg
train_3240.jpg
train_38.jpg
train_5007.jpg
train_5137.jpg
train_5822.jpg
train_737.jpg
train_775.jpg
train_789.jpg
train_8020.jpg
train_8146.jpg
train_924.jpg
val_296.jpg
val_386.jpg
test_132.jpg
test_1929.jpg
test_2028.jpg
test_22.jpg
test_232.jpg
test_2321.jpg
test_2613.jpg
test_521.jpg
test_853.jpg
test_910.jpg
test_923.jpg
train_1239.jpg
train_2903.jpg
train_340.jpg
train_3556.jpg
train_3560.jpg
train_3832.jpg
train_4222.jpg
train_5143.jpg
train_5762.jpg
train_6409.jpg
train_7576.jpg
train_7622.jpg
train_903.jpg
val_147.jpg
val_286.jpg
train_6052.jpg
train_6090.jpg
train_6138.jpg
train_6722.jpg
train_6788.jpg
train_7883.jpg
train_882.jpg
2. 将SKU110K转成COCO数据集格式
import argparse
import json
import os
import pandas as pd
from tqdm import tqdm
START_BOUNDING_BOX_ID = 1
# val_0.jpg, 5, 1429, 219, 1612,object,2336,4160
# val_1.jpg, 1194, 294, 1292, 681,object,2448,3264
COLUMNS = ["filename", "x1", "y1", "x2", "y2", "cls", "w", "h"]
def parse_args():
parser = argparse.ArgumentParser(
description='Convert SKU110k dataset to COCO-style')
parser.add_argument(
'--junk_file',
default="./junk.txt",
help='Path to the junk.txt file')
parser.add_argument(
'--in-train-path',
default="/home/wangsong/data/sku/annotations/annotations_train.csv",
help='Path to the train csv file')
parser.add_argument(
'--in-val-path',
default="/home/wangsong/data/sku/annotations/annotations_val.csv",
help='Path to the val csv file')
parser.add_argument(
'--in-test-path',
default="/home/wangsong/data/sku/annotations/annotations_test.csv",
help='Path to the test csv file')
parser.add