Closed jfitzg7 closed 1 year ago
Thank you for sharing! It has helped me a lot
Sorry about these bugs. I have fixed them, please check out!
Thanks @YangHai-1218, I will try to look at this sometime this week, but the commit looks good to me! Thank you again!
Hello,
So to begin, I'm trying to get the YCB-V dataset setup with the annotations, and I started off by running
python tools/collect_image_list.py --source-dir data/ycbv/train_pbr --save-path data/ycbv/train_pbr/train_pbr.txt --pattern */rgb/*.jpg
to get the images list.Now I'm trying to run the tools/bop_to_coco.py script and I've ran into a few errors regarding the command line arguments. The first problem I ran into was this error:
I then changed the line
data_root, txt, seg_collect, thread_num = args.images_dir, args.images_list, args.segmentation, args.thread_num
to =>data_root, txt, seg_collect = args.images_dir, args.images_list, args.segmentation
which solved that first error (however I'm not sure if the thread_num is critical, it is not used in the script so I'm assuming it isn't). But then I ran into a new error:So I added the line
parser.add_argument('--amodal', action='store_true')
to theparse_args()
function in bop_to_coco.py:This fixed the issue with the script not being aware of the amodal command line argument. However, I did some further debugging and noticed that the annotations weren't being generated. I managed to track down the issue to being in the
make_coco_anno()
function and theconstruct_gt_info()
function. Theconstruct_gt_info()
function removes the leading "/" from the image paths with the lineimage_path = image_path[1:]
so that you get paths that look something like000000/rgb/000000.jpg
. It then updates theannos_info
dict with the lineannos_info[image_path] = dict(id=image_id, gts_info=per_img_info)
and finally returnsannos_info
which theif __name__ == '__main__':
section uses to update thecollect_info
dict with the linecollect_info.update(construct_gt_info(seq, anno_start_end_id, image_start_end_id))
. The main problem now stems in themake_coco_anno()
function which constructs a list of paths with the block of code:After this, the
paths
variable will contain a list that looks some thing like[ ..., '/000049/rgb/000558.jpg', '/000049/rgb/000574.jpg', '/000049/rgb/000575.jpg', ...]
. Basically the paths have the leading "/" which causes the checkif path in collect_annos:
to fail everytime. The solution I have is to add the linepath = path[1:]
to the beginning of the for loop inmake_coco_anno()
:So overall, here's the updated bop_to_coco.py file that I made changes to and I tested to make sure it works: