Code Monkey home page Code Monkey logo

label2everything's Introduction

常见计算机视觉标注格式相互转换

作者:同济子豪兄

Labelme标注注意事项

Labelme转COCO-关键点检测

labelme2coco-keypoint

Labelme转COCO-目标检测、实例分割

labelme2coco-detection

Labelme转YOLO-目标检测

labelme2yolo-detection

Labelme转YOLO-实例分割

labelme2yolo-segmentation

Labelme转YOLO-关键点检测

labelme2yolo-keypoint

Labelme转mask

Labelme转mask图-语义分割

Pascal VOC转YOLO-目标检测

pascalvoc2yolo-detection

Labelimg标注注意事项

label2everything's People

Contributors

tommyzihao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

label2everything's Issues

labelme中的linestrip的坐标怎么转换

非常感谢你的分享,在你的的代码中我可以看到对矩形框进行的json文件到yolo文件的转换,将举行的x1x2y1y2转换为相应的cx cy w h,那对于linestrip标注下的坐标应该怎么转换呢,期待您的回答。
json
label

Labelme转CoCo数据集的segmentation部分有bug

子豪兄您好,您的labelme转coco数据集代码“【D】Labelme转COCO-批量.ipynb”中有如下部分
`def process_single_json(labelme, image_id=1):

global ANN_ID

coco_annotations = []

for each_ann in labelme['shapes']: # 遍历该json文件中的所有标注

    if each_ann['shape_type'] == 'rectangle': # 筛选出框

        ## 该框的元数据
        bbox_dict = {}
        # 该框的类别 信息
        bbox_dict['category_id'] = label2id[each_ann['label']]
        bbox_dict['segmentation'] = []
        
        bbox_dict['iscrowd'] = 0
        bbox_dict['image_id'] = image_id
        bbox_dict['id'] = ANN_ID
        ANN_ID += 1

        # 获取框坐标
        bbox_left_top_x = min(int(each_ann['points'][0][0]), int(each_ann['points'][1][0]))
        bbox_left_top_y = min(int(each_ann['points'][0][1]), int(each_ann['points'][1][1]))
        bbox_right_bottom_x = max(int(each_ann['points'][0][0]), int(each_ann['points'][1][0]))
        bbox_right_bottom_y = max(int(each_ann['points'][0][1]), int(each_ann['points'][1][1]))
        bbox_w = bbox_right_bottom_x - bbox_left_top_x
        bbox_h = bbox_right_bottom_y - bbox_left_top_y
        bbox_dict['bbox'] = [bbox_left_top_x, bbox_left_top_y, bbox_w, bbox_h] # 左上角x、y、框的w、h
        bbox_dict['area'] = bbox_w * bbox_h
        
        # 筛选出分割多段线
        for each_ann in labelme['shapes']: # 遍历所有标注
            if each_ann['shape_type'] == 'polygon': # 筛选出分割多段线标注
                # 第一个点的坐标
                first_x = each_ann['points'][0][0]
                first_y = each_ann['points'][0][1]
                if (first_x>bbox_left_top_x) & (first_x<bbox_right_bottom_x) & (first_y<bbox_right_bottom_y) & (first_y>bbox_left_top_y): # 筛选出在该个体框中的关键点
                    bbox_dict['segmentation'] = list(map(lambda x: list(map(lambda y: round(y, 2), x)), each_ann['points'])) # 坐标保留两位小数
                
        coco_annotations.append(bbox_dict)
        
return coco_annotations`

其中获取框坐标的过程中把浮点数转换成了整数,导致在后面
if (first_x>bbox_left_top_x) & (first_x<bbox_right_bottom_x) & (first_y<bbox_right_bottom_y) & (first_y>bbox_left_top_y): # 筛选出在该个体框中的关键点
的语句中可能会判断第一个点不一定在该框中从而跳过该实例分割的标注内容。

具体来说比如边界框右下角点的坐标是[10.1,10.1],因为取整取成了[10,10],而第一个标注点是[10.1,1],本该在框内却判断到了框外去

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.