GaitSet
GaitSet copied to clipboard
请教下识别单个行人轮廓序列的做法
请问下如果想要实现只识别某一个特定角度例如角度为90°的行人轮廓序列,在训练方面,只有单个角度和单个行走状态的25张以上样本序列,足够用来训练吗?(在训练好项目中73个人模型的前提下,进行微调)。如果可以,在训练完后,在识别分类方面,有25张以上的行人轮廓序列,应该修改哪些代码或者应该以什么方式实现单人识别。希望可以给一些建议,谢谢您~
当只传入一个人的步态序列的时候,修改num_rank=4,测试出来的结果全是100%,num_rank这参数的意义是分类识别结果的数量吗?如果要只识别一个人的,该怎么去做才是正确的做法?希望可以给点提示。谢谢您。
当只传入一个人的步态序列的时候,修改num_rank=4,测试出来的结果全是100%,num_rank这参数的意义是分类识别结果的数量吗?如果要只识别一个人的,该怎么去做才是正确的做法?希望可以给点提示。谢谢您。
I had the same confusion. I found it difficult to understand the code. Please let me know if you find the solution
@jcrazy1997 If I want to give one person's silhouettes then how should I check the accuracies whether that person has been re-identified? How should I create the directory for that person's silhouettes? Do I need to have all the views and walking conditions to be present in that directory? I tried by creating the separate directory and changed the directory name from dataset_path of my config.py file. But it is not accepting directories with the names after 124.
maybe,you can try to refer to model.transform to transform special person's silhouettes sequence and compare with other all person by each sequence features(you could get it by transforming person silhouettes, you may write some codes to do this) ,in this project ,it maybe will load all data set to torch.Dataset,you may read the code :model/utils/data_loader.py line:38 for detail of loading train data and test data order @prashant-bansod
@jcrazy1997 would you like to help me, I face this problem? Thank you.
(base) D:\Road.to.Sidang\Python\GaitRecog\Master2>python test.py
Initialzing...
Initializing data source...
Data initialization complete.
Initializing model...
Model initialization complete.
Loading the model of iteration 10000...
Transforming...
Evaluating...
Traceback (most recent call last):
File "test.py", line 44, in
你们实现单人的识别了吗,要改哪里的代码?怎么改。求指导,多谢!
请问你们实现单个行人的识别了吗?
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
没有,我们放弃了
837753035
[email protected]
签名由
网易邮箱大师
定制
在2020年2月27日 18:14,x710777335<[email protected]> 写道:
请问你们实现单个行人的识别了吗?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
楼主,请问你实现单个行人轮廓序列的识别了吗?
import os import cv2 import torch import torch.nn as nn import xarray as xr import numpy as np import os.path as osp from model.network import SetNet import torch.nn.functional as F import torch.autograd as autograd
resolution = 64 cut_padding = int(float(resolution)/64*10)
def ts2var(x): return autograd.Variable(x).cuda()
def np2var(x): return ts2var(torch.from_numpy(x))
def get_input(path): imgs = sorted(list(os.listdir(path))) frame_list = [np.reshape( cv2.imread(osp.join(path, _img_path)), [resolution, resolution, -1])[:, :, 0] for _img_path in imgs if osp.isfile(osp.join(path, _img_path))] num_list = list(range(len(frame_list))) data_dict = xr.DataArray( frame_list, coords={'frame': num_list}, dims=['frame', 'img_y', 'img_x'], ) data_dict = data_dict[:, :, cut_padding:-cut_padding].astype('float32') / 255.0 data_dict_values = np2var(data_dict.values).float() x = data_dict_values.unsqueeze(0) return x
flie_path = "CASIA-B/007/nm-01/000/" flie_path_same = "CASIA-B/007/nm-02/000/" flie_path_diff = "CASIA-B/060/nm-01/000/"
model_path = "work/checkpoint/GaitSet/GaitSet_CASIA-B_73_False_256_0.2_128_full_30-80000-encoder.ptm" encoder = SetNet(256).float().cuda() encoder = nn.DataParallel(encoder) encoder.load_state_dict(torch.load(model_path)) encoder.eval()
out,_ = encoder(get_input(flie_path)) out_same,_ = encoder(get_input(flie_path_same)) out_diff,_ = encoder(get_input(flie_path_diff)) distance = F.pairwise_distance(out, out_diff, p=2).mean() print(out.shape,distance) # 1x62x256 for GaitSet
The code above will generate single person's gait feature, thus comparing with other people.