wangguanan / light-reid Goto Github PK
View Code? Open in Web Editor NEW[ECCV2020] a toolbox of light-reid learning for faster inference, speed both feature extraction and retrieval stages up to >30x
[ECCV2020] a toolbox of light-reid learning for faster inference, speed both feature extraction and retrieval stages up to >30x
Hi, thanks for your awesome work!
I found that there is a typo in line44 in loss.py. (def _label2similarity(**sekf**, label1, label2):
)
对特征的二值化编码,论文中写的是通过sgn(bn(Vk)),实际我看代码里用的tanh(),为什么这种简单的二值化编码方法相比于ABC在mAP上提升那么大。
给出的表格中的search per query是指的什么,和论文中的Q.Time是一个意思吗
ImportError: cannot import name 'read_json' from 'lightreid.utils' (../../lightreid/utils/init.py)
I noticed that the evaluation result using your code is different from the evaluation result using official code. Please use the attached scripts to reproduce this issue.
evaluation.zip
Hi @wangguanan , 非常感谢您的faster re-id工作,在理解论文的过程中,关于Distance Threshold Optimization算法有一些疑问:
expect a head in dict_keys(['bnhead', 'BNHead', 'CodePyramid', 'BottleClassifier']) but got SkeletonMultiHeads,请问如何解决?
I want to understand that “bagtricks_pca” and “occluded_reid” are trained according to the configured parameters, but they cannot reach the accuracy you posted. The results are still very different. I don’t know why this is.
the results:
“bagtricks_pca”:
+--------------+---------------------+---------------------+--------------------+--------------------+
| dataset | map | rank-1 | rank-5 | rank-10 |
+--------------+---------------------+---------------------+--------------------+--------------------+
| Market1501 | 0.17728540318946004 | 0.40498812351543945 | 0.5881828978622328 | 0.6591448931116389 |
| DukeMTMCreID | 0.6451677264561732 | 0.8074506283662477 | 0.9124775583482945 | 0.9340215439856373 |
+--------------+---------------------+---------------------+--------------------+--------------------+
“occluded_reid” with occludedreid_resnet50ibna_config
+--------------+--------------------+--------------------+--------------------+--------------------+
| dataset | map | rank-1 | rank-5 | rank-10 |
+--------------+--------------------+--------------------+--------------------+--------------------+
| OccludedReID | 0.5465391874335267 | 0.577 | 0.745 | 0.806 |
| PartialReID | 0.6881890106551225 | 0.7333333333333333 | 0.8566666666666667 | 0.9233333333333333 |
+--------------+--------------------+--------------------+--------------------+--------------------+
In the paper table2, why compare Hamming-distance+counting-sort with Euclidean-distance+quick-sort? If choose Euclidean-distance+count-sort, the difference between them will be much small.
@wangguanan Sorry for my inconvenience, but i need you to explain your code.
What is purpose of class Registry in the file registry.py
Thanks
lightreid.evaluation
mAP, CMC, ranktime, evaltime = CmcMapEvaluatorC2F(metric=metric, mode='inter-camera').compute(
TypeError: compute() got an unexpected keyword argument 'return_time'
There's no return_time in the compute() function in rank1b1 and rankc2f but engine uses the parameter. Plz fix it.
作者您好:
我想問我在使用bagtricks_buildwithconfigs時使用python train.py --config_file ./configs/base_config_duke_res19_lightmodel_lightfeat.yaml,由於我沒有pretrain的model我將light_model功能關閉,的時候會出現
home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
Traceback (most recent call last):
File "train.py", line 22, in <module>
solver.train(eval_freq=10)
File "../../lightreid/engine/engine.py", line 209, in train
self.eval(onebyone=False)
File "../../lightreid/engine/engine.py", line 273, in eval
query_feats, query_pids, query_camids = self.extract_feats(query_loader, time_meter=time_meter)
File "../../lightreid/engine/engine.py", line 426, in extract_feats
feats = self.model(imgs)
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "../../lightreid/models/architectures/base_arch.py", line 41, in forward
res = self.head(feats_vec, y)
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "../../lightreid/models/heads/code_pyramid.py", line 62, in forward
binary_codes = neck(feats, use_tanh=use_tanh)
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument 'use_tanh'
這是再有開啟clean engine之下,如果將clean engine關閉會出現
/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
Traceback (most recent call last):
File "train.py", line 19, in <module>
solver = lightreid.build_engine(config)
File "../../lightreid/build.py", line 50, in build_engine
**cfg.env, **cfg.lightreid)
File "../../lightreid/engine/engine.py", line 107, in __init__
self.model.enable_tanh()
File "/home/pp/anaconda3/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 576, in __getattr__
type(self).__name__, name))
AttributeError: 'BaseReIDModel' object has no attribute 'enable_tanh'
我在project之中找不到enable_tanh的function
如果將light model,light feat, light search關閉,則可以正常運作。
還請作者幫忙解答了,謝謝!
hi there,the accuracy of this model is very high.If I use your model as a baseline, it may be easier to reach SOTA.so, can i use your code as the baseline for my experiment?
Can I use your code/model in an open source plugin (MPL-2.0) for a commercial application (Video Management System)?
I read this: Note that our implementation uses no the center loss and re-ranking
Does this mean that this isn't using re-ranking. Also, do you have a pre-trained model I can test with?
Hi, Dr. Wang.
I make the config file base.yaml
light_search: True
but I meet the bug: TypeError: forward() got an unexpected keyword argument 'use_tanh'
it is In code_pyramid.py,
bn_feats, logits = neck(feats, use_tanh=use_tanh)
There is no use_tanh argument.How do I fix the bug or error? Thanks for your reply
Hi, thanks for your impressive work of Faster Person Re-Identification!
I would like to try training related models by myself, but could hardly find the training script or config files in this repository. Could you give me some advice?
在代码中看到蒸馏部分的loss主要是
class KLLoss:
'''KL Divergence'''
def __init__(self, t=4):
self.t = t
def __call__(self, logits_s, logits_t):
p_s = F.log_softmax(logits_s / self.t, dim=1)
p_t = F.softmax(logits_t / self.t, dim=1)
loss = F.kl_div(p_s, p_t, reduction='sum') * (self.t ** 2) / logits_s.shape[0]
return loss
请问关于这里的原理相应论文可以用来学习吗,感谢~
Hi, I am trying to train the model but the following error is appearing.
/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "main.py", line 134, in <module>
main(config)
File "main.py", line 14, in main
loaders = Loaders(config)
File "/home/zamra/PYreps/Person_ReId/Pytorch-Person-REID-Baseline-Bag-of-Tricks/core/data_loader/__init__.py", line 52, in __init__
self._load()
File "/home/zamra/PYreps/Person_ReId/Pytorch-Person-REID-Baseline-Bag-of-Tricks/core/data_loader/__init__.py", line 68, in _load
self.duke_query_samples, self.duke_gallery_samples = self._get_test_samples('duke_test')
File "/home/zamra/PYreps/Person_ReId/Pytorch-Person-REID-Baseline-Bag-of-Tricks/core/data_loader/__init__.py", line 93, in _get_test_samples
query_samples = Samples4Duke(query_data_path, reorder=False)
File "/home/zamra/PYreps/Person_ReId/Pytorch-Person-REID-Baseline-Bag-of-Tricks/core/data_loader/dataset.py", line 23, in __init__
samples = self._load_images_path(self.samples_path)
File "/home/zamra/PYreps/Person_ReId/Pytorch-Person-REID-Baseline-Bag-of-Tricks/core/data_loader/dataset.py", line 54, in _load_images_path
root_path, _, files_name = os_walk(folder_dir)
TypeError: 'NoneType' object is not iterable
请问有训练好的模型测试一下吗?
while I was checking the learning rate, some discrepancies were noticed from the original paper
`def get_lr(self):
current_epoch = self.last_epoch + 1
if current_epoch <= self.warmup_iters :
return [ base_lr / 10 * float(self.last_epoch + 1 ) / float(self.warmup_iters) for base_lr in self.base_lrs ]
elif current_epoch <= 40:
return [base_lr for base_lr in self.base_lrs ]
elif current_epoch <= 70:
return [base_lr / 10 for base_lr in self.base_lrs ]
elif current_epoch <= 120:
return [base_lr / 100 for base_lr in self.base_lrs ]
`
agw和stronger_baseline都不能运行呢
感谢您的工作,给我非常大的启发。但是我刚入门对一些知识还没有想明白,比如说您在论文中的Lpro distillation loss,
zk+1和zk应该是属于不同的长度的(k更长,k+1),为什么它可以用交叉熵损失来计算呢,一般情况下,比如我们的特征和最后的标签采用交叉熵损失计算一般都需要保持维度的相同,Lsim也是同样的道理不知道这里为什么可以直接计算,不是很明白,我看了您的代码应该在这部分
loss = torch.sum(prob2 * torch.log(mini + prob2 / (prob1 + mini)), 1) +
torch.sum(prob1 * torch.log(mini + prob1 / (prob2 + mini)), 1)
为啥可以直接相除,期待您的回复^^
Is it normal that the test phase takes a lot of time?
when i run main.py and download the dataset, it makes a PermissionError.
can you tell me how to fix it?
Hi. I have some questions about the implementation of the paper Faster Person Re-Identification.
1. In the paper you have mentioned the loss formulation:
I am wondering should the L_ce and L_tri be added on all the codes or just on the output of the main bnneck?
2. In the paper you have mentioned the loss formulation of self-distilation loss:
which use previous code outputs as soft labels to supervise latter code outputs. But in your code https://github.com/wangguanan/light-reid/blob/master/lightreid/losses/self_distill_loss.py#L27 , seems it's only using the first one as teacher. What's the difference here?
Looking forward to your feekback!
Hey, your eccv 2020 papaer is great! I want to try some ideas based on your work. I think there is an convinient way to reproduce the results of your paper. I, however, could not find it duo to some reason.
I also tried to modify this base config to reproduce your work by setting light_feat
and light_search
to True
. However, a lot of errors came. After I fixed some, more appeared. So I think maybe I didn't do it the right way.
Could you please help me by pointing out the right way to reproduce your eccv 2020 paper or telling me I need to reimplemente it from scratch? Thanks in advance.
feature dim的multiple指的是什么呢?
以及表格最后一列的搜索耗时是否使用了faiss?
Is there any reference for this project?
I have added the link into the official repo.
Why the function def _reorder_labels
in dataset.py
can realize reordering the label? It just traverses through the list samples
and changes the value of sample
, but does not do anything with the list samples
.
def _reorder_labels(self, samples, label_index): ids = [] for sample in samples: ids.append(sample[label_index]) # delete repetitive elments and order ids = list(set(ids)) ids.sort() # reorder for sample in samples: sample[label_index] = ids.index(sample[label_index]) return samples
I try to implement this repo, i get a error like this:
max_pool2d_with_indices_out_cuda_frame failed with error code 0
how to I fix that?
我在测试的时候发现从pytorch下载模型,这个模型是作什么用的?
运行python train.py --config_file ./configs/base_config_duke_res18_lightmodel.yaml时出错
在我完成base_config_duke_res50.yaml
的训练后,我想使用lightmodel
的方式蒸馏得到较好的res18
模型,我修改了base_config_duke_res18_lightmodel_lightfeat.yaml
中teacher_path
的路径后开始加载训练配置,出现如下的问题:
...
******************** light-reid settings ********************
light_model: True
light_feat: True
light_search: False
******************** light-reid settings ********************
[light_model was enabled] load teacher model from /home/rosy/MySpace/ReID/light-reid/results/duke/resnet50/lightmodel(False)-lightfeat(False)-lightsearch(False)/final_model.pth.tar
[light_model was enabled] add KLLoss for model distillation
[light_feat was enabled] model learn binary codes, and is evaluated with hamming distance
[light_feat was enabled] update eval_metric from cosine to hamming by setting self.eval_metric=hamming
[Feature Extraction] feature extraction time per batch (64) is 0.0305269001597199s
Traceback (most recent call last):
File "examples/bagtricks_buildwithconfigs/train.py", line 22, in <module>
solver.train(eval_freq=10)
File "./lightreid/engine/engine.py", line 219, in train
self.eval(onebyone=False)
File "./lightreid/engine/engine.py", line 290, in eval
mAP, CMC = self.evaluator.evaluate(
AttributeError: 'CleanEngine' object has no attribute 'evaluator'
我想问下是哪里出了问题。
我训练出res50(duke)的rank-1只有
0.8658
,mAP为0.76
,在仅仅使用bag的trick
的情况下,这个结果稍低于了我的预期,是我训练的方式有为题吗?
您好作者,
谢谢您的工作^^, 这里有个问题请教您,您的实验结果主要是在遮挡问题的描述, 您觉得在通用问题上用您的方式,可以又更好的模型性能吗?您做过相关实验吗?
Hi, author, thank you for your excellent work. I add some visualization code in the file "retrieval.py" to show the top 10 similar images with the query image by the method "evaluate". But I got the wrong result as the following picture. It seems something wrong with the pids of gallery images which are different from each other. To say, the labels are the same but not the correct ones, so I think the labeling process or the "evaluate" method are not right.
Hi, I've found that DTO requires query and gallery pids as inputs (code here). Does it mean that DTO is using ground truth during evaluation? (which could be an unfair comparison against other methods).
Dear @wangguanan
Thanks for sharing your work.
I have tried to download the Wildtrack dataset. When I crop person images using the information provided in the annotation_positions, I see boxes are not fitted to persons.
How do you get the WildTrackCrop? Could you share me via Googledrive?
when finish training, there is a error in eval function.
how to solve it?
Traceback (most recent call last):
File "main.py", line 60, in
solver.eval(onebyone=True)
File "../../lightreid/engine/engine.py", line 277, in eval
mAP, CMC, ranktime, evaltime = CmcMapEvaluator1b1(metric=metric, mode='inter-camera').compute(
File "../../lightreid/evaluations/rank/rank_1b1.py", line 45, in init
progressbar.SimpleProgress(format='%(value_s)s/%(max_value_s)s'),
TypeError: init() got an unexpected keyword argument 'format'
Hi, thanks for your work. I have a question.
Are some pre-trained models available or will be available soon ?
Traceback (most recent call last):
File "examples/stronger_baseline/main.py", line 77, in
margin=0.35))
File "/dahuafs/userdata/233540/workdir/light-reid/lightreid/models/heads/bn_head.py", line 49, in init
classifier['in_dim'] = in_dim if middle_dim is None else middle_dim
TypeError: 'Circle' object does not support item assignment
期待您的回复!
Hello. Is it possible to get the pretrained models somehow?
您好,我使用您的代码训练自己数据进行训练时增加了类别,但对应的推理时间也程近似的线性增加,而且推理时间增加在backbone的推理过程,请问下是什么原因呢?能否有解决的方法?
执行CUDA_VISIBLE_DEVICES=1 python main.py --dataset dukemtmcreid --results_dir ./results/dukemtmcreid/ --lightfeat True --lightsearch True报错:
Traceback (most recent call last):
File "main.py", line 46, in
light_model=args.lightmodel, light_feat=args.lightfeat, light_search=args.lightsearch)
File "../../lightreid/engine/engine.py", line 106, in init
self.model.enable_tanh()
File "/environment/python/versions/miniconda3-4.7.12/envs/lightreid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in getattr
type(self).name, name))
torch.nn.modules.module.ModuleAttributeError: 'BaseReIDModel' object has no attribute 'enable_tanh'
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.