positive666 / yolo_research

based on yolo-high-level project (detect\pose\classify\segment\):include yolov5\yolov7\yolov8\ core ,improvement research ,SwintransformV2 and Attention Series. training skills, business customization, engineering deployment C
GNU General Public License v3.0
756 stars 146 forks source link

想在检测头上加一个3d卷积 #64

Closed wch243294382 closed 2 years ago

wch243294382 commented 2 years ago

❔Question

` self.m3 = nn.ModuleList(nn.Conv3d(x, self.no * self.na, (32, 3, 3), 1) for x in ch) self.inplace = inplace # use in-place ops (e.g. slice assignment)

def forward(self, x):
    z = []  # inference output
    for i in range(self.nl):
        x[i] = self.m[i](x[i])  # conv
        x[i] = self.m3[i](x[i])  # conv

`

Traceback (most recent call last): File "/home/anaconda3/envs/MEGA/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/anaconda3/envs/MEGA/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path pkg_name=pkg_name, script_name=fname) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/home/wch/yolov5_research/train.py", line 734, in main(opt) File "/home/wch/yolov5_research/train.py", line 631, in main train(opt.hyp, opt, device, callbacks) File "/home/wch/yolov5_research/train.py", line 128, in train amp = check_amp(model) # check AMP File "/home/wch/yolov5_research/utils/general.py", line 543, in check_amp a = m(im).xyxy[0] # FP32 inference File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, *kwargs) File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context return func(args, **kwargs) File "/home/wch/yolov5_research/models/common.py", line 946, in forward shape1 = [make_divisible(x, self.stride) for x in np.stack(shape1, 0).max(0)] # inference shape File "/home/wch/yolov5_research/models/common.py", line 946, in shape1 = [make_divisible(x, self.stride) for x in np.stack(shape1, 0).max(0)] # inference shape File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1178, in getattr type(self).name, name)) AttributeError: 'AutoShape' object has no attribute 'stride'

报这个错误,请问作者知道怎么解决吗?

Additional context

positive666 commented 2 years ago

❔Question

` self.m3 = nn.ModuleList(nn.Conv3d(x, self.no * self.na, (32, 3, 3), 1) for x in ch) self.inplace = inplace # use in-place ops (e.g. slice assignment)

def forward(self, x):
    z = []  # inference output
    for i in range(self.nl):
        x[i] = self.m[i](x[i])  # conv
        x[i] = self.m3[i](x[i])  # conv

`

Traceback (most recent call last): File "/home/anaconda3/envs/MEGA/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/anaconda3/envs/MEGA/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 322, in run_path pkg_name=pkg_name, script_name=fname) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 136, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/home/wch/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/home/wch/yolov5_research/train.py", line 734, in main(opt) File "/home/wch/yolov5_research/train.py", line 631, in main train(opt.hyp, opt, device, callbacks) File "/home/wch/yolov5_research/train.py", line 128, in train amp = check_amp(model) # check AMP File "/home/wch/yolov5_research/utils/general.py", line 543, in check_amp a = m(im).xyxy[0] # FP32 inference File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, *kwargs) File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context return func(args, kwargs) File "/home/wch/yolov5_research/models/common.py", line 946, in forward shape1 = [make_divisible(x, self.stride) for x in np.stack(shape1, 0).max(0)] # inference shape File "/home/wch/yolov5_research/models/common.py", line 946, in shape1 = [make_divisible(x, self.stride) for x in np.stack(shape1, 0).max(0)] # inference shape File "/home/anaconda3/envs/MEGA/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1178, in getattr type(self).name**, name)) AttributeError: 'AutoShape' object has no attribute 'stride'

报这个错误,请问作者知道怎么解决吗?

Additional context

这种是你模型没有这个KEY值 你需要在YOLO.PY里加入

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.