Skip to content

Has anyone tried using EigenGradCAM for Class Activation Mapping of YOLOv5? #548

Open
@BaTteREg

Description

@BaTteREg

During the process of adding back - propagation gradients, I found that the output of the model in the BaseCAM function, self.outputs, has a size of (25200, 85). When continuing with the gradient calculation, how should I select the output tensors to calculate the loss and complete the back - propagation?

       if self.uses_gradients:
            self.model.zero_grad()
            # for param in self.model.parameters(): # 设置requires_grad=True
            #     if not param.requires_grad:
            #         param.requires_grad = True
            for name, param in self.model.named_parameters():
                print(f"Parameter name: {name}, requires_grad: {param.requires_grad}")
            loss = sum([target(output) for target, output in zip(targets, outputs)])
            loss.backward(retain_graph=True)
            if 'hpu' in str(self.device):
                self.__htcore.mark_step()

outputs, has a size of (25200, 85).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions