libfacedetection.train
libfacedetection.train copied to clipboard
How to generate json files for NVIDIA dali?
Hi, I manually label custom datasets following the COCO format. May I ask if is it possible for you to publish the code to convert to NVIDIA Dali (which is used in this repo)? Thanks
You can execute the following tool function: https://raw.githubusercontent.com/ShiqiYu/libfacedetection.train/master/tools/gt2coco.py to generate your own COCO-format annotation file.
Thanks, I'll try later. Closed for now~
@Wwupup Hi, I take a look at the gt2coco.py but the segmentation is empty. Where do I get these segmentation and how do I append it to the trainset.json? I see that you mentioned the RetinaFace, but the link is invalid now
Hello, I'm sorry to answer the question now. The gt2coco.py
I mentioned earlier is a script that converts groundthruth to COCO format, where the segmentation tag is empty. When converting training sets, this tag is used to represent five facial key points, that is, 10 float values. It is shown as follows:
segmentation:[[x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, x_5, y_5]]
Sorry, but as I look at the file on this line https://github.com/ShiqiYu/libfacedetection.train/blob/master/tools/gt2coco.py#L27
I see that the "segmentation" = []
hardcoded for empty
It seems that you want to get annotations about the facial key points of the WIDER-FACE dataset. That can be obtained by reading trainset.json
directly.
It seems that you want to get annotations about the facial key points
Yes, but I have my custom dataset and I want to convert it to the format that libfacedetection can read.
In function https://github.com/ShiqiYu/libfacedetection.train/blob/a3bc97c7e85bb206c9feca97fbd541ce82cfa3a9/tools/gt2coco.py#L26
you can add the annotation include bbox
, keypoints
of your custom dataset to this data struct:
annos.append({
"segmentation": [], #your keypoints, for example: [[x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, ...]]
"area": area,
"iscrowd": 0,
"image_id": img_id,
"bbox": [x1, y1, w, h], #your bbox
"category_id": 1,
"id": anno_id,
"ignore": 0})