├── README.md └── di_gen.py /README.md: -------------------------------------------------------------------------------- 1 | # AnomalyNet 2 | * Joey Tianyi Zhou, Jiawei Du, Hongyuan Zhu, Xi Peng, Yong Liu, Rick Siow Mong Goh, AnomalyNet: An Anomaly Detection Network for Video Surveillance, IEEE Trans Information Forensics and Security (TIFS), vol: 14, no:10, 2537-2550, OCT., 2019. DOI: 10.1109/TIFS.2019.2900907. 3 | * Joey Tianyi Zhou, Kai Di, Jiawei Du, Xi Peng, et al., SC2Net: Sparse LSTMs for Sparse Coding, the 32th AAAI Conference on Artificial Intelligence (AAAI'18), New Orleans, Louisiana, 2-7 Feb., 2018. 4 | 5 | ### Requirement 6 | * numpy 1.10+ 7 | * matplotlib 1.8+ 8 | * tensorflow 1.0+ 9 | * python 2.7 10 | * scikit-learn 1.16+ 11 | 12 | 13 | ### Usage 14 | DI input for algorithm is generated by di_gen.py. 15 | The network traing is based on our previous project **[SC2Net](https://github.com/joeyzhouty/sc2net)**. 16 | 17 | 18 | If you feel this project helpful to your research, please cite the following paper 19 | ```bibtex 20 | @paper{AAAI1816822, 21 | author = {Joey Tianyi Zhou and Kai Di and Jiawei Du and Xi Peng and Hao Yang and Sinno Jialin Pan and Ivor Tsang and Yong Liu and Zheng Qin and Rick Siow Mong Goh}, 22 | title = {SC2Net: Sparse LSTMs for Sparse Coding}, 23 | conference = {AAAI Conference on Artificial Intelligence}, 24 | year = {2018}, 25 | keywords = {sparse representation; LSTM; RNN; model-based optimization}, 26 | url = {https://aaai.org/ocs/index.php/AAAI/AAAI18/paper/view/16822} 27 | } 28 | } 29 | ``` 30 | and 31 | ```bibtex 32 | @ARTICLE{8649753,  33 | author = {Joey Tianyi Zhou and Jiawei Du and Hongyuan Zhu and Xi Peng and Yong Liu and Rick Siow Mong Goh}, 34 | journal={IEEE Transactions on Information Forensics and Security},  35 | title={AnomalyNet: An Anomaly Detection Network for Video Surveillance},  36 | year={2019},  37 | volume={14},  38 | number={10},  39 | pages={2537-2550},  40 | doi={10.1109/TIFS.2019.2900907},  41 | ISSN={1556-6013},  42 | month={Oct},} 43 | ``` 44 | -------------------------------------------------------------------------------- /di_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """ 4 | approximate rank pooling 5 | 6 | input: X(image sequence for dynamic image): w*h*N 7 | output: DI_gray (uint8):w*h 8 | 9 | """ 10 | 11 | import numpy as np 12 | from PIL import Image 13 | 14 | ## test code 15 | X=np.zeros(shape=(480,640,20)) 16 | 17 | for im_index in range(20): 18 | img=Image.open('./data/'+'depth_'+'{:0>4d}'.format(im_index+140)+'.jpg') 19 | img=img.convert('L') 20 | X[:,:,im_index]=np.array(img) 21 | 22 | 23 | ## approximate rank pooling 24 | # input: X w*h*N image sequence 25 | im_shape=np.shape(X) 26 | N=im_shape[2] 27 | 28 | fw=np.zeros(shape=(1,1,N)) 29 | for x_index in range(N): 30 | fw[0,0,x_index]=2*(x_index+1)-N-1 31 | 32 | Y=np.multiply(X,fw) 33 | 34 | DI=np.zeros(shape=(im_shape[0],im_shape[1])) 35 | for y_index in range(N): 36 | tmp=Y[:,:,y_index] 37 | DI=DI+tmp 38 | 39 | pixel_max=np.max(DI) 40 | pixel_min=np.min(DI) 41 | 42 | DI_gray=(DI-pixel_min)/(pixel_max-pixel_min)*255. 43 | DI_gray=Image.fromarray(np.uint8(DI_gray)) 44 | DI_gray.show() 45 | --------------------------------------------------------------------------------