Replies: 10 comments 6 replies
-
You can try to use train_pipeline = [
dict(
type='LoadImageFromFile',
file_client_args=file_client_args,
color_type='color_ignore_orientation'),
dict(
type='LoadOCRAnnotations',
with_polygon=True,
with_bbox=True,
with_label=True,
),
dict(type='FixInvalidPolygon', ),
... |
Beta Was this translation helpful? Give feedback.
-
use FixInvalidPolygon successfully
but the project still reports same error
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 12/12/2022 11:00 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
You can try to use FixInvalidPolygon in your train_pipeline to fix these invalid annotations:
train_pipeline= [
dict(
type='LoadImageFromFile',
file_client_args=file_client_args,
color_type='color_ignore_orientation'),
dict(
type='LoadOCRAnnotations',
with_polygon=True,
with_bbox=True,
with_label=True,
),
dict(type='FixInvalidPolygon', ),
...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Try upgrading to the latest |
Beta Was this translation helpful? Give feedback.
-
请问该如何直接升级,我在0.x中队模型代码只进行了开发,只能在1.x中重新开发吗
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/27/2023 14:14 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
Try upgrading to the latest 1.x or dev-1.x branch and try again. Also we have successfully trained DBNet and FCENet on totaltext and provided example configs:
https://github.com/open-mmlab/mmocr/blob/27b6a68586b9a040678fe083bcf60662ae1b9261/configs/textdet/dbnet/dbnet_resnet18_fpnc_1200e_totaltext.py
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
成功加入FindInvalidpolygon,但在训练提取数据集时报错如下,查询显示需要转换数据集为Tensor,但是没有成功
使用FindInvalidpolygon时需要使用mmengnie,更换mmcv版本,collate函数import错误,我尝试直接复制collate.py到我的项目中
pip安装parallel不能成功
请给我一些建议来解决这个问题,十分感谢。
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/27/2023 14:19 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
Just copy and paste the latest implementation of FixInvalidPolygon to 0.x shall work.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
您好,非常感谢您上次的回复。为了开发代码顺利,我按照文档指令重新安装了mmocr1.x,然后修改训练模型,在执行train.py文件时报错,TextDetLocalVisualizer无法使用
KeyError: 'TextDetLocalVisualizer is not in the visualizer registry. Please check whether the value of `TextDetLocalVisualizer` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'
查阅代码发现TextDetLocalVisualizer有正确注册
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/28/2023 11:30 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
I can't see the error messages here, but some steps were wrong.
MMEngine and MMCV 2.0 are only compatible with MMOCR 1.x, and MMOCR 0.x should always stick to MMCV 1.x. That is, when adapting FixInvalidPolygon to MMOCR 0.x, you basically need to rewrite a new transform in the style of MMOCR 0.x, which should use no more extra libraries except for shapely. You may also move some polygon utils from MMOCR 1.x that are used by this transform.
Besides, MMOCR 0.x represents polygons with BitmapMasks or PolygonMasks class as how MMDetection does, while 1.x just uses a list of np array to represent them. For the conversion between these two representations, you may find MMDet2MMOCR and MMOCR2MMDet helpful: https://github.com/open-mmlab/mmocr/blob/a1a3c97703734a81e56689eed777dfba0fd8ed68/mmocr/datasets/transforms/adapters.py
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
我重新执行依旧报错未注册的问题
执行原本代码的config文件同样报错,请问是哪里出了问题
您好,非常感谢您上次的回复。为了开发代码顺利,我按照文档指令重新安装了mmocr1.x,然后修改训练模型,在执行train.py文件时报错,TextDetLocalVisualizer无法使用
KeyError: 'TextDetLocalVisualizer is not in the visualizer registry. Please check whether the value of `TextDetLocalVisualizer` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'
查阅代码发现TextDetLocalVisualizer有正确注册
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/28/2023 11:30 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
I can't see the error messages here, but some steps were wrong.
MMEngine and MMCV 2.0 are only compatible with MMOCR 1.x, and MMOCR 0.x should always stick to MMCV 1.x. That is, when adapting FixInvalidPolygon to MMOCR 0.x, you basically need to rewrite a new transform in the style of MMOCR 0.x, which should use no more extra libraries except for shapely. You may also move some polygon utils from MMOCR 1.x that are used by this transform.
Besides, MMOCR 0.x represents polygons with BitmapMasks or PolygonMasks class as how MMDetection does, while 1.x just uses a list of np array to represent them. For the conversion between these two representations, you may find MMDet2MMOCR and MMOCR2MMDet helpful: https://github.com/open-mmlab/mmocr/blob/a1a3c97703734a81e56689eed777dfba0fd8ed68/mmocr/datasets/transforms/adapters.py
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
执行pip show mmocr
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/29/2023 15:54 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
One common cause is that MMOCR 1.x hasn't been correctly installed. Run pip show mmocr and see if the path is correct.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
***@***.***:~# pip show mmocrName: mmocr
Version: 1.0.Orc6
Summary: OpenMMLab Text Detection,OCR,and NLP ToolboxHome page: https://github.com/open-mmlab/mmocr
Author: None
Author-email: None
License: Apache License 2.0Location: /root/mmocrRequires: ingaug,lanms neo,Imdb, matplotlib, numpy,opencv-python,pyclipper,pycocotools,rapidfuzz,scikit-image
Required by:
对不起,我将网页信息复制了下来,请帮我看看mmocr1.x是否安装成功,感谢您的回复。
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/29/2023 17:29 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
Can't see the message on the webpage. #1614
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
那么它不应该显示模型没有注册,很疑惑哪里出了问题
…---- Replied Message ----
| From | Tong ***@***.***> |
| Date | 03/30/2023 11:47 |
| To | ***@***.***> |
| Cc | ***@***.***>***@***.***> |
| Subject | Re: [open-mmlab/mmocr] shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880> (Discussion #1614) |
Yes, it's installed correctly.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Traceback (most recent call last):
File "tools/train.py", line 230, in
main()
File "tools/train.py", line 219, in main
train_detector(
File "/root/miniconda3/lib/python3.8/site-packages/mmocr/apis/train.py", line 155, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/root/miniconda3/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 136, in run
epoch_runner(data_loaders[i], **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 49, in train
for i, data_batch in enumerate(self.data_loader):
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1179, in _next_data
return self._process_data(data)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
shapely.errors.TopologicalError: Caught TopologicalError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataset.py", line 219, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/root/miniconda3/lib/python3.8/site-packages/mmdet/datasets/custom.py", line 220, in getitem
data = self.prepare_train_img(idx)
File "/root/miniconda3/lib/python3.8/site-packages/mmdet/datasets/custom.py", line 243, in prepare_train_img
return self.pipeline(results)
File "/root/miniconda3/lib/python3.8/site-packages/mmdet/datasets/pipelines/compose.py", line 41, in call
data = t(data)
File "/root/miniconda3/lib/python3.8/site-packages/mmocr/datasets/pipelines/dbnet_transforms.py", line 83, in call
self.may_augment_annotation(aug, shape, target_shape, results)
File "/root/miniconda3/lib/python3.8/site-packages/mmocr/datasets/pipelines/dbnet_transforms.py", line 94, in may_augment_annotation
masks = self.may_augment_poly(aug, shape, results[key])
File "/root/miniconda3/lib/python3.8/site-packages/mmocr/datasets/pipelines/dbnet_transforms.py", line 133, in may_augment_poly
imgaug_polys = aug.augment_polygons(
File "/root/miniconda3/lib/python3.8/site-packages/imgaug/augmentables/polys.py", line 1806, in clip_out_of_image
return self.copy().clip_out_of_image()
File "/root/miniconda3/lib/python3.8/site-packages/imgaug/augmentables/polys.py", line 1777, in clip_out_of_image
self.polygons = [
File "/root/miniconda3/lib/python3.8/site-packages/imgaug/augmentables/polys.py", line 1780, in
for poly_clipped in poly.clip_out_of_image(self.shape)]
File "/root/miniconda3/lib/python3.8/site-packages/imgaug/augmentables/polys.py", line 591, in clip_out_of_image
multipoly_inter_shapely = poly_shapely.intersection(poly_image)
File "/root/miniconda3/lib/python3.8/site-packages/shapely/geometry/base.py", line 695, in intersection
return geom_factory(self.impl['intersection'](self, other))
File "/root/miniconda3/lib/python3.8/site-packages/shapely/topology.py", line 73, in call
self._check_topology(err, this, other)
File "/root/miniconda3/lib/python3.8/site-packages/shapely/topology.py", line 38, in _check_topology
raise TopologicalError(
shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7f8e91707880>
执行python tools/train.py configs/textdet/dbnetpp/dbnetpp_r50dcnv2_pafpn_1200e_totaltext.py --work-dir result/PANet
使用修改后的文本检测模型训练数据集TotalText,数据集图片和标注都是按照官方文档下载的,json文件根据mat标注文件执行totaltext_converter.py文件生成,在训练过程中会报错,应该是某些图片的标注问题,每次训练不同数量的图片后都有可能报错,无法继续训练下午,希望给出一定方向修改后,能顺利训练TotolText数据集。
Beta Was this translation helpful? Give feedback.
All reactions