Comments (5)
Ideally that shouldn't be the case since all the three operations are computed in parallel and independently. Can you provide a reproducible experiment where we can observe that? Further are you sure, the seeds were the same between the two runs and there is no randomness?
from triplet-attention.
I'm honored for your response.
The code below is the code I modified.
When tested on existing code and custom data, the modified code showed a slight improvement. I wonder if there is a cause that I don't know about.
The experimental model was the yolov8m model, and the code was combined with bottleneck, and the same combination was used in all experiments.
class ZPool(nn.Module):
def forward(self, x):
return torch.cat(
(torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1).unsqueeze(1)), dim=1
)
class AttentionGate(nn.Module):
def __init__(self):
super(AttentionGate, self).__init__()
kernel_size = 7
self.compress = ZPool()
self.conv = Conv(
2, 1, k=kernel_size, s=1, p=(kernel_size - 1) // 2, act=False
)
def forward(self, x):
x_compress = self.compress(x)
x_out = self.conv(x_compress)
scale = torch.sigmoid(x_out)
return x * scale
class TripletAttention(nn.Module):
def __init__(self, no_spatial=False):
super(TripletAttention, self).__init__()
self.cw = AttentionGate()
self.hc = AttentionGate()
self.hw = AttentionGate()
def forward(self, x):
x_hw = self.hw(x)
x_hc = self.hc(x.permute(0, 3, 2, 1).contiguous()).permute(0, 3, 2, 1).contiguous()
x_cw = self.cw(x.permute(0, 2, 1, 3).contiguous()).permute(0, 2, 1, 3).contiguous()
x_out = 1/3 * (x_hw + x_hc + x_cw)
return x_out
from triplet-attention.
@byunsunghun Sorry for my late response, from your snippet I don't see anything obvious that would explain such improvement as you mentioned. However, as I stated if the seeds were not fixed between the two experiments or any other source of randomness can cause variance in performance. It would be best to run multi-seed runs and benchmark the average and variance in the performance of the two settings.
from triplet-attention.
Thank you for your reply. The seeds in both experiments are always fixed, and we will separately investigate whether differences in the different randomness source codes cause performance differences.
happy new year!
from triplet-attention.
Keep me posted, happy new year to you too!
from triplet-attention.
Related Issues (20)
- wandb error HOT 4
- No multiprocessing option HOT 5
- Pre-training weights loading HOT 5
- seems like the params are not used in `TripletAttention`'s definition? HOT 1
- The weights in google drive is demage!!! HOT 2
- The code for HeatMap visualization HOT 1
- load error HOT 3
- 怎么修改能一键替换SE 和CBAM HOT 3
- Improvement of Triple Attention HOT 3
- torch.cat( (torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1).unsqueeze(1)), dim=1 ) HOT 1
- Hi,I wanna ask that how to calculate the AP value of. HOT 1
- error HOT 3
- Triplet Attention can be applied to EfficientNet in place SE? HOT 3
- How did you initialize TA weights? HOT 1
- A little question about adding attention to the network HOT 1
- mmdetection——fasterrcnn
- mmdetection_fasterrcnn HOT 3
- data loader issue in the training stage HOT 7
- 预训练模型加载 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from triplet-attention.