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
PPYOLOFPN结构修改 #3373
Comments
@zsbjmy good job. 欢迎提交PR |
您好,请问我这样修改是有效的吗?我的logger.info("进入ChannelA")在notebook中没有打印出来,是不是说明没有进入到我添加的 ChannelAttention(nn.Layer)函数中? |
这种写法是无效的,所有的模块都需要在__init__函数中初始化,另外SpitialAttention的结构好像也有点问题,这个模块的输出channel直接变成1了,我理解你现在实现的SpitialAttention的输出只是注意力分数 |
我在PaddleDetection/ppdet/modeling/necks/yolo_fpn.py 这个文件中直接加入了ChannelAttention(nn.Layer)这个函数, import paddle from ..shape_spec import ShapeSpec from .logger import setup_logger all = ['YOLOv3FPN', 'PPYOLOFPN'] def add_coord(x, data_format):
class YoloDetBlock(nn.Layer):
class SPP(nn.Layer):
class DropBlock(nn.Layer):
class CoordConv(nn.Layer):
class PPYOLODetBlock(nn.Layer):
class PPYOLOTinyDetBlock(nn.Layer):
class PPYOLODetBlockCSP(nn.Layer):
@register
@register
@register
@register
class ChannelAttention(nn.Layer):
class SELayer(nn.Layer):
class SpatialAttention(nn.Layer):
|
还需要在初始化中倒入模块吗? |
需要在初始化中倒入模块,所有继承自nn.Layer类都需要在初始化中倒入模块,类似nn.Conv2D等内置层 |
您帮我看看,这样初始化对吗? |
不对,上面已经说过了在__init__函数中初始化 |
这个写法是ok的 |
非常感谢!请问在__init__()函数中的下面这句,参数block是任意变量,还是必须在上面代码中出现过的变量? |
我这个self.at = SELayer(block)中的block实际上是骨干网络输出的特征层,但是在__init__()函数中没有对应的变量 |
在forward()中有骨干网络输出的特征层
|
在其他位置能打印吗? |
我怀疑在PaddleDetection/ppdet/modeling/necks/yolo_fpn.py这个文件里改代码不起作用,因为我将PPYOLOFPN这个类整体注释掉,模型依然能够跑起来 |
那你用到PPYOLOFPN这个类了吗?你运行的是什么模型? |
architecture: YOLOv3 YOLOv3: |
请问我想改源代码,应该怎么办? |
|
非常感谢您的帮助!
|
|
Since this issue has not been updated for more than three months, it will be closed, if it is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. |
我在PaddleDetection/ppdet/modeling/necks/yolo_fpn.py 做了如下修改:
【在forward中加入 block = ChannelAttention(block); block = SpatialAttention()】
The text was updated successfully, but these errors were encountered: