Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.24 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.24 KB

数据标注

手机拍照图片旋转

当您收集的样本图像来源于手机拍照时,请注意由于手机拍照信息内附带水平垂直方向信息,这可能会使得在标注和训练时出现问题,因此在拍完照后注意根据方向对照片进行处理,使用如下函数即可解决

from PIL import Image, ExifTags
def rotate(im):
    try:
        for orientation in ExifTags.TAGS.keys():
            if ExifTags.TAGS[orientation] == 'Orientation':
                break
        exif = dict(im._getexif().items())
        if exif[orientation] == 3:
            im = im.rotate(180, expand=True)
        if exif[orientation] == 6:
            im = im.rotate(270, expand=True)
        if exif[orientation] == 8:
            im = im.rotate(90, expand=True)
    except:
        pass

img_file = '1.jpeg'
im = Image.open(img_file)
rotate(im)
im.save('new_1.jpeg')

图像分类数据标注

详见文档图像分类数据标注

目标检测数据标注

详见文档目标检测数据标注

实例分割数据标注

详见文档实例分割数据标注

语义分割数据标注

详见文档语义分割数据标注