Open kirk86 opened 1 year ago
As the error message says, please use from d2go.registry.builtin import META_ARCH_REGISTRY instead of detectron2.modeling import META_ARCH_REGISTRY. https://github.com/facebookresearch/d2go/issues/490
Thanks for the reply, I'm trying to test this project on google colab notebook.
Yesterday I could install requirements without producing many issues along the way but today it seems that AdelaiDet
cannot be installed.
When installing requirements from requirements.txt
I get the following error:
Building wheels for collected packages: AdelaiDet
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for AdelaiDet (setup.py) ... error
ERROR: Failed building wheel for AdelaiDet
Running setup.py clean for AdelaiDet
Failed to build AdelaiDet
ERROR: Could not build wheels for AdelaiDet, which is required to install pyproject.toml-based projects
Any ideas how to resolve that?
I suggest that you could install AdelaiDet with sound code of it. https://github.com/aim-uofa/AdelaiDet
Thanks, managed to partially run it but now sylph
raises new errors:
ZERO_GRAD_BEFORE_FORWARD: False
INFO:setup:Full config saved to output/meta-fcos/coco/pretrain/config.yaml
INFO:setup:Initializing runner ...
INFO:setup:Running with runner: <sylph.runner.meta_fcos_runner.MetaFCOSRunner object at 0x7ff15c6bbc70>
INFO:setup:Full config saved to output/meta-fcos/coco/pretrain/diff_config.yaml
INFO:__main__:setup_after_launch done
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0>
init Conv2d(256, 60, kernel_size=(1, 1), stride=(1, 1)) in <generator object Module.modules at 0x7ff150474e40>
init Conv2d(256, 4, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474dd0>
init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0>
init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474dd0>
weight path: detectron2://ImageNetPretrained/MSRA/R-50.pkl
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/mobile_cv/common/misc/py.py", line 136, in new_func
return func(*args, **kwargs)
File "/content/sylph-few-shot-detection/tools/train_net.py", line 48, in main
model = runner.build_model(cfg)
File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 318, in build_model
model = self._build_model(cfg, eval_only)
File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 277, in _build_model
model = build_d2go_model(cfg).model
File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 57, in build_d2go_model
model = build_meta_arch(cfg)
File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 47, in build_meta_arch
model = META_ARCH_REGISTRY.get(meta_arch)(cfg)
File "/usr/local/lib/python3.10/dist-packages/detectron2/config/config.py", line 189, in wrapped
explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/detectron2/config/config.py", line 245, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_arch/meta_one_stage_detector.py", line 77, in from_config
proposal_generator = build_proposal_generator(
File "/usr/local/lib/python3.10/dist-packages/detectron2/modeling/proposal_generator/build.py", line 24, in build_proposal_generator
return PROPOSAL_GENERATOR_REGISTRY.get(name)(cfg, input_shape)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 178, in __init__
self.fcos_head = MetaFCOSHead(
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 292, in __init__
super().__init__(cfg, input_shape)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 131, in __init__
self._init_base_detector_config()
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 476, in _init_base_detector_config
self.base_weight, self.base_bias = load_pretrained_class_conv_kernel_weights(
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 39, in load_pretrained_class_conv_kernel_weights
if not PathManager.exists(weight_path):
File "/usr/local/lib/python3.10/dist-packages/iopath/common/file_io.py", line 1247, in exists
bret = handler._exists(path, **kwargs) # type: ignore
File "/usr/local/lib/python3.10/dist-packages/iopath/common/file_io.py", line 428, in _exists
raise NotImplementedError()
NotImplementedError
Does this have to do with the fact that can't find weight path: detectron2://ImageNetPretrained/MSRA/R-50.pkl
?
I met the same problem!The code has some bugs you should fix it as follow:
class Detectron2Handler(PathHandler): """ Resolve anything that's hosted under detectron2's namespace. """
PREFIX = "detectron2://" S3_DETECTRON2_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/"
def _exists(self, path, **kwargs): print("the path of weight file is :"+path) return True def _get_supported_prefixes(self): return [self.PREFIX]
def _get_local_path(self, path, kwargs): name = path[len(self.PREFIX) :] return PathManager.get_local_path(self.S3_DETECTRON2_PREFIX + name, kwargs)
def _open(self, path, mode="r", kwargs): return PathManager.open( self.S3_DETECTRON2_PREFIX + path[len(self.PREFIX) :], mode, kwargs )
My english is so poor,if you have not understand,you could replay email again! (Can you speak Chinese? I think we would communicate with each other conveniently!)
From: kirk86 @.> Date: 2023-05-16 22:29:27 To: facebookresearch/sylph-few-shot-detection @.> Cc: RockJim2001 @.>,Comment @.> Subject: Re: [facebookresearch/sylph-few-shot-detection] "Can't find 'MetaOneStageDetector' in D2Go's META_ARCH_REGISTRY (Issue #15)
Thanks, managed to partially run it but now sylph raises new errors: ZERO_GRAD_BEFORE_FORWARD: False INFO:setup:Full config saved to output/meta-fcos/coco/pretrain/config.yaml INFO:setup:Initializing runner ... INFO:setup:Running with runner: <sylph.runner.meta_fcos_runner.MetaFCOSRunner object at 0x7ff15c6bbc70> INFO:setup:Full config saved to output/meta-fcos/coco/pretrain/diff_config.yaml INFO:main:setup_after_launch done init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474e40> init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0> init Conv2d(256, 60, kernel_size=(1, 1), stride=(1, 1)) in <generator object Module.modules at 0x7ff150474e40> init Conv2d(256, 4, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474dd0> init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474eb0> init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7ff150474dd0> weight path: detectron2://ImageNetPretrained/MSRA/R-50.pkl Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/mobile_cv/common/misc/py.py", line 136, in new_func return func(*args, kwargs) File "/content/sylph-few-shot-detection/tools/train_net.py", line 48, in main model = runner.build_model(cfg) File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 318, in build_model model = self._build_model(cfg, eval_only) File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 277, in _build_model model = build_d2go_model(cfg).model File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 57, in build_d2go_model model = build_meta_arch(cfg) File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 47, in build_meta_arch model = META_ARCH_REGISTRY.get(meta_arch)(cfg) File "/usr/local/lib/python3.10/dist-packages/detectron2/config/config.py", line 189, in wrapped explicit_args = _get_args_from_config(from_config_func, *args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/detectron2/config/config.py", line 245, in _get_args_from_config ret = from_config_func(args, kwargs) File "/content/sylph-few-shot-detection/sylph/modeling/meta_arch/meta_one_stage_detector.py", line 77, in from_config proposal_generator = build_proposal_generator( File "/usr/local/lib/python3.10/dist-packages/detectron2/modeling/proposal_generator/build.py", line 24, in build_proposal_generator return PROPOSAL_GENERATOR_REGISTRY.get(name)(cfg, input_shape) File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 178, in init self.fcos_head = MetaFCOSHead( File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 292, in init super().init(cfg, input_shape) File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 131, in init self._init_base_detector_config() File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 476, in _init_base_detector_config self.base_weight, self.base_bias = load_pretrained_class_conv_kernel_weights( File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 39, in load_pretrained_class_conv_kernel_weights if not PathManager.exists(weight_path): File "/usr/local/lib/python3.10/dist-packages/iopath/common/file_io.py", line 1247, in exists bret = handler._exists(path, kwargs) # type: ignore File "/usr/local/lib/python3.10/dist-packages/iopath/common/file_io.py", line 428, in _exists raise NotImplementedError() NotImplementedError Does this have to do with the fact that can't find weight path: detectron2://ImageNetPretrained/MSRA/R-50.pkl? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: **@.***>
Thanks that seemed to work for a while but now throws a different error, by the way your english is fine and can understand you very well 😉
INFO:__main__:setup_after_launch done
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa70>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffae0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa70>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffae0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa70>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffae0>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa70>
init Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffae0>
init Conv2d(256, 60, kernel_size=(1, 1), stride=(1, 1)) in <generator object Module.modules at 0x7f10cccffa70>
init Conv2d(256, 4, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa00>
init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffae0>
init Conv2d(256, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) in <generator object Module.modules at 0x7f10cccffa00>
weight path: detectron2://ImageNetPretrained/MSRA/R-50.pkl
the path of weight file is :detectron2://ImageNetPretrained/MSRA/R-50.pkl
INFO:iopath.common.file_io:URL https://dl.fbaipublicfiles.com/detectron2/ImageNetPretrained/MSRA/R-50.pkl cached in /root/.torch/iopath_cache/detectron2/ImageNetPretrained/MSRA/R-50.pkl
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/mobile_cv/common/misc/py.py", line 136, in new_func
return func(*args, **kwargs)
File "/content/sylph-few-shot-detection/tools/train_net.py", line 48, in main
model = runner.build_model(cfg)
File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 318, in build_model
model = self._build_model(cfg, eval_only)
File "/usr/local/lib/python3.10/dist-packages/d2go/runner/default_runner.py", line 277, in _build_model
model = build_d2go_model(cfg).model
File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 57, in build_d2go_model
model = build_meta_arch(cfg)
File "/usr/local/lib/python3.10/dist-packages/d2go/modeling/api.py", line 47, in build_meta_arch
model = META_ARCH_REGISTRY.get(meta_arch)(cfg)
File "/content/detectron2/detectron2/config/config.py", line 189, in wrapped
explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
File "/content/detectron2/detectron2/config/config.py", line 245, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_arch/meta_one_stage_detector.py", line 77, in from_config
proposal_generator = build_proposal_generator(
File "/content/detectron2/detectron2/modeling/proposal_generator/build.py", line 24, in build_proposal_generator
return PROPOSAL_GENERATOR_REGISTRY.get(name)(cfg, input_shape)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 178, in __init__
self.fcos_head = MetaFCOSHead(
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 292, in __init__
super().__init__(cfg, input_shape)
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 131, in __init__
self._init_base_detector_config()
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 476, in _init_base_detector_config
self.base_weight, self.base_bias = load_pretrained_class_conv_kernel_weights(
File "/content/sylph-few-shot-detection/sylph/modeling/meta_fcos/fcos.py", line 44, in load_pretrained_class_conv_kernel_weights
pretrained_model = torch.load(
File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1035, in _legacy_load
raise RuntimeError("Invalid magic number; corrupt file?")
RuntimeError: Invalid magic number; corrupt file?
How should we register
MetaOneStageDetector
in D2Go's META_ARCH_REGISTRY? If I'm not mistaken that should be already registered, right?