ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'pixellib.torchbackend' has no attribute 'instance'

tobimichigan opened this issue · comments

Nice work on your repo. Please, could you kindly suggest a way of resolving this error:
image

it prompts up anytime I try to run
from pixellib.torchbackend.instance import instanceSegmentation

it actually points to: PixelLib/pixellib/torchbackend/instance/engine/train_loop.py", line 12, in

It was referenced here before, but the answer wasn't helpful at all.
Many of the files have broken imports. You have to go through each one of them, and change the way the modules are imported.
Go the directory where it's installed (usually under python[your-version-number]/site-packages) and proceed.
Here are the paths, files, and their fixes. The grayed out, hashtag line is what was causing the error.
Below are the fixes.

pixellib/torchbackend/instance/engine/train_loop.py

#from pixellib.torchbackend.instance.utils import comm
import pixellib.torchbackend.instance.utils.comm as comm

pixellib/torchbackend/instance/data/detection_utils.py

#import pixellib.torchbackend.instance.data.transforms as T
from pixellib.torchbackend.instance.data import transforms as T

pixellib/torchbackend/instance/data/dataset_mapper.py

#import pixellib.torchbackend.instance.data.detection_utils as utils
#import pixellib.torchbackend.instance.data.transforms as T
from pixellib.torchbackend.instance.data import detection_utils as utils
from pixellib.torchbackend.instance.data import transforms as T

pixellib/torchbackend/instance/data/samplers/distributed_sampler.py

#import pixellib.torchbackend.instance.utils.comm as comm
from pixellib.torchbackend.instance.utils import comm

pixellib/torchbackend/instance/engine/defaultseng.py

#import pixellib.torchbackend.instance.data.transforms as T
from pixellib.torchbackend.instance.data import transforms as T

#import pixellib.torchbackend.instance.utils.comm as comm
from pixellib.torchbackend.instance.utils import comm

#import pixellib.torchbackend.instance.engine.hooks as hooks
from pixellib.torchbackend.instance.engine import hooks

pixellib/torchbackend/instance/engine/hooks.py

#import pixellib.torchbackend.instance.utils.comm as comm
from pixellib.torchbackend.instance.utils import comm

pixellib/torchbackend/instance/checkpoint/__init__.py

#import pixellib.torchbackend.instance.checkpoint.catalog as _UNUSED
from pixellib.torchbackend.instance.checkpoint import catalog as _UNUSED

pixellib/torchbackend/instance/checkpoint/detection_checkpoint.py

#import pixellib.torchbackend.instance.utils.comm as comm
from pixellib.torchbackend.instance.utils import comm

pixellib/torchbackend/instance/evaluation/coco_evaluation.py

#import pixellib.torchbackend.instance.utils.comm as comm
from pixellib.torchbackend.instance.utils import comm

Then, make sure to download the model in the same directory that your script is running from.

Excuse any typos if they are in here as it's quite a bit. Hope this helps!

@ayoolaolafenwa Please verify and fix if possible. I'm not going to open a PR for this as I'm not an active contributor.