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

Encountering issues while running PointRend in the project #5396

Closed
GanYuSuki opened this issue Nov 20, 2024 · 0 comments
Closed

Encountering issues while running PointRend in the project #5396

GanYuSuki opened this issue Nov 20, 2024 · 0 comments

Comments

@GanYuSuki
Copy link

Instructions To Reproduce the Issue:

  1. Full runnable code or full changes you made:
import os
import detectron2.utils.comm as comm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import build_detection_train_loader
from detectron2.engine import DefaultTrainer, default_setup, default_argument_parser, launch
from detectron2.evaluation import COCOEvaluator, verify_results
from detectron2.data.datasets import register_coco_instances
from point_rend import add_pointrend_config

def register_datasets():
         Omit
    print("Datasets registered!")


class Trainer(DefaultTrainer):
    @classmethod
    def build_evaluator(cls, cfg, dataset_name, output_folder=None):

        if output_folder is None:
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
        return COCOEvaluator(dataset_name, cfg, True, output_folder)

    @classmethod
    def build_train_loader(cls, cfg):
        return build_detection_train_loader(cfg, mapper=None)

def setup(args):
    """
    Create configs and perform basic setups.
    """
    cfg = get_cfg()
    add_pointrend_config(cfg)  
    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()
    default_setup(cfg, args)
    cfg.DATASETS.TRAIN = ("LP_train",)
    cfg.DATASETS.TEST = ("LP_test",)
    cfg.DATALOADER.NUM_WORKERS = 1
    cfg.MODEL.WEIGHTS = r"D:\python program\detectron2\projects\PointRend\configs\InstanceSegmentation\pointrend_rcnn_R_50_FPN_3x_coco.yaml"
    cfg.SOLVER.IMS_PER_BATCH = 2
    cfg.SOLVER.BASE_LR = 0.00025
    cfg.SOLVER.MAX_ITER = 100
    cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 
    cfg.OUTPUT_DIR = r"D:\python program\detectron2\projects\PointRend"
    os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
    return cfg

def main(args):
    register_datasets()  
    cfg = setup(args)

    if args.eval_only:
        model = Trainer.build_model(cfg)
        DetectionCheckpointer(model, save_dir=cfg.OUTPUT_DIR).resume_or_load(cfg.MODEL.WEIGHTS, resume=args.resume)
        res = Trainer.test(cfg, model)
        if comm.is_main_process():
            verify_results(cfg, res)
        return res

    trainer = Trainer(cfg)
    trainer.resume_or_load(resume=args.resume)
    trainer.train()

if __name__ == "__main__":
    args = default_argument_parser().parse_args()
    launch(main, args.num_gpus, args=(args,))

  1. What exact command you run: python train_net.py --config-file configs/InstanceSegmentation/pointrend_rcnn_R_50_FPN_3x_coco.yaml
  2. Full logs or other relevant observations:
(detectron_env) D:\python program\detectron2\projects\PointRend>python train_net.py --config-file configs/InstanceSegmentation/pointrend_rcnn_R_50_FPN_3x_coco.yaml
Traceback (most recent call last):
  File "train_net.py", line 2, in <module>
    import detectron2.utils.comm as comm
ModuleNotFoundError: No module named 'detectron2'

Expected behavior:

Hope the program runs normally

Environment:

