import torch
import torch.nn as nn
from torch.autograd import Variable
from torchvision import datasets, transforms
import numpy as np
from lib.models import get_net,YOLOP_only_driveareaSeg,YOLOP_slim_only_driveareaSeg
from lib.config import cfg
from lib.utils.utils import create_logger, select_device, time_synchronized
import shutil
The code: import argparse import os, sys import shutil import time from pathlib import Path import imageio
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file))) sys.path.append(BASE_DIR)
import torch import torch.nn as nn from torch.autograd import Variable from torchvision import datasets, transforms import numpy as np from lib.models import get_net,YOLOP_only_driveareaSeg,YOLOP_slim_only_driveareaSeg from lib.config import cfg from lib.utils.utils import create_logger, select_device, time_synchronized import shutil
from lib.models.common import (SPP, Bottleneck, BottleneckCSP, Concat, Conv, Detect, Focus, SharpenConv, modifeid_DepthSeperabelConv2d, modified_BottleneckCSP, modified_Conv, modified_SharpenConv, modified_SPP)
def prune(cfg,opt):
The error:
Pre-processing Successful! cfg_list: [14, 35, 24, 28, 16, 11, 72, 37, 92, 31, 23, 30, 30, 32, 42, 138, 33, 124, 65, 55, 60, 84, 60, 120, 272, 124, 247, 'M', 125, 226, 120, 110, 149, 64, 123, 61, 73, 19, 70, 17, 32, 12, 15, 13, 11, 3, 6, 2, 2, 2] 50 tensor(0.5002, device='cuda:0') In shape: 14 Out shape:35 Traceback (most recent call last): File "/media/new_data4/.conda/envs/torch171/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/media/new_data4/.conda/envs/torch171/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in
cli.main()
File "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.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 "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.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 "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.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 "/media/new_data4/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/media/new_data4/csn_work/YOLOPR1/tools/prune.py", line 180, in
prune(cfg,opt)
File "/media/new_data4/csn_work/YOLOPR1/tools/prune.py", line 142, in prune
w1 = w1[idx1_1.tolist(), :, :, :].clone() # 根据筛选出的特征图的id,拷贝需要的权重
RuntimeError: CUDA error: device-side assert triggered