faster-rcnn.pytorch icon indicating copy to clipboard operation
faster-rcnn.pytorch copied to clipboard

ImportError: cannot import name '_mask'

Open rongxuanhong opened this issue 5 years ago • 26 comments

I use pytorch-1.0 and python3.6.7,and build under conda.the process of building did't show error.but,when start to train trainval.net,it shows the following error:

File "trainval_net.py", line 27, in from roi_data_layer.roidb import combined_roidb File "/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py", line 9, in from datasets.factory import get_imdb File "/home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py", line 15, in from datasets.coco import coco File "/home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/coco.py", line 23, in from pycocotools.coco import COCO File "/home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py", line 60, in from . import mask File "/home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py", line 3, in from . import _mask ImportError: cannot import name '_mask'

it seems the building problem of coco API

rongxuanhong avatar Dec 28 '18 07:12 rongxuanhong

make sure the branch is pytorch-1.0 and cd lib && python setup.py build develop then retry?

geekli avatar Dec 28 '18 10:12 geekli

make sure the branch is pytorch-1.0 and cd lib && python setup.py build develop then retry? make sure. I clone it with --b

rongxuanhong avatar Dec 28 '18 11:12 rongxuanhong

make sure the branch is pytorch-1.0 and cd lib && python setup.py build develop then retry?

Having the same problem as well. I am using the pytorch-1.0 branch and has run "python setup.py build develop".

KwanWaiChung avatar Dec 30 '18 16:12 KwanWaiChung

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

KwanWaiChung avatar Jan 01 '19 04:01 KwanWaiChung

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

thx a lot

Bijiazhou avatar Jan 09 '19 13:01 Bijiazhou

I am using pytorch 1.0 and python 3.6.7

Traceback (most recent call last): File "demo.py", line 27, in from roi_data_layer.roidb import combined_roidb File "D:\OCR\Code\PyTorch\faster-rcnn.pytorch-pytorch-1.0\lib\roi_data_layer\roidb.py", line 9, in from datasets.factory import get_imdb File "D:\OCR\Code\PyTorch\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\factory.py", line 15, in from datasets.coco import coco File "D:\OCR\Code\PyTorch\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\coco.py", line 23, in from pycocotools.coco import COCO File "D:\OCR\Code\PyTorch\faster-rcnn.pytorch-pytorch-1.0\data\coco\PythonAPI\pycocotools\coco.py", line 55, in from . import mask as maskUtils File "D:\OCR\Code\PyTorch\faster-rcnn.pytorch-pytorch-1.0\data\coco\PythonAPI\pycocotools\mask.py", line 3, in import pycocotools._mask as _mask File "init.pxd", line 872, in init pycocotools._mask ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216

shahmustafa avatar Feb 18 '19 11:02 shahmustafa

Just a side note. If which python does not refer to the python version that you use, you might want to modify the MakeFile. In my case, I need to change python to python3.6 in the MakeFile.

zc-alexfan avatar Feb 23 '19 19:02 zc-alexfan

I tried and failed to get things working...

CoCO API is now at https://github.com/cocodataset/cocoapi

I am seeing the following error even after @JojoFisherman 's suggestions

(pytorch1_py36) myPC:/git/jwyang/faster-rcnn.pytorch$ CUDA_VISIBLE_DEVICES=$GPU_ID python trainval_net.py --dataset pascal_voc --net res101 --bs 1 --nw 1 --lr $LEARNING_RATE --lr_decay_step $DECAY_STEP --cuda
Traceback (most recent call last):
  File "trainval_net.py", line 27, in <module>
    from roi_data_layer.roidb import combined_roidb
  File "/git/jwyang/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py", line 9, in <module>
    from datasets.factory import get_imdb
  File "/git/jwyang/faster-rcnn.pytorch/lib/datasets/factory.py", line 15, in <module>
    from datasets.coco import coco
  File "/git/jwyang/faster-rcnn.pytorch/lib/datasets/coco.py", line 23, in <module>
    from pycocotools.coco import COCO
  File "/git/jwyang/faster-rcnn.pytorch/lib/pycocotools/coco.py", line 60, in <module>
    from . import mask
  File "/git/jwyang/faster-rcnn.pytorch/lib/pycocotools/mask.py", line 3, in <module>
    from . import _mask
ImportError: cannot import name '_mask'

I am using Anaconda with Python 3.6