(detectron_env) D:\python program\detectron2\projects\PointRend>conda list
# packages in environment at D:\anaconda3\envs\detectron_env:
#
# Name                    Version                   Build  Channel
absl-py                   2.1.0                    pypi_0    pypi
antlr4-python3-runtime    4.9.3                    pypi_0    pypi
beautifulsoup4            4.12.3                   pypi_0    pypi
black                     24.8.0                   pypi_0    pypi
blas                      2.123                       mkl    conda-forge
blas-devel                3.9.0              23_win64_mkl    conda-forge
ca-certificates           2024.9.24            haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cachetools                5.5.0                    pypi_0    pypi
certifi                   2024.8.30                pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.0.0                    pypi_0    pypi
cmake                     3.31.0.1                 pypi_0    pypi
colorama                  0.4.6                    pypi_0    pypi
coloredlogs               15.0.1                   pypi_0    pypi
contourpy                 1.1.1                    pypi_0    pypi
cudatoolkit               11.1.1              hb074779_13    conda-forge
cycler                    0.12.1                   pypi_0    pypi
cython                    3.0.11                   pypi_0    pypi
detectron2                0.6                       dev_0    <develop>
filelock                  3.16.0                   pypi_0    pypi
flatbuffers               24.3.25                  pypi_0    pypi
fonttools                 4.53.1                   pypi_0    pypi
freetype                  2.12.1               ha860e81_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
fsspec                    2024.10.0                pypi_0    pypi
fvcore                    0.1.5.post20221221          pypi_0    pypi
gdown                     5.2.0                    pypi_0    pypi
giflib                    5.2.2                h7edc060_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
google-auth               2.34.0                   pypi_0    pypi
google-auth-oauthlib      1.0.0                    pypi_0    pypi
grpcio                    1.66.1                   pypi_0    pypi
humanfriendly             10.0                     pypi_0    pypi
hydra-core                1.3.2                    pypi_0    pypi
idna                      3.8                      pypi_0    pypi
imageio                   2.35.1                   pypi_0    pypi
imgviz                    1.7.5                    pypi_0    pypi
importlib-metadata        8.4.0                    pypi_0    pypi
importlib-resources       6.4.4                    pypi_0    pypi
intel-openmp              2024.2.1          h57928b3_1083    conda-forge
iopath                    0.1.9                    pypi_0    pypi
jinja2                    3.1.4                    pypi_0    pypi
joblib                    1.4.2                    pypi_0    pypi
jpeg                      8d                   h8ffe710_1    conda-forge
kiwisolver                1.4.7                    pypi_0    pypi
labelme                   5.5.0                    pypi_0    pypi
lazy-loader               0.4                      pypi_0    pypi
lerc                      3.0                  hd77b12b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libblas                   3.9.0              23_win64_mkl    conda-forge
libcblas                  3.9.0              23_win64_mkl    conda-forge
libdeflate                1.17                 h2bbff1b_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libffi                    3.4.4                hd77b12b_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libhwloc                  2.11.1          default_h8125262_1000    conda-forge
libiconv                  1.17                 hcfcfb64_2    conda-forge
liblapack                 3.9.0              23_win64_mkl    conda-forge
liblapacke                3.9.0              23_win64_mkl    conda-forge
libpng                    1.6.39               h8cc25b3_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtiff                   4.5.0                h8a3f274_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libuv                     1.48.0               hcfcfb64_0    conda-forge
libwebp                   1.4.0                h2466b09_0    conda-forge
libwebp-base              1.4.0                hcfcfb64_0    conda-forge
libxml2                   2.13.1               h24da03e_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libzlib                   1.2.13               h2466b09_6    conda-forge
lz4-c                     1.9.4                h2bbff1b_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markdown                  3.7                      pypi_0    pypi
markupsafe                2.1.5                    pypi_0    pypi
matplotlib                3.7.5                    pypi_0    pypi
mkl                       2024.1.0           h66d3029_694    conda-forge
mkl-devel                 2024.1.0           h57928b3_694    conda-forge
mkl-include               2024.1.0           h66d3029_694    conda-forge
mpmath                    1.3.0                    pypi_0    pypi
msys2-conda-epoch         20160418                      1    conda-forge
mypy-extensions           1.0.0                    pypi_0    pypi
natsort                   8.4.0                    pypi_0    pypi
networkx                  3.1                      pypi_0    pypi
ninja                     1.11.1.1                 pypi_0    pypi
numpy                     1.24.4           py38h1d91fd2_0    conda-forge
oauthlib                  3.2.2                    pypi_0    pypi
omegaconf                 2.3.0                    pypi_0    pypi
onnxruntime               1.19.2                   pypi_0    pypi
opencv-python             4.10.0.84                pypi_0    pypi
openssl                   3.4.0                h2466b09_0    conda-forge
packaging                 24.1                     pypi_0    pypi
pathspec                  0.12.1                   pypi_0    pypi
pillow                    9.3.0                    pypi_0    pypi
pip                       24.2             py38haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
platformdirs              4.2.2                    pypi_0    pypi
portalocker               2.10.1                   pypi_0    pypi
protobuf                  3.20.0                   pypi_0    pypi
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pyasn1                    0.6.0                    pypi_0    pypi
pyasn1-modules            0.4.0                    pypi_0    pypi
pycocotools               2.0.7                    pypi_0    pypi
pyparsing                 3.1.4                    pypi_0    pypi
pyqt5                     5.15.11                  pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.15.0                  pypi_0    pypi
pyreadline3               3.4.1                    pypi_0    pypi
pysocks                   1.7.1                    pypi_0    pypi
python                    3.8.19               h1aa4202_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python-dateutil           2.9.0.post0              pypi_0    pypi
python_abi                3.8                      2_cp38    conda-forge
pytorch                   1.8.0           py3.8_cuda11.1_cudnn8_0    pytorch
pywavelets                1.4.1                    pypi_0    pypi
pywin32                   306                      pypi_0    pypi
pyyaml                    6.0.2                    pypi_0    pypi
qtpy                      2.4.1                    pypi_0    pypi
requests                  2.32.3                   pypi_0    pypi
requests-oauthlib         2.0.0                    pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
scikit-image              0.21.0                   pypi_0    pypi
scikit-learn              1.3.2                    pypi_0    pypi
scipy                     1.10.1                   pypi_0    pypi
setuptools                72.1.0           py38haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
six                       1.16.0                   pypi_0    pypi
soupsieve                 2.6                      pypi_0    pypi
sqlite                    3.45.3               h2bbff1b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
sympy                     1.13.2                   pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tbb                       2021.12.0            hc790b64_4    conda-forge
tensorboard               2.14.0                   pypi_0    pypi
tensorboard-data-server   0.7.2                    pypi_0    pypi
tensormask                0.1                       dev_0    <develop>
termcolor                 2.4.0                    pypi_0    pypi
threadpoolctl             3.5.0                    pypi_0    pypi
tifffile                  2023.7.10                pypi_0    pypi
tk                        8.6.14               h0416ee5_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tomli                     2.0.1                    pypi_0    pypi
torchaudio                0.8.0                      py38    pytorch
torchvision               0.9.0+cu111              pypi_0    pypi
tqdm                      4.66.5                   pypi_0    pypi
typing_extensions         4.12.2             pyha770c72_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   2.2.2                    pypi_0    pypi
vc                        14.40                h2eaa2aa_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc14_runtime              14.40.33810         hcc2c482_20    conda-forge
vs2015_runtime            14.40.33810         h3bf8584_20    conda-forge
werkzeug                  3.0.4                    pypi_0    pypi
wheel                     0.43.0           py38haa95532_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
xz                        5.4.6                h8cc25b3_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
yacs                      0.1.8                    pypi_0    pypi
zipp                      3.20.1                   pypi_0    pypi
zlib                      1.2.13               h2466b09_6    conda-forge
zstd                      1.5.6                h8880b57_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

The relevant programs within the projects will all report the same error message.Others can operate normally

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

1 participant