%load_ext autoreload
%autoreload 2
# $ cd <project root>
# $ make build
# $ pip install -e .
# reload current notebook kernel
! rm -rf /tmp/cococo/json_tree
! cocorepr \
--in_json_file ../examples/coco_chunk/json_file/instances_train2017_chunk3x2.json \
--out_path /tmp/cococo/json_tree \
--out_format json_tree \
--overwrite
! rm -rf /tmp/cococo/json_tree
! cocorepr \
--in_json_file ../examples/coco_chunk/json_file/instances_train2017_chunk3x2.json \
--out_path /tmp/cococo/json_tree \
--out_format json_tree \
--overwrite \
--max_crops_per_class=1
! rm -rf /tmp/cococo/json_file
! cocorepr \
--in_json_tree ../examples/coco_chunk/json_tree \
--out_path /tmp/cococo/json_file/annotations.json \
--out_format json_file \
--indent=None
! rm -rf /tmp/cococo/crop_tree
! cocorepr \
--in_json_file ../examples/coco_chunk/json_file/instances_train2017_chunk3x2.json \
--out_path /tmp/cococo/crop_tree \
--out_format crop_tree \
--overwrite
cats = !ls /tmp/cococo/crop_tree/crops
cat = cats[0]
cat
crops = !ls /tmp/cococo/crop_tree/crops/{cat}
deleted_crop = crops[0]
deleted_crop
! ls /tmp/cococo/crop_tree/crops/{cat}
! rm /tmp/cococo/crop_tree/crops/{cat}/{deleted_crop}
! ls /tmp/cococo/crop_tree/crops/{cat}
! rm -rf /tmp/json_tree_2
! cocorepr \
--in_json_file ../examples/coco_chunk/json_file/instances_train2017_chunk3x2.json \
--in_crop_tree /tmp/cococo/crop_tree \
--out_path /tmp/cococo/json_tree_2 \
--out_format json_tree
! [ ! -f {TMP2}/annotations/{deleted_crop} ] && echo "[+] File successfully not exists"
! rm -rf /tmp/cococo/crop_tree_2
! cocorepr \
--in_json_tree /tmp/cococo/json_tree_2 \
--in_crop_tree /tmp/cococo/crop_tree \
--out_path /tmp/cococo/crop_tree_2 \
--out_format crop_tree
! ls /tmp/cococo/crop_tree_2 | grep crops
! rm -rf /tmp/cococo/json_file_2
! cocorepr \
--in_json_tree /tmp/cococo/json_tree_2 \
--in_crop_tree /tmp/cococo/crop_tree \
--out_path /tmp/cococo/json_file_2/annotations.json \
--out_format json_file
! ls /tmp/cococo/json_file_2/annotations.json
! rm -rf /tmp/cococo/json_file_3/
! cocorepr \
--in_json_tree /tmp/cococo/json_tree_2 \
--in_json_file /tmp/cococo/json_file/annotations.json \
--out_path /tmp/cococo/json_file_3/annotations.json \
--out_format json_file \
--overwrite