matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.65k stars 11.7k forks source link

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

Open naserpiltan opened 6 years ago

naserpiltan commented 6 years ago

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 commented 6 years ago

you can try:

# import coco
from samples.coco import coco
naserpiltan commented 6 years ago

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

sleepless-se commented 5 years ago

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

AlOo2002 commented 5 years ago

its not working for me :(

RashadGarayev commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

sahaj432 commented 4 years ago

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

morganaribeiro commented 4 years ago

@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 commented 3 years ago

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/"))