haochenheheda / nformer Goto Github PK
View Code? Open in Web Editor NEWImplementation of NFormer: Robust Person Re-identification with Neighbor Transformer
License: MIT License
Implementation of NFormer: Robust Person Re-identification with Neighbor Transformer
License: MIT License
I have some questions about your code. In your paper, The batch size is set to 128 for training the Resnet-50 feature extractor and is set to 2048 for training NFormer. But in your code, the batch size is 64 for Resnet-50 and 2 for NFormer.
SOLVER:
OPTIMIZER_NAME: 'Adam'
MAX_EPOCHS: 120
NFORMER_MAX_EPOCHS: 20
BASE_LR: 0.00035
CLUSTER_MARGIN: 0.3
CENTER_LR: 0.5
CENTER_LOSS_WEIGHT: 0.0005
RANGE_K: 2
RANGE_MARGIN: 0.3
RANGE_ALPHA: 0
RANGE_BETA: 1
RANGE_LOSS_WEIGHT: 1
BIAS_LR_FACTOR: 1
WEIGHT_DECAY: 0.0005
WEIGHT_DECAY_BIAS: 0.0005
IMS_PER_BATCH: 64
And another question in your code is that the function evaluator is same as function nfomer_evalutor.
torch.sparse has no attribute softmax
In your paper, NFormer can be easily applied to other models. How can it be applied to other models? thank you
Will the code be released on June 1? Haha
When I train to the nformer stage, I will be prompted that the video memory is not enough. My video card is 12g video memory. Is there any way for me to train normally in the nformer stage.For example, which parameters can be modified to reduce the use of video memory during training
I find that the code only provides NFormer with Res50.
However, the best performance in your paper is with ABDNet.
Could you please tell me how to reproduce with ABDNet?
Hello, teacher! I recently read your article "NFormer: Robust Person Re-identification with Neighbor Transformer" and found it very inspiring. I'm very interested in it. However, there's one thing that I don't understand. I added a print statement print(x.shape) in the forward(self, x) function in nformer.py, but I'm unable to see the output. I have tried modifying four YAML files, but it still doesn't work. Could you please help me with this issue?
老师您好,最近看了你们NFormer: Robust Person Re-identification with Neighbor Transformer这篇文章深受启发,我非常感兴趣。但有一个地方我很不解,就是我在nformer.py的def forward(self, x)函数下加了print(x.shape)语句,为什么无法print呀?我试了并修改了四个yml文件依然不行。
The description in the paper is “During the inference, the interactions between the different query images are eliminated for fair comparison. ” But this issue doesn't seem to be considered in the released test code.
Hi, when will you team release the code?
Is the t-sne visualization code open source?
def __getitem__(self, index):
'''
从backbone提取的特征中
'''
center_index = random.randint(0, self.data_num - 1)
center_feat = self.feats[center_index].unsqueeze(0) # 1, dim
center_pid = self.ids[center_index]
selected_flags = torch.zeros(self.data_num)
selected_flags[center_index] = 1
#
distmat = 1 - torch.mm(center_feat, self.feats.transpose(0,1))
indices = torch.argsort(distmat, dim=1).numpy()
indices = indices[0,:int(self.data_length * (1 + random.random()))].tolist()
# 从指定的序列中,随机的截取指定长度的片断
indices = random.sample(indices,self.data_length)
random.shuffle(indices)
feat_ = self.feats[indices] # batch, dim
id_ = self.ids[indices]
return feat_, id_
torch.sparse has no attribute softmax
Compared to Strong Baseline reranking result
File "/media/data4/qiujy/anaconda3/envs/pytorch/lib/python3.9/site-packages/ignite/engine/engine.py", line 291, in _handle_exception
raise e
File "/media/data4/qiujy/anaconda3/envs/pytorch/lib/python3.9/site-packages/ignite/engine/engine.py", line 272, in _run_once_on_dataset
self.state.output = self._process_function(self, batch)
File "/media/data4/qiujy/reid/NFormer/./engine/trainer.py", line 119, in _update
loss = nformer_loss_fn(score, feat, target)
File "/media/data4/qiujy/reid/NFormer/./layers/init.py", line 96, in loss_func
return xent(score, target) +
File "/media/data4/qiujy/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in call_impl
return forward_call(*input, **kwargs)
File "/media/data4/qiujy/reid/NFormer/./layers/triplet_loss.py", line 147, in forward
targets = torch.zeros(log_probs.size()).scatter(1, targets.unsqueeze(1).data.cpu(), 1)
RuntimeError: index 774 is out of bounds for dimension 1 with size 751
作者您好,关于NFormer模块,在你的论文中输入是一串特征向量,你的代码中的输入是batch*图片,可以解答一下为什么嘛
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.