(pytorch1_py36) myPC:/git/jwyang/faster-rcnn.pytorch$ python --version
Python 3.6.8 :: Anaconda, Inc.

EMCP avatar Mar 05 '19 20:03 EMCP

progress, I fixed the stale COCO pytools

see: https://github.com/cocodataset/cocoapi/issues/59#issuecomment-469859646

EMCP avatar Mar 05 '19 21:03 EMCP

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

Please @jwyang add into the readme for easy install.

marcunzueta avatar Aug 02 '19 22:08 marcunzueta

我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:

文件“trainval_net.py”,第27行,在 从roi_data_layer.roidb进口combined_roidb 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在 从datasets.factory进口get_imdb 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行, 来自datasets.coco import coco 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23, 从中导入COCO 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60 。 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行 。 ImportError:无法导入名称“ _mask”

似乎可可API的构建问题

请问您是怎么解决这个问题的

WUT-xiaoming avatar Nov 15 '19 03:11 WUT-xiaoming

你好,我那时是COCO的安装包没安装好。

------------------ 原始邮件 ------------------ 发件人: "WUT-xiaoming"<[email protected]>; 发送时间: 2019年11月15日(星期五) 中午11:31 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "洪荣宣"<[email protected]>;"Author"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:

文件“trainval_net.py”,第27行,在 从roi_data_layer.roidb进口combined_roidb 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在 从datasets.factory进口get_imdb 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行, 来自datasets.coco import coco 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23, 从中导入COCO 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60 。 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行 。 ImportError:无法导入名称“ _mask”

似乎可可API的构建问题

请问您是怎么解决这个问题的

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

rongxuanhong avatar Nov 15 '19 03:11 rongxuanhong

请问这个COCO要怎么安装呢? 作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系

------------------ 原始邮件 ------------------ 发件人: "rongxuanHong"<[email protected]>; 发送时间: 2019年11月15日(星期五) 中午11:33 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "1254305549"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

你好,我那时是COCO的安装包没安装好。

------------------&nbsp;原始邮件&nbsp;------------------ 发件人:&nbsp;"WUT-xiaoming"<[email protected]&gt;; 发送时间:&nbsp;2019年11月15日(星期五) 中午11:31 收件人:&nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&gt;; 抄送:&nbsp;"洪荣宣"<[email protected]&gt;;"Author"<[email protected]&gt;; 主题:&nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:

文件“trainval_net.py”,第27行,在 从roi_data_layer.roidb进口combined_roidb 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在 从datasets.factory进口get_imdb 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行, 来自datasets.coco import coco 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23, 从中导入COCO 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60 。 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行 。 ImportError:无法导入名称“ _mask”

似乎可可API的构建问题

请问您是怎么解决这个问题的

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

WUT-xiaoming avatar Nov 15 '19 03:11 WUT-xiaoming

https://github.com/cocodataset/cocoapi

------------------ 原始邮件 ------------------ 发件人: "WUT-xiaoming"<[email protected]>; 发送时间: 2019年11月15日(星期五) 中午11:36 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "洪荣宣"<[email protected]>;"Author"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

请问这个COCO要怎么安装呢? 作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系

------------------&nbsp;原始邮件&nbsp;------------------ 发件人: "rongxuanHong"<[email protected]&gt;;
发送时间: 2019年11月15日(星期五) 中午11:33 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&gt;;
抄送: "1254305549"<[email protected]&gt;; "Comment"<[email protected]&gt;;
主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &#39;_mask&#39; (#410)

你好,我那时是COCO的安装包没安装好。

------------------&amp;nbsp;原始邮件&amp;nbsp;------------------
发件人:&amp;nbsp;"WUT-xiaoming"<[email protected]&amp;gt;;
发送时间:&amp;nbsp;2019年11月15日(星期五) 中午11:31
收件人:&amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;gt;;
抄送:&amp;nbsp;"洪荣宣"<[email protected]&amp;gt;;"Author"<[email protected]&amp;gt;;
主题:&amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:

文件“trainval_net.py”,第27行,在
从roi_data_layer.roidb进口combined_roidb
文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在
从datasets.factory进口get_imdb
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行,
来自datasets.coco import coco
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23,
从中导入COCO
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60

从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行

ImportError:无法导入名称“ _mask”

似乎可可API的构建问题

请问您是怎么解决这个问题的


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

rongxuanhong avatar Nov 15 '19 06:11 rongxuanhong

