def main(): image_root = '/Users/xduyzy/Downloads/PANDA_IMAGE' person_anno_file = 'person_bbox_train.json' annomode = 'person' example = PANDA_IMAGE(image_root, person_anno_file, annomode='person', showwidth=1280) # example.showImgs(range=1) # print('starting save images with annos...') example.showAnns(range=5, shuffle=True, saveimg=True)
def main(args): image_root = args.data_dir anno_path = args.groudtruth_path anno_mode = args.anno_mode output_dir = args.output_dir output_anno_path = os.path.join(output_dir, 'split.json') os.makedirs(output_dir, exist_ok=True) example = PANDA_IMAGE(image_root, anno_path, annomode=anno_mode) splitter = ImgSplit(image_root, anno_path, anno_mode, output_dir, output_anno_path) splitter.splitdata(0.5) print('Done.')
def main(args): image_root = args.image_dir image_name = args.image_name anno_path = args.groudtruth_path anno_mode = args.anno_mode output_dir = args.output_dir output_anno_path = os.path.join(output_dir, 'split_coco.json') os.makedirs(output_dir, exist_ok=True) example = PANDA_IMAGE(image_root, anno_path, annomode=anno_mode) splitter = ImgSplit(image_root, anno_path, anno_mode, output_dir, output_anno_path) patch_annos = splitter.SplitSingle(image_name, 0.25) print('Done.')
# -------------------------------------------------------- # Tool kit function demonstration # Written by Wang Xueyang ([email protected]), Version 20200321 # Inspired from DOTA dataset devkit (https://github.com/CAPTAIN-WHU/DOTA_devkit) # -------------------------------------------------------- from PANDA import PANDA_IMAGE, PANDA_VIDEO import panda_utils as util from ImgSplit import ImgSplit from ResultMerge import DetResMerge if __name__ == '__main__': image_root = '/Users/xduyzy/Downloads/PANDA_IMAGE' person_anno_file = 'person_bbox_train.json' annomode = 'person' example = PANDA_IMAGE(image_root, person_anno_file, annomode='person') '''1. show images''' # example.showImgs() '''2. show annotations''' # example.showAnns(range=50, shuffle=True) ''' 3. Split Image And Label We provide the scale param before split the images and labels. ''' # outpath = 'split' # outannofile = 'split.json' # split = ImgSplit(image_root, person_anno_file, annomode, outpath, outannofile) # split.splitdata(0.5) ''' 4. Merge patches Now, we will merge these patches to see if they can be restored in the initial large images
# -------------------------------------------------------- # Tool kit function demonstration # Written by Wang Xueyang ([email protected]), Version 20200321 # Inspired from DOTA dataset devkit (https://github.com/CAPTAIN-WHU/DOTA_devkit) # -------------------------------------------------------- from PANDA import PANDA_IMAGE, PANDA_VIDEO import panda_utils as util from ImgSplit import ImgSplit from ResultMerge import DetResMerge if __name__ == '__main__': image_root = 'G:/PANDA/PANDA_IMAGE' person_anno_file = 'human_bbox_train.json' annomode = 'person' example = PANDA_IMAGE(image_root, person_anno_file, annomode='person') '''1. show images''' example.showImgs() '''2. show annotations''' example.showAnns(range=50, shuffle=True) ''' 3. Split Image And Label We provide the scale param before split the images and labels. ''' outpath = 'split' outannofile = 'split.json' split = ImgSplit(image_root, person_anno_file, annomode, outpath, outannofile) split.splitdata(0.5)
# split.splitdata(0.5) # person_anno_file =r"person_s0.5_t0.9_train_02_split.json" # basepath=r'/root/data/gvision/all-obj-split/center'#主目录 # person_anno_file =r"pv_split_obj.json" # vehicle_anno_file = 'pv_split_obj.json' # annomode='headbbox' # annomode='person' # example = PANDA_IMAGE(basepath, person_anno_file, annomode,addmode="image_train",savepath="my_annos_in_image_p" ) # 'person', 'vehicle', 'person&vehicle', 'headbbox' or 'headpoint' annomode = 'crowd' person_anno_file = r"person_bbox_train.json" basepath = r'/root/data/gvision/dataset/raw_data' #主目录 vehicle_anno_file = 'vehicle_bbox_train.json' example = PANDA_IMAGE(basepath, person_anno_file, annomode=annomode, addmode="image_train", savepath="annos_in_image_crowd", showcate=False) # # # '''1. show images'''vehicle # # # example.showImgs(range=2) # # '''2. show annotations'''"01_University_Canteen/IMG_01_02.jpg""10_Ceremony/IMG_10_21.jpg" example.showAnns(imgrequest=None, range=1, imgfilters=["10_Ceremony/IMG_10_21.jpg"], shuffle=True, saveimg=True)