由于转置卷积是nn库自带的,所以我们直接找到models文件夹中的yolo.py文件中的
parse_model函数,再在如下图的地方添加转置卷积模块
# YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
YOLO-specific modules.
Usage:
$ python models/yolo.py --cfg yolov5s.yaml
"""
import argparse
import contextlib
import math
import os
import platform
import sys
from copy import deepcopy
from pathlib import Path
import torch
import torch.nn as nn
from models.FLAttention import *
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLOv5 root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ROOT to PATH
if platform.system() != "Windows":
ROOT &#