非常感谢您的回答!!这个COCO的安装目录有要求吗?

------------------ 原始邮件 ------------------ 发件人: "rongxuanHong"<[email protected]>; 发送时间: 2019年11月15日(星期五) 下午2:46 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "1254305549"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

https://github.com/cocodataset/cocoapi

------------------&nbsp;原始邮件&nbsp;------------------ 发件人:&nbsp;"WUT-xiaoming"<[email protected]&gt;; 发送时间:&nbsp;2019年11月15日(星期五) 中午11:36 收件人:&nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&gt;; 抄送:&nbsp;"洪荣宣"<[email protected]&gt;;"Author"<[email protected]&gt;; 主题:&nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

请问这个COCO要怎么安装呢?
作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系

------------------&amp;nbsp;原始邮件&amp;nbsp;------------------
发件人: "rongxuanHong"<[email protected]&amp;gt;;
发送时间: 2019年11月15日(星期五) 中午11:33
收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&amp;gt;;
抄送: "1254305549"<[email protected]&amp;gt;; "Comment"<[email protected]&amp;gt;;
主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &amp;#39;_mask&amp;#39; (#410)

你好,我那时是COCO的安装包没安装好。

------------------&amp;amp;nbsp;原始邮件&amp;amp;nbsp;------------------
发件人:&amp;amp;nbsp;"WUT-xiaoming"<[email protected]&amp;amp;gt;;
发送时间:&amp;amp;nbsp;2019年11月15日(星期五) 中午11:31
收件人:&amp;amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;amp;gt;;
抄送:&amp;amp;nbsp;"洪荣宣"<[email protected]&amp;amp;gt;;"Author"<[email protected]&amp;amp;gt;;
主题:&amp;amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:

文件“trainval_net.py”,第27行,在
从roi_data_layer.roidb进口combined_roidb
文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在
从datasets.factory进口get_imdb
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行,
来自datasets.coco import coco
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23,
从中导入COCO
文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60

从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行

ImportError:无法导入名称“ _mask”

似乎可可API的构建问题

请问您是怎么解决这个问题的


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

WUT-xiaoming avatar Nov 15 '19 06:11 WUT-xiaoming

请google搜索,都有详细的解答。

------------------ 原始邮件 ------------------ 发件人: "WUT-xiaoming"<[email protected]>; 发送时间: 2019年11月15日(星期五) 下午2:56 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "洪荣宣"<[email protected]>;"Author"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

非常感谢您的回答!!这个COCO的安装目录有要求吗?

------------------&nbsp;原始邮件&nbsp;------------------ 发件人: "rongxuanHong"<[email protected]&gt;;
发送时间: 2019年11月15日(星期五) 下午2:46 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&gt;;
抄送: "1254305549"<[email protected]&gt;; "Comment"<[email protected]&gt;;
主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &#39;_mask&#39; (#410)

https://github.com/cocodataset/cocoapi

------------------&amp;nbsp;原始邮件&amp;nbsp;------------------
发件人:&amp;nbsp;"WUT-xiaoming"<[email protected]&amp;gt;;
发送时间:&amp;nbsp;2019年11月15日(星期五) 中午11:36
收件人:&amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;gt;;
抄送:&amp;nbsp;"洪荣宣"<[email protected]&amp;gt;;"Author"<[email protected]&amp;gt;;
主题:&amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)

请问这个COCO要怎么安装呢?
作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系

------------------&amp;amp;nbsp;原始邮件&amp;amp;nbsp;------------------
发件人: "rongxuanHong"<[email protected]&amp;amp;gt;;
发送时间: 2019年11月15日(星期五) 中午11:33
收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&amp;amp;gt;;
抄送: "1254305549"<[email protected]&amp;amp;gt;; "Comment"<[email protected]&amp;amp;gt;;
主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &amp;amp;#39;_mask&amp;amp;#39; (#410)

你好,我那时是COCO的安装包没安装好。

------------------&amp;amp;amp;amp;nbsp;原始邮件&amp;amp;amp;amp;nbsp;------------------    
发件人:&amp;amp;amp;amp;nbsp;"WUT-xiaoming"<[email protected]&amp;amp;amp;amp;gt;;    
发送时间:&amp;amp;amp;amp;nbsp;2019年11月15日(星期五) 中午11:31    
收件人:&amp;amp;amp;amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;amp;amp;amp;gt;;    
抄送:&amp;amp;amp;amp;nbsp;"洪荣宣"<[email protected]&amp;amp;amp;amp;gt;;"Author"<[email protected]&amp;amp;amp;amp;gt;;    
主题:&amp;amp;amp;amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410)    
   
   
   
     
我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误:    
     
文件“trainval_net.py”,第27行,在    
 从roi_data_layer.roidb进口combined_roidb    
 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在    
 从datasets.factory进口get_imdb    
 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行,    
 来自datasets.coco import coco    
 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23,    
 从中导入COCO    
 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60    
 。    
 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行    
 。    
 ImportError:无法导入名称“ _mask”    
     
似乎可可API的构建问题    
      
请问您是怎么解决这个问题的    
     
—    
You are receiving this because you authored the thread.    
Reply to this email directly, view it on GitHub, or unsubscribe.    


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

rongxuanhong avatar Nov 15 '19 07:11 rongxuanhong

非常感谢您的回答!!这个COCO的安装目录有要求吗? ------------------ 原始邮件 ------------------ 发件人: "rongxuanHong"<[email protected]>; 发送时间: 2019年11月15日(星期五) 下午2:46 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "1254305549"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) https://github.com/cocodataset/cocoapi ------------------&nbsp;原始邮件&nbsp;------------------ 发件人:&nbsp;"WUT-xiaoming"<[email protected]&gt;; 发送时间:&nbsp;2019年11月15日(星期五) 中午11:36 收件人:&nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&gt;; 抄送:&nbsp;"洪荣宣"<[email protected]&gt;;"Author"<[email protected]&gt;; 主题:&nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) 请问这个COCO要怎么安装呢? 作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系 ------------------&amp;nbsp;原始邮件&amp;nbsp;------------------ 发件人: "rongxuanHong"<[email protected]&amp;gt;; 发送时间: 2019年11月15日(星期五) 中午11:33 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&amp;gt;; 抄送: "1254305549"<[email protected]&amp;gt;; "Comment"<[email protected]&amp;gt;; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &amp;#39;_mask&amp;#39; (#410) 你好,我那时是COCO的安装包没安装好。 ------------------&amp;amp;nbsp;原始邮件&amp;amp;nbsp;------------------ 发件人:&amp;amp;nbsp;"WUT-xiaoming"<[email protected]&amp;amp;gt;; 发送时间:&amp;amp;nbsp;2019年11月15日(星期五) 中午11:31 收件人:&amp;amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;amp;gt;; 抄送:&amp;amp;nbsp;"洪荣宣"<[email protected]&amp;amp;gt;;"Author"<[email protected]&amp;amp;gt;; 主题:&amp;amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) 我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误: 文件“trainval_net.py”,第27行,在 从roi_data_layer.roidb进口combined_roidb 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在 从datasets.factory进口get_imdb 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行, 来自datasets.coco import coco 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23, 从中导入COCO 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60 。 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行 。 ImportError:无法导入名称“ _mask” 似乎可可API的构建问题 请问您是怎么解决这个问题的 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. https://blog.csdn.net/weixin_42279610/article/details/103086379

