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

AttributeError: module 'coco' has no attribute 'CocoConfig' #596

Open
naserpiltan opened this issue May 26, 2018 · 13 comments
Open

AttributeError: module 'coco' has no attribute 'CocoConfig' #596

naserpiltan opened this issue May 26, 2018 · 13 comments

Comments

@naserpiltan
Copy link

naserpiltan commented May 26, 2018

I want to use Mask-RCNN demo.py in my jupyter notebook but when i ran the the demo code , i faced such a problem


AttributeError: module 'coco' has no attribute 'CocoConfig'

I used from this https://github.com/matterport/Mask_RCNN/issues/526 workround
but it has not any correct code and i can not solve my problem
can any body help me??
thank's

@HC-2016
Copy link

HC-2016 commented May 26, 2018

you can try:

# import coco
from samples.coco import coco

@naserpiltan
Copy link
Author

@HC-2016
thank you so much
I fixed the problem with your workround.
thank's again

@sleepless-se
Copy link

@HC-2016
Thank you! It's works fine!

@AlOo2002
Copy link

its not working for me :(

@RashadGarayev
Copy link

import cv2
import numpy as np
import os
import sys
import imageio
from mrcnn import utils
from mrcnn import model as modellib

ROOT_DIR = os.path.abspath('../')
MODEL_DIR = os.path.join(ROOT_DIR, "logs")
sys.path.append(os.path.join(ROOT_DIR,'coco/'))
import coco
from coco import coco
COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5")

@oscarlaoda
Copy link

I encountered the same problem. Tried the suggestion here but didn't work. So I simply copied and pasted the following code into my .py files, hope this helps.

from mrcnn.config import Config
class CocoConfig(Config):
"""Configuration for training on MS COCO.
Derives from the base Config class and overrides values specific
to the COCO dataset.
"""
# Give the configuration a recognizable name
NAME = "coco"

# We use a GPU with 12GB memory, which can fit two images.
# Adjust down if you use a smaller GPU.
IMAGES_PER_GPU = 2

# Uncomment to train on 8 GPUs (default is 1)
# GPU_COUNT = 8

# Number of classes (including background)
NUM_CLASSES = 1 + 80  # COCO has 80 classes

@Benito2204
Copy link

you can try:

# import coco
from samples.coco import coco

@ HC-2016

I tried this command but it says No module named 'samples'

Please help.

@ShashiAdhikari
Copy link

you can try:

# import coco
from samples.coco import coco

when you use it from samples.coco import coco.
it gives you error No module named samples

@dxoco
Copy link

dxoco commented Sep 28, 2020

I may be a bit late, but I just encountered the same issue. It was solved by:

  1. from mrcnn.config import Config
    and
  2. setting:
    class InferenceConfig(Config):
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1

config = InferenceConfig()
config.display()

I encountered the same problem. Tried the suggestion here but didn't work. So I simply copied and pasted the following code into my .py files, hope this helps.

from mrcnn.config import Config
class CocoConfig(Config):
"""Configuration for training on MS COCO.
Derives from the base Config class and overrides values specific
to the COCO dataset.
"""

Give the configuration a recognizable name

NAME = "coco"

# We use a GPU with 12GB memory, which can fit two images.
# Adjust down if you use a smaller GPU.
IMAGES_PER_GPU = 2

# Uncomment to train on 8 GPUs (default is 1)
# GPU_COUNT = 8

# Number of classes (including background)
NUM_CLASSES = 1 + 80  # COCO has 80 classes

@rondondaniel
Copy link

Thanks @dxoco ! your workaround was the only working for me.

@sahaj432
Copy link

Thanks, @dxoco!!! It worked......

@morganaribeiro
Copy link

@dxoco Could you help me with my problem below:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-14-815378d5aae5> in <module>
     29 sys.path.append(os.path.join(ROOT_DIR, "samples/coco"))  # To find local version
     30 # import coco
---> 31 from samples.coco import coco
     32 # from pycocotools.coco import COCO
     33 

ModuleNotFoundError: No module named 'samples.coco'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

The source code I put in the stack overflow:

https://stackoverflow.com/questions/64507647/modulenotfounderror-no-module-named-samples-coco

@ting2313
Copy link

ting2313 commented Dec 15, 2020

I may be a bit late, but I just encountered the same issue. It was solved by:

1. from mrcnn.config import Config
   and

2. setting:
   class InferenceConfig(Config):
   GPU_COUNT = 1
   IMAGES_PER_GPU = 1

config = InferenceConfig()
config.display()

I encountered the same problem. Tried the suggestion here but didn't work. So I simply copied and pasted the following code into my .py files, hope this helps.
from mrcnn.config import Config
class CocoConfig(Config):
"""Configuration for training on MS COCO.
Derives from the base Config class and overrides values specific
to the COCO dataset.
"""

Give the configuration a recognizable name

NAME = "coco"

# We use a GPU with 12GB memory, which can fit two images.
# Adjust down if you use a smaller GPU.
IMAGES_PER_GPU = 2

# Uncomment to train on 8 GPUs (default is 1)
# GPU_COUNT = 8

# Number of classes (including background)
NUM_CLASSES = 1 + 80  # COCO has 80 classes

I tried this way and worked with this issue, but this solution might cause #709 .
Did anyone have overcome #709 ?

[edited]
I solved by copy coco.py at colab
!cp samples/coco/coco.py .
then removed this column
sys.path.append(os.path.join(ROOT_DIR, "samples/coco/"))

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