Skip to content

Commit 41017b2

Browse files
committed
init with video preprocess
0 parents  commit 41017b2

File tree

173 files changed

+27849
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+27849
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gitignore
2+
archived
3+
datasets
4+
best_models
5+
outputs
6+
save_models

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/GaitFi_model.iml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Framework.jpg

242 KB
Loading

README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# GaitFi: Robust Device-Free Human Identification via WiFi and Vision Multimodal Learning [[link]](https://doi.org/10.48550/arXiv.2208.14326)
2+
3+
## Introduction
4+
As an important biomarker for human identification, human gait can be collected at a distance by passive sensors without subject cooperation, which plays an essential role in crime prevention, security detection and other human identification applications. At present, most research works are based on cameras and computer vision techniques to perform gait recognition. However, vision-based methods are not reliable when confronting poor illuminations, leading to degrading performances. In this paper, we propose a novel multimodal gait recognition method, namely GaitFi, which leverages WiFi signals and videos for human identification. In GaitFi, Channel State Information (CSI) that reflects the multi-path propagation of WiFi is collected to capture human gaits, while videos are captured by cameras. To learn robust gait information, we propose a Lightweight Residual Convolution Network (LRCN) as the backbone network, and further propose the two-stream GaitFi by integrating WiFi and vision features for the gait retrieval task. The GaitFi is trained by the triplet loss and classification loss on different levels of features. Extensive experiments are conducted in the real world, which demonstrates that the GaitFi outperforms state-of-the-art gait recognition methods based on single WiFi or camera, achieving 94.2\% for human identification tasks of 12 subjects.
5+
6+
![framework](Framework.jpg)
7+
8+
## Requirements
9+
10+
```
11+
scipy - 1.5.4
12+
numpy - 1.21.5
13+
torchvision - 0.11.2
14+
pytorch - 1.7.0
15+
```
16+
17+
18+
19+
## Training
20+
Train using vision modality only: `python train.py --input_type image`
21+
22+
Train using WiFi modality only: `python train.py --input_type mat`
23+
24+
Train using both vision and WiFi modality: `python train.py --input_type both`
25+
26+
## Testing
27+
Copy the model saved to save_models in training to best_models
28+
29+
Test using vision modality only: `python test.py --input_type image`
30+
31+
Test using WiFi modality only: `python test.py --input_type mat`
32+
33+
Test using WiFi modality only: `python test.py --input_type both`
34+
35+
36+
37+
## Model
38+
39+
The GaitFi has the following components:
40+
41+
- ***class*** **CNN** : LRCN block
42+
- ***class*** **RNN** : LSTM block
43+
- ***class*** **CRNN**: Fusion mechanism of WiFi and vision modalities
44+
45+
## Reference
46+
47+
```
48+
@ARTICLE{9887951,
49+
author={Deng, Lang and Yang, Jianfei and Yuan, Shenghai and Zou, Han and Lu, Chris Xiaoxuan and Xie, Lihua},
50+
journal={IEEE Internet of Things Journal},
51+
title={GaitFi: Robust Device-Free Human Identification via WiFi and Vision Multimodal Learning},
52+
year={2022},
53+
publisher={IEEE},
54+
doi={10.1109/JIOT.2022.3203559}}
55+
```

__pycache__/functions.cpython-310.pyc

5.18 KB
Binary file not shown.

__pycache__/functions.cpython-39.pyc

5.14 KB
Binary file not shown.

__pycache__/model.cpython-310.pyc

7.26 KB
Binary file not shown.

__pycache__/model.cpython-39.pyc

7.3 KB
Binary file not shown.

__pycache__/train.cpython-39.pyc

3.57 KB
Binary file not shown.
4.09 KB
Binary file not shown.
4.09 KB
Binary file not shown.

dataset_divider.py

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
"""
2+
分割数据集
3+
训练集和测试集比例为 8:2
4+
"""
5+
6+
import os
7+
import shutil
8+
from pathlib import Path
9+
10+
import numpy as np
11+
import pandas as pd
12+
13+
14+
def check_create_path(path):
15+
"""
16+
check and mkdir if not exist
17+
recursive
18+
"""
19+
if not os.path.exists(path):
20+
os.makedirs(path)
21+
22+
23+
def check_empty_dirs(path):
24+
"""
25+
check if the directory is empty
26+
recursive
27+
:return: True if empty
28+
"""
29+
for root, dirs, files in os.walk(path, topdown=False):
30+
if files:
31+
return False
32+
else:
33+
if dirs:
34+
for dir in dirs:
35+
if not check_empty_dirs(os.path.join(root, dir)):
36+
return False
37+
os.rmdir(root)
38+
return True
39+
40+
41+
# working: str = f'occlusion/board'
42+
# working: str = f'occlusion/cabinet'
43+
# working: str = f'occlusion/desk'
44+
working: str = f'light/dark'
45+
46+
47+
FILE = Path(__file__).resolve()
48+
ROOT = FILE.parents[0] # current directory
49+
50+
DATASETS = ROOT / 'datasets'
51+
RAW = DATASETS / 'raw' # ./datasets/raw
52+
WORKING = RAW / working # ./datasets/raw/occlusion/board
53+
OUTPUT = DATASETS / working # ./datasets/occlusion/board
54+
check_create_path(OUTPUT)
55+
56+
57+
def split(path):
58+
"""
59+
对每个模态、每个动作分别划分数据集和测试集
60+
"""
61+
for mod in os.listdir(path):
62+
MOD = path / mod
63+
64+
for label in os.listdir(MOD):
65+
LABEL = MOD / label # ./datasets/raw/occlusion/board/CSI/clap
66+
67+
train, test = split_train_test(LABEL) # pandas.DataFrame
68+
69+
TRAIN = OUTPUT / 'train' / mod / label # ./datasets/occlusion/board/train/CSI/clap
70+
TEST = OUTPUT / 'test' / mod / label # ./datasets/occlusion/board/test/CSI/clap
71+
check_create_path(TRAIN)
72+
check_create_path(TEST)
73+
74+
move_datasets(train, TRAIN)
75+
move_datasets(test, TEST)
76+
77+
78+
def move_datasets(files, path):
79+
"""
80+
:param files: pandas.DataFrame file list
81+
:param path: output path
82+
:return: None
83+
"""
84+
# print(files)
85+
# print(files.dtypes)
86+
# print(files[0])
87+
for file in files[0]:
88+
# print(file)
89+
shutil.move(file, path)
90+
91+
92+
def split_train_test(path, train_radio=0.8):
93+
FILES = os.listdir(path)
94+
FILES = [path / file for file in FILES]
95+
FILES = pd.DataFrame(FILES)
96+
97+
np.random.seed(42)
98+
shuffled_indices = np.random.permutation(len(FILES))
99+
train_set_size = int(len(FILES) * train_radio)
100+
train_indices = shuffled_indices[:train_set_size]
101+
test_indices = shuffled_indices[train_set_size:]
102+
103+
return FILES.iloc[train_indices], FILES.iloc[test_indices]
104+
105+
106+
if __name__ == '__main__':
107+
split(WORKING)
108+
if not check_empty_dirs(WORKING):
109+
print("Some files still in raw directory, check manually")

0 commit comments

Comments
 (0)