非常感谢您的回答!!这个COCO的安装目录有要求吗? ------------------ 原始邮件 ------------------ 发件人: "rongxuanHong"<[email protected]>; 发送时间: 2019年11月15日(星期五) 下午2:46 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]>; 抄送: "1254305549"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) https://github.com/cocodataset/cocoapi ------------------&nbsp;原始邮件&nbsp;------------------ 发件人:&nbsp;"WUT-xiaoming"<[email protected]&gt;; 发送时间:&nbsp;2019年11月15日(星期五) 中午11:36 收件人:&nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&gt;; 抄送:&nbsp;"洪荣宣"<[email protected]&gt;;"Author"<[email protected]&gt;; 主题:&nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) 请问这个COCO要怎么安装呢? 作者在README中写用python2.7编译ROI等模块,是不是跟这个有关系 ------------------&amp;nbsp;原始邮件&amp;nbsp;------------------ 发件人: "rongxuanHong"<[email protected]&amp;gt;; 发送时间: 2019年11月15日(星期五) 中午11:33 收件人: "jwyang/faster-rcnn.pytorch"<[email protected]&amp;gt;; 抄送: "1254305549"<[email protected]&amp;gt;; "Comment"<[email protected]&amp;gt;; 主题: Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name &amp;#39;_mask&amp;#39; (#410) 你好,我那时是COCO的安装包没安装好。 ------------------&amp;amp;nbsp;原始邮件&amp;amp;nbsp;------------------ 发件人:&amp;amp;nbsp;"WUT-xiaoming"<[email protected]&amp;amp;gt;; 发送时间:&amp;amp;nbsp;2019年11月15日(星期五) 中午11:31 收件人:&amp;amp;nbsp;"jwyang/faster-rcnn.pytorch"<[email protected]&amp;amp;gt;; 抄送:&amp;amp;nbsp;"洪荣宣"<[email protected]&amp;amp;gt;;"Author"<[email protected]&amp;amp;gt;; 主题:&amp;amp;nbsp;Re: [jwyang/faster-rcnn.pytorch] ImportError: cannot import name '_mask' (#410) 我使用pytorch-1.0和python3.6.7,并在conda下进行构建。构建过程未显示错误。但是,当开始训练trainval.net时,它显示以下错误: 文件“trainval_net.py”,第27行,在 从roi_data_layer.roidb进口combined_roidb 文件“/home/ccyoung/workspace/faster-rcnn.pytorch/lib/roi_data_layer/roidb.py”,9号线,在 从datasets.factory进口get_imdb 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/datasets/factory.py”,第15行, 来自datasets.coco import coco 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/ pycocotools.coco中的“ lib / datasets / coco.py”行23, 从中导入COCO 文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/coco.py”,行60 。 从中导入遮罩文件“ /home/ccyoung/workspace/faster-rcnn.pytorch/lib/pycocotools/mask.py”,第3行 。 ImportError:无法导入名称“ _mask” 似乎可可API的构建问题 请问您是怎么解决这个问题的 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. 没有要求,在随意一个空的目录下,下载最新的并编译就好。你可以参考下我的,我刚解决这个问题,运行成功fasterrcnn https://blog.csdn.net/weixin_42279610/article/details/103086379

caohe115 avatar Nov 15 '19 07:11 caohe115

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

I am using Windows 10, how do i solve the problem ( from . import _mask ImportError: cannot import name '_mask' from 'pycocotools' ())

Please help.

n0obcoder avatar Jan 06 '20 19:01 n0obcoder

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

I am using Windows 10, how do i solve the problem ( from . import _mask ImportError: cannot import name '_mask' from 'pycocotools' ())

Please help.

n0obcoder avatar Jan 06 '20 19:01 n0obcoder

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

it works. thank you!!!

Flashkong avatar Feb 18 '20 06:02 Flashkong

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

I am sorry,i cannot understand "make" and"cd../../",Can you explain it in more detail?

wwl33 avatar Mar 25 '20 19:03 wwl33

I tried pip install pycocotools. And it worked

JiafengLiao avatar Apr 15 '20 16:04 JiafengLiao

make sure the branch is pytorch-1.0 and cd lib && python setup.py build develop then retry?

Having the same problem as well. I am using the pytorch-1.0 branch and has run "python setup.py build develop".

Same issue here and I tried "pip install pycocotools" or "conda install". It worked

JiafengLiao avatar Apr 15 '20 16:04 JiafengLiao

make sure the branch is pytorch-1.0 and cd lib && python setup.py build develop then retry?

Having the same problem as well. I am using the pytorch-1.0 branch and has run "python setup.py build develop".

Same issue here and I tried "pip install pycocotools" or "conda install". It worked

thank you , it worked well!

aDecisionTree avatar May 01 '20 10:05 aDecisionTree

Just find out that you have to install the CoCO API.

cd data

git clone https://github.com/pdollar/coco.git cd coco/PythonAPI

make

cd ../../..

When I tried to make, got

error: command 'D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe' failed with exit status 2 make: *** [Makefile:3: all] Error 1

Dose anyone know what this means ?

decoli avatar May 10 '20 12:05 decoli

Just find out that you have to install the CoCO API. cd data git clone https://github.com/pdollar/coco.git cd coco/PythonAPI make cd ../../..

When I tried to make, got

error: command 'D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe' failed with exit status 2 make: *** [Makefile:3: all] Error 1

Dose anyone know what this means ?

After generating pycocotools directory('xxx/xxx/data/coco/PythonAPI/pycocotools'), replace the original pycocotools with this new one. The new pycocotools should include file.so like '_mask.cpython-36m-x86_64-linux-gnu.so'.

TheLostIn avatar May 12 '21 02:05 TheLostIn