Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据集中 “area” 数据问题 #2

Open
Qidian213 opened this issue Apr 13, 2018 · 12 comments
Open

数据集中 “area” 数据问题 #2

Qidian213 opened this issue Apr 13, 2018 · 12 comments

Comments

@Qidian213
Copy link

我在使用你的labelme2coco的代码进行数据转化,以训练官方版Mask-Rcnn,但是在你的代码中没有 annotation['area'] 数据的计算,而MASK-RCNN的训练中是需要这个数据的,请问有相关的计算代码可参考学习?

@ccnankai
Copy link

@Qidian213 我也遇到这个问题 ,请问你怎么解决的啊

@Qidian213
Copy link
Author

def annotation(self,points,label,num):
    annotation={}
    annotation['segmentation']=[list(np.asarray(points).flatten())]
    poly = Polygon(points)
    area_ = round(poly.area,6)
    annotation['area'] = area_
    annotation['iscrowd'] = 0
    annotation['image_id'] = num+1
    # annotation['bbox'] = str(self.getbbox(points)) # 使用list保存json文件时报错(不知道为什么)
    # list(map(int,a[1:-1].split(','))) a=annotation['bbox'] 使用该方式转成list
    annotation['bbox'] = list(map(float,self.getbbox(points)))

    annotation['category_id'] = self.getcatid(label)
    annotation['id'] = self.annID
    return annotation

@Qidian213
Copy link
Author

Qidian213 commented Apr 25, 2018

@ccnankai 验证是可用的

@lilichu
Copy link

lilichu commented Jun 2, 2018

@Qidian213 你好,请问def annotation(self,points,label,num)中的points是指什么。运行有错的

@Qidian213
Copy link
Author

就是标注文件里的,运行没问题,训练效果很好

@lilichu
Copy link

lilichu commented Jun 3, 2018

@Qidian213 我用的是faser rcnn,只有标注框,没有points这个数据。我把求area的计算变成w*h就可以了。
ps:我用的是voc2coco.py这个文件

@wucng
Copy link
Owner

wucng commented Aug 6, 2018

嗯,感谢大家的热情,已经添加了 area字段,希望能帮助大家更好的学习!谢谢!

@marz233
Copy link

marz233 commented Aug 26, 2019

def annotation(self,points,label,num):
    annotation={}
    annotation['segmentation']=[list(np.asarray(points).flatten())]
    poly = Polygon(points)
    area_ = round(poly.area,6)
    annotation['area'] = area_
    annotation['iscrowd'] = 0
    annotation['image_id'] = num+1
    # annotation['bbox'] = str(self.getbbox(points)) # 使用list保存json文件时报错(不知道为什么)
    # list(map(int,a[1:-1].split(','))) a=annotation['bbox'] 使用该方式转成list
    annotation['bbox'] = list(map(float,self.getbbox(points)))

    annotation['category_id'] = self.getcatid(label)
    annotation['id'] = self.annID
    return annotation

请问在poly = Polygon(points)
area_ = round(poly.area,6)这里面Polygon函数是在哪里实现的

@marz233
Copy link

marz233 commented Sep 2, 2019

https://nbviewer.jupyter.org/github/aleju/imgaug-doc/blob/master/notebooks/B03%20-%20Augment%20Polygons.ipynb
我发现在https://github.com/aleju/imgaug
的这个imgaug中有相关的Polygon函数的实现。这是一个数据增强的包。

@Linamiao-1998
Copy link

我的在添加area之前转换的很成功,但是加上
poly = imgaug.Polygon(points)
area_ = round(poly.area,6)
annotation['area'] = area_
会出现
File "C:\ProgramData\Anaconda3\lib\site-packages\shapely\geos.py", line 145, in
lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
File "C:\ProgramData\Anaconda3\lib\ctypes_init
.py", line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。
这个错误,请问这种情况如何解决

@Yarong-zhang
Copy link

def annotation(self,points,label,num):
    annotation={}
    annotation['segmentation']=[list(np.asarray(points).flatten())]
    poly = Polygon(points)
    area_ = round(poly.area,6)
    annotation['area'] = area_
    annotation['iscrowd'] = 0
    annotation['image_id'] = num+1
    # annotation['bbox'] = str(self.getbbox(points)) # 使用list保存json文件时报错(不知道为什么)
    # list(map(int,a[1:-1].split(','))) a=annotation['bbox'] 使用该方式转成list
    annotation['bbox'] = list(map(float,self.getbbox(points)))

    annotation['category_id'] = self.getcatid(label)
    annotation['id'] = self.annID
    return annotation

请问Polygon(points)的points 是标注文件里面的一个点还是多个点呀,是list里面包含tuple吗
谢谢解答!

@Linamiao-1998
Copy link

Linamiao-1998 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants