├── experiments ├── logs │ └── readme.txt └── scripts │ ├── ucf_test_pretrained.sh │ ├── ucsd_test_pretrained.sh │ ├── trancos_test_pretrained.sh │ ├── ucsd_train_test.sh │ ├── ucf_train_test.sh │ └── trancos_train_test.sh ├── genfiles ├── features │ └── README.TXT ├── output_models │ ├── trancos │ │ ├── ccnn │ │ │ └── README.TXT │ │ ├── hydra2 │ │ │ └── README.TXT │ │ ├── hydra3 │ │ │ └── README.TXT │ │ └── hydra4 │ │ │ └── README.TXT │ ├── ucf │ │ ├── ccnn │ │ │ └── README.TXT │ │ ├── hydra2 │ │ │ └── README.TXT │ │ └── hydra3 │ │ │ └── README.TXT │ └── ucsd │ │ ├── ccnn │ │ └── README.TXT │ │ ├── hydra2 │ │ └── README.TXT │ │ ├── hydra3 │ │ └── README.TXT │ │ └── hydra4 │ │ └── README.TXT └── results │ └── README.TXT ├── models ├── pretrained_models │ └── README.txt ├── ucf │ ├── ccnn │ │ ├── ccnn_solver.prototxt │ │ ├── ccnn_ucf_set_0_cfg.yml │ │ ├── ccnn_ucf_set_1_cfg.yml │ │ ├── ccnn_ucf_set_2_cfg.yml │ │ ├── ccnn_ucf_set_3_cfg.yml │ │ ├── ccnn_ucf_set_4_cfg.yml │ │ ├── ccnn_deploy.prototxt │ │ └── ccnn_train_val.prototxt │ ├── hydra2 │ │ ├── hydra2_solver.prototxt │ │ ├── hydra2_ucf_set_0_cfg.yml │ │ ├── hydra2_ucf_set_1_cfg.yml │ │ ├── hydra2_ucf_set_2_cfg.yml │ │ ├── hydra2_ucf_set_3_cfg.yml │ │ ├── hydra2_ucf_set_4_cfg.yml │ │ └── hydra2_deploy.prototxt │ └── hydra3 │ │ ├── hydra3_solver.prototxt │ │ ├── hydra3_ucf_set_0_cfg.yml │ │ ├── hydra3_ucf_set_1_cfg.yml │ │ ├── hydra3_ucf_set_2_cfg.yml │ │ ├── hydra3_ucf_set_3_cfg.yml │ │ └── hydra3_ucf_set_4_cfg.yml ├── trancos │ ├── ccnn │ │ ├── ccnn_solver.prototxt │ │ ├── ccnn_trancos_cfg.yml │ │ ├── ccnn_deploy.prototxt │ │ └── ccnn_train_val.prototxt │ ├── hydra2 │ │ ├── hydra2_solver.prototxt │ │ ├── hydra2_trancos_cfg.yml │ │ └── hydra2_deploy.prototxt │ ├── hydra3 │ │ ├── hydra3_solver.prototxt │ │ └── hydra3_trancos_cfg.yml │ └── hydra4 │ │ ├── hydra4_solver.prototxt │ │ └── hydra4_trancos_cfg.yml └── ucsd │ ├── ccnn │ ├── ccnn_max_solver.prototxt │ ├── ccnn_min_solver.prototxt │ ├── ccnn_up_solver.prototxt │ ├── ccnn_down_solver.prototxt │ ├── ccnn_ucsd_cfg.yml │ ├── ccnn_deploy.prototxt │ ├── ccnn_down_train_val.prototxt │ ├── ccnn_max_train_val.prototxt │ ├── ccnn_min_train_val.prototxt │ └── ccnn_up_train_val.prototxt │ ├── hydra2 │ ├── hydra2_up_solver.prototxt │ ├── hydra2_down_solver.prototxt │ ├── hydra2_max_solver.prototxt │ ├── hydra2_min_solver.prototxt │ ├── hydra2_ucsd_cfg.yml │ ├── hydra2_deploy.prototxt │ ├── hydra2_max_train_val.prototxt │ ├── hydra2_up_train_val.prototxt │ ├── hydra2_down_train_val.prototxt │ └── hydra2_min_train_val.prototxt │ └── hydra3 │ ├── hydra3_up_solver.prototxt │ ├── hydra3_down_solver.prototxt │ ├── hydra3_max_solver.prototxt │ ├── hydra3_min_solver.prototxt │ └── hydra3_ucsd_cfg.yml ├── data └── readme.txt ├── tools ├── ucf_order.txt ├── get_trancos_model.md ├── demo.sh ├── get_ucf.sh ├── get_all_ucf_models.md ├── get_ucsd.sh ├── get_all_trancos_models.md ├── gen_ucf_results.py ├── gen_ucsd_extranotation.py ├── get_all_ucsd_models.md ├── gen_ucf_dataset.py ├── gen_ucf_dotmaps.py ├── gen_ucsd_dotmaps.py └── gen_ucsd_dataset.py ├── README.md └── src └── utils.py /experiments/logs/readme.txt: -------------------------------------------------------------------------------- 1 | Folder where to store logs. 2 | -------------------------------------------------------------------------------- /genfiles/features/README.TXT: -------------------------------------------------------------------------------- 1 | Generated features directory. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/trancos/ccnn/README.TXT: -------------------------------------------------------------------------------- 1 | CCNN models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucf/ccnn/README.TXT: -------------------------------------------------------------------------------- 1 | CCNN models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucsd/ccnn/README.TXT: -------------------------------------------------------------------------------- 1 | CCNN models. 2 | -------------------------------------------------------------------------------- /genfiles/results/README.TXT: -------------------------------------------------------------------------------- 1 | Place where to store results. 2 | -------------------------------------------------------------------------------- /models/pretrained_models/README.txt: -------------------------------------------------------------------------------- 1 | Paper models go here. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucf/hydra2/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 2s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucf/hydra3/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 3s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucsd/hydra2/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 2s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucsd/hydra3/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 3s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/ucsd/hydra4/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 4s models. 2 | -------------------------------------------------------------------------------- /data/readme.txt: -------------------------------------------------------------------------------- 1 | TRANCOS, UCSD or UCF datasets will be placed here. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/trancos/hydra2/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 2s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/trancos/hydra3/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 3s models. 2 | -------------------------------------------------------------------------------- /genfiles/output_models/trancos/hydra4/README.TXT: -------------------------------------------------------------------------------- 1 | Hydra 4s models. 2 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucf/ccnn/ccnn_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/ucf/ccnn/ccnn_ucf" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucf/ccnn/hydra2_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucf/ccnn/hydra2_ucf" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucf/ccnn/hydra3_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucf/ccnn/hydra3_ucf" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/trancos/ccnn/ccnn_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/trancos/ccnn/ccnn_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/trancos/ccnn/ccnn_trancos" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_max_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/ccnn/ccnn_max_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/ucsd/ccnn/ccnn_ucsd_max" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_min_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/ccnn/ccnn_min_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/ucsd/ccnn/ccnn_ucsd_min" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_up_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/ccnn/ccnn_up_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/ucsd/ccnn/ccnn_ucsd_min" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_down_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/ccnn/ccnn_down_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 50000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 50000 14 | snapshot_prefix: "genfiles/output_models/ucsd/ccnn/ccnn_ucsd_down" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_up_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra2/hydra2_up_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra2/hydra2_ucsd_up" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra3/hydra3_up_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra3/hydra3_up_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra3/hydra3_ucsd_up" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/trancos/hydra2/hydra2_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/trancos/hydra2/hydra2_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 30000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 30000 14 | snapshot_prefix: "genfiles/output_models/trancos/hydra2/hydra2_trancos" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/trancos/hydra3/hydra3_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/trancos/hydra3/hydra3_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 30000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 30000 14 | snapshot_prefix: "genfiles/output_models/trancos/hydra3/hydra3_trancos" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/trancos/hydra4/hydra4_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/trancos/hydra4/hydra4_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 30000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 30000 14 | snapshot_prefix: "genfiles/output_models/trancos/hydra4/hydra4_trancos" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_down_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra2/hydra2_down_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra2/hydra2_ucsd_down" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_max_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra2/hydra2_max_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra2/hydra2_ucsd_max" 15 | solver_mode: CPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_min_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra2/hydra2_min_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra2/hydra2_ucsd_min" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra3/hydra3_down_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra3/hydra3_down_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra3/hydra3_ucsd_down" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra3/hydra3_max_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra3/hydra3_down_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra3/hydra3_ucsd_max" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /models/ucsd/hydra3/hydra3_min_solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "models/ucsd/hydra3/hydra3_min_train_val.prototxt" 2 | test_iter: 100 3 | test_interval: 500 4 | base_lr: 0.0001 5 | lr_policy: "inv" 6 | power: 0.75 7 | gamma: 0.001 8 | stepsize: 1000 9 | display: 20 10 | max_iter: 25000 11 | momentum: 0.9 12 | weight_decay: 0.001 13 | snapshot: 25000 14 | snapshot_prefix: "genfiles/output_models/ucsd/hydra3/hydra3_ucsd_min" 15 | solver_mode: GPU 16 | -------------------------------------------------------------------------------- /tools/ucf_order.txt: -------------------------------------------------------------------------------- 1 | 37.jpg 2 | 48.jpg 3 | 29.jpg 4 | 10.jpg 5 | 14.jpg 6 | 1.jpg 7 | 45.jpg 8 | 47.jpg 9 | 40.jpg 10 | 24.jpg 11 | 25.jpg 12 | 49.jpg 13 | 18.jpg 14 | 13.jpg 15 | 28.jpg 16 | 34.jpg 17 | 17.jpg 18 | 3.jpg 19 | 26.jpg 20 | 15.jpg 21 | 31.jpg 22 | 6.jpg 23 | 33.jpg 24 | 2.jpg 25 | 30.jpg 26 | 36.jpg 27 | 42.jpg 28 | 20.jpg 29 | 38.jpg 30 | 11.jpg 31 | 5.jpg 32 | 7.jpg 33 | 4.jpg 34 | 21.jpg 35 | 27.jpg 36 | 39.jpg 37 | 22.jpg 38 | 43.jpg 39 | 32.jpg 40 | 35.jpg 41 | 8.jpg 42 | 50.jpg 43 | 12.jpg 44 | 19.jpg 45 | 44.jpg 46 | 23.jpg 47 | 9.jpg 48 | 46.jpg 49 | 16.jpg 50 | 41.jpg 51 | -------------------------------------------------------------------------------- /tools/get_trancos_model.md: -------------------------------------------------------------------------------- 1 | # Instructions to obtain TRANCOS models 2 | 1. Download the pre-trained models using the TRANCOS dataset. 3 | [Direct link](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/ERdcsUU57ZFCk28lbmG16WsBDWiU71yRwgJd0kpX-RmM8g?&Download=1) 4 | 5 | 2. Untar 6 | `tar -zxvf trancos_ccnn.caffemodel.tar.gz` 7 | 8 | 3. Create the needed directory and the move file with the pre-trained model on it. 9 | ``` 10 | mkdir models/pretrained_models/trancos/ccnn 11 | mv trancos_ccnn.caffemodel models/pretrained_models/trancos/ccnn 12 | ``` 13 | 14 | 4. Clean 15 | `rm trancos_ccnn.caffemodel.tar.gz` 16 | -------------------------------------------------------------------------------- /tools/demo.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | 4 | export PYTHONUNBUFFERED="True" 5 | 6 | # Parameters 7 | GPU_DEV=0 8 | CONFIG_FILE=models/trancos/ccnn/ccnn_trancos_cfg.yml 9 | CAFFE_MODEL=models/pretrained_models/trancos/ccnn/trancos_ccnn.caffemodel 10 | DEPLOY=models/trancos/ccnn/ccnn_deploy.prototxt 11 | 12 | LOG="experiments/logs/trancos_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 13 | exec &> >(tee -a "$LOG") 14 | echo Logging output to "$LOG" 15 | 16 | # Time the task 17 | T="$(date +%s)" 18 | 19 | # Test Net 20 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL} --cfg ${CONFIG_FILE} 21 | 22 | T="$(($(date +%s)-T))" 23 | echo "Time in seconds: ${T}" 24 | -------------------------------------------------------------------------------- /tools/get_ucf.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Download dataset 4 | wget --no-check-certificate https://www.crcv.ucf.edu/data/ucf-cc-50/UCFCrowdCountingDataset_CVPR13.rar 5 | 6 | # Extract 7 | mkdir UCFCrowdCountingDataset_CVPR13 8 | rar e UCFCrowdCountingDataset_CVPR13.rar UCFCrowdCountingDataset_CVPR13 9 | 10 | # Build Directory tree 11 | mkdir data/UCF 12 | mkdir data/UCF/images 13 | mkdir data/UCF/image_sets 14 | mkdir data/UCF/params 15 | 16 | # Move annnotated images 17 | mv UCFCrowdCountingDataset_CVPR13/*.jpg data/UCF/images 18 | mv UCFCrowdCountingDataset_CVPR13/*.mat data/UCF/params 19 | 20 | # Create dot maps 21 | python tools/gen_ucf_dotmaps.py --notationdir data/UCF/params --imdir data/UCF/images 22 | 23 | # Create datasets 24 | python tools/gen_ucf_dataset.py --orderfile tools/ucf_order.txt --setsfolder data/UCF/image_sets 25 | 26 | # Clean 27 | rm UCFCrowdCountingDataset_CVPR13.rar 28 | rm -fr UCFCrowdCountingDataset_CVPR13 29 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_ucf_set_0_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_0.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_0.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucf_set_0' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_ucf_set_1_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_1.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_1.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucf_set_1' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_ucf_set_2_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_2.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_2.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucf_set_2' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_ucf_set_3_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_3.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_3.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucf_set_3' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_ucf_set_4_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_4.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_4.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucf_set_4' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_ucf_set_0_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_0.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_0.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucf_set_0' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_ucf_set_1_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_1.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_1.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucf_set_1' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_ucf_set_2_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_2.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_2.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucf_set_2' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_ucf_set_3_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_3.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_3.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucf_set_3' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_ucf_set_4_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_4.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_4.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucf_set_4' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_ucf_set_0_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_0.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_0.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucf_set_0' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_ucf_set_1_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_1.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_1.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucf_set_1' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_ucf_set_2_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_2.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_2.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucf_set_2' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_ucf_set_3_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_3.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_3.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucf_set_3' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucf/hydra3/hydra3_ucf_set_4_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCF' 2 | UCF: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: '' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 151 # Base patch side 10 | NR: 1200 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: False 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: 800 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCF/images/' 20 | TRAINING_LIST: '' 21 | VALIDATION_LIST: '' 22 | TRAINVAL_LIST: 'data/UCF/image_sets/train_set_4.txt' 23 | TEST_LIST: 'data/UCF/image_sets/test_set_4.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/UCF_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: '' 28 | VAL_FEAT_LIST: '' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucf_set_4' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/trancos/ccnn/ccnn_trancos_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'TRANCOS' 2 | TRANCOS: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'mask.mat' 6 | COLOR: True 7 | 8 | # Feature extraction params 9 | PW: 115 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/TRANCOS/images/' 20 | TRAINING_LIST: 'data/TRANCOS/image_sets/training.txt' 21 | VALIDATION_LIST: 'data/TRANCOS/image_sets/validation.txt' 22 | TRAINVAL_LIST: 'data/TRANCOS/image_sets/trainval.txt' 23 | TEST_LIST: 'data/TRANCOS/image_sets/test.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/trancos_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train.txt' 27 | VAL_FEAT: 'genfiles/features/trancos_val_feat_' 28 | VAL_FEAT_LIST: 'genfiles/features/test.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_trancos' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/trancos/hydra2/hydra2_trancos_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'TRANCOS' 2 | TRANCOS: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'mask.mat' 6 | COLOR: True 7 | 8 | # Feature extraction params 9 | PW: 115 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/TRANCOS/images/' 20 | TRAINING_LIST: 'data/TRANCOS/image_sets/training.txt' 21 | VALIDATION_LIST: 'data/TRANCOS/image_sets/validation.txt' 22 | TRAINVAL_LIST: 'data/TRANCOS/image_sets/trainval.txt' 23 | TEST_LIST: 'data/TRANCOS/image_sets/test.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/trancos_train_feat_2s_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train_hydra_2s.txt' 27 | VAL_FEAT: 'genfiles/features/trancos_val_feat_2s_' 28 | VAL_FEAT_LIST: 'genfiles/features/test_hydra_2s.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_trancos' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/trancos/hydra3/hydra3_trancos_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'TRANCOS' 2 | TRANCOS: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'mask.mat' 6 | COLOR: True 7 | 8 | # Feature extraction params 9 | PW: 115 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/TRANCOS/images/' 20 | TRAINING_LIST: 'data/TRANCOS/image_sets/training.txt' 21 | VALIDATION_LIST: 'data/TRANCOS/image_sets/validation.txt' 22 | TRAINVAL_LIST: 'data/TRANCOS/image_sets/trainval.txt' 23 | TEST_LIST: 'data/TRANCOS/image_sets/test.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/trancos_train_feat_3s_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train_hydra_3s.txt' 27 | VAL_FEAT: 'genfiles/features/trancos_val_feat_3s_' 28 | VAL_FEAT_LIST: 'genfiles/features/test_hydra_3s.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_trancos' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/trancos/hydra4/hydra4_trancos_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'TRANCOS' 2 | TRANCOS: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'mask.mat' 6 | COLOR: True 7 | 8 | # Feature extraction params 9 | PW: 115 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 15.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: False 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/TRANCOS/images/' 20 | TRAINING_LIST: 'data/TRANCOS/image_sets/training.txt' 21 | VALIDATION_LIST: 'data/TRANCOS/image_sets/validation.txt' 22 | TRAINVAL_LIST: 'data/TRANCOS/image_sets/trainval.txt' 23 | TEST_LIST: 'data/TRANCOS/image_sets/test.txt' 24 | PERSPECTIVE_MAP: '' 25 | TRAIN_FEAT: 'genfiles/features/trancos_train_feat_4s_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/train_hydra_4s.txt' 27 | VAL_FEAT: 'genfiles/features/trancos_val_feat_4s_' 28 | VAL_FEAT_LIST: 'genfiles/features/test_hydra_4s.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_4s_trancos' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 4 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_ucsd_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCSD' 2 | UCSD: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'data/UCSD/params/ucsd_mask.h5' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 73 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 8.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: True 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCSD/images/' 20 | TRAINING_LIST: 'data/UCSD/image_sets/training_maximal.txt' 21 | VALIDATION_LIST: 'data/UCSD/image_sets/training_maximal.txt' 22 | TRAINVAL_LIST: 'data/UCSD/image_sets/training_maximal.txt' 23 | TEST_LIST: 'data/UCSD/image_sets/testing_maximal.txt' 24 | PERSPECTIVE_MAP: 'data/UCSD/params/ucsd_pmap_min_norm.h5' 25 | TRAIN_FEAT: 'genfiles/features/UCSD_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/max_train.txt' 27 | VAL_FEAT: 'genfiles/features/UCSD_val_feat_' 28 | VAL_FEAT_LIST: 'genfiles/features/test.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/ccnn_ucsd_max' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 1 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_ucsd_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCSD' 2 | UCSD: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'data/UCSD/params/ucsd_mask.h5' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 73 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 8.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: True 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCSD/images/' 20 | TRAINING_LIST: 'data/UCSD/image_sets/training_maximal.txt' 21 | VALIDATION_LIST: 'data/UCSD/image_sets/training_maximal.txt' 22 | TRAINVAL_LIST: 'data/UCSD/image_sets/training_maximal.txt' 23 | TEST_LIST: 'data/UCSD/image_sets/testing_maximal.txt' 24 | PERSPECTIVE_MAP: 'data/UCSD/params/ucsd_pmap_min_norm.h5' 25 | TRAIN_FEAT: 'genfiles/features/UCSD_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/max_train.txt' 27 | VAL_FEAT: 'genfiles/features/UCSD_val_feat_' 28 | VAL_FEAT_LIST: 'genfiles/features/test.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_2s_ucsd_max' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 2 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /models/ucsd/hydra3/hydra3_ucsd_cfg.yml: -------------------------------------------------------------------------------- 1 | DATASET: 'UCSD' 2 | UCSD: 3 | # Database params 4 | DOT_ENDING: 'dots.png' 5 | MASK_FILE: 'data/UCSD/params/ucsd_mask.h5' 6 | COLOR: False 7 | 8 | # Feature extraction params 9 | PW: 73 # Base patch side 10 | NR: 800 # < 1 = dense extraction 11 | SIG: 8.0 12 | SPLIT: 15 # Create a new file every X images 13 | USE_MASK: True 14 | FLIP: True 15 | USE_PERSPECTIVE: True 16 | RESIZE: -1 # Disabled 17 | 18 | # Paths and others 19 | IM_FOLDER: 'data/UCSD/images/' 20 | TRAINING_LIST: 'data/UCSD/image_sets/training_maximal.txt' 21 | VALIDATION_LIST: 'data/UCSD/image_sets/training_maximal.txt' 22 | TRAINVAL_LIST: 'data/UCSD/image_sets/training_maximal.txt' 23 | TEST_LIST: 'data/UCSD/image_sets/testing_maximal.txt' 24 | PERSPECTIVE_MAP: 'data/UCSD/params/ucsd_pmap_min_norm.h5' 25 | TRAIN_FEAT: 'genfiles/features/UCSD_train_feat_' 26 | TRAIN_FEAT_LIST: 'genfiles/features/max_train.txt' 27 | VAL_FEAT: 'genfiles/features/UCSD_val_feat_' 28 | VAL_FEAT_LIST: 'genfiles/features/test.txt' 29 | RESULTS_OUTPUT: 'genfiles/results/hydra_3s_ucsd_max' 30 | 31 | # CNN model params 32 | CNN_PW_IN: 72 # CNN patch width in 33 | CNN_PW_OUT: 18 # CNN patch width out 34 | N_SCALES: 3 # HYDRA number of heads 35 | -------------------------------------------------------------------------------- /experiments/scripts/ucf_test_pretrained.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Usage: 4 | # ./experiments/scripts/_train_net.sh GPU_ID 5 | 6 | export PYTHONUNBUFFERED="True" 7 | 8 | # Parameters 9 | GPU_DEV=0 10 | 11 | # Parameters, uncomment one of the following set of parameters 12 | # CCNN 13 | CONFIG_FILE=models/ucf/ccnn/ccnn_ucf_set_ 14 | CAFFE_MODEL=models/pretrained_models/ucf/ccnn/ucf_ccnn 15 | DEPLOY=models/ucf/ccnn/ccnn_deploy.prototxt 16 | 17 | # HYDRA 2s 18 | #CONFIG_FILE=models/ucf/hydra2/hydra2_ucf_set_ 19 | #CAFFE_MODEL=models/pretrained_models/ucf/hydra2/ucf_hydra2 20 | #DEPLOY=models/ucf/hydra2/hydra2_deploy.prototxt 21 | 22 | # HYDRA 3s 23 | #CONFIG_FILE=models/ucf/hydra3/hydra3_ucf_set_ 24 | #CAFFE_MODEL=models/pretrained_models/ucf/hydra3/ucf_hydra3 25 | #DEPLOY=models/ucf/hydra3/hydra3_deploy.prototxt 26 | 27 | LOG="experiments/logs/ucf_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 28 | exec &> >(tee -a "$LOG") 29 | echo Logging output to "$LOG" 30 | 31 | # Time the task 32 | T="$(date +%s)" 33 | 34 | for IX in 0 1 2 3 4 35 | do 36 | # Test Net 37 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL}_${IX}.caffemodel --cfg ${CONFIG_FILE}${IX}_cfg.yml 38 | done 39 | 40 | # Print MAE and MSD 41 | python tools/gen_ucf_results.py --results genfiles/results/ccnn_ucf_set_ 42 | 43 | T="$(($(date +%s)-T))" 44 | echo "Time in seconds: ${T}" 45 | -------------------------------------------------------------------------------- /experiments/scripts/ucsd_test_pretrained.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Usage: 4 | # ./experiments/scripts/ucsd_train_net.sh GPU_ID 5 | 6 | export PYTHONUNBUFFERED="True" 7 | 8 | # Parameters 9 | GPU_DEV=0 10 | 11 | # Parameters, uncomment one of the following set of parameters 12 | # CCNN 13 | CONFIG_FILE=models/ucsd/ccnn/ccnn_ucsd_cfg.yml 14 | CAFFE_MODEL=models/pretrained_models/ucsd/ccnn/ucsd_ccnn_max.caffemodel 15 | DEPLOY=models/ucsd/ccnn/ccnn_deploy.prototxt # Modify it to choose another dataset 16 | 17 | # HYDRA 2s 18 | #CONFIG_FILE=models/ucsd/hydra2/hydra2_ucsd_cfg.yml 19 | #CAFFE_MODEL=models/pretrained_models/ucsd/hydra2/ucsd_hydra2_max.caffemodel 20 | #DEPLOY=models/ucsd/hydra2/hydra2_deploy.prototxt # Modify it to choose another dataset 21 | 22 | # HYDRA 3s 23 | #CONFIG_FILE=models/ucsd/hydra3/hydra3_ucsd_cfg.yml 24 | #CAFFE_MODEL=models/pretrained_models/ucsd/hydra3/ucsd_hydra3_max.caffemodel 25 | #DEPLOY=models/ucsd/hydra3/hydra3_deploy.prototxt # Modify it to choose another dataset 26 | 27 | LOG="experiments/logs/ucsd_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 28 | exec &> >(tee -a "$LOG") 29 | echo Logging output to "$LOG" 30 | 31 | # Time the task 32 | T="$(date +%s)" 33 | 34 | # Test Net 35 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL} --cfg ${CONFIG_FILE} 36 | 37 | T="$(($(date +%s)-T))" 38 | echo "Time in seconds: ${T}" 39 | -------------------------------------------------------------------------------- /experiments/scripts/trancos_test_pretrained.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PYTHONUNBUFFERED="True" 4 | 5 | # Parameters, uncomment one of the following set of parameters 6 | GPU_DEV=0 7 | # CCNN 8 | CONFIG_FILE=models/trancos/ccnn/ccnn_trancos_cfg.yml 9 | CAFFE_MODEL=models/pretrained_models/trancos/ccnn/trancos_ccnn.caffemodel 10 | DEPLOY=models/trancos/ccnn/ccnn_deploy.prototxt 11 | 12 | # HYDRA 2s 13 | #CONFIG_FILE=models/trancos/hydra2/hydra2_trancos_cfg.yml 14 | #CAFFE_MODEL=models/pretrained_models/trancos/hydra2/trancos_hydra2.caffemodel 15 | #DEPLOY=models/trancos/hydra2/hydra2_deploy.prototxt 16 | 17 | # HYDRA 3s 18 | #CONFIG_FILE=models/trancos/hydra3/hydra3_trancos_cfg.yml 19 | #CAFFE_MODEL=models/pretrained_models/trancos/hydra3/trancos_hydra3.caffemodel 20 | #DEPLOY=models/trancos/hydra3/hydra3_deploy.prototxt 21 | 22 | # HYDRA 4s 23 | #CONFIG_FILE=models/trancos/hydra4/hydra4_trancos_cfg.yml 24 | #CAFFE_MODEL=models/pretrained_models/trancos/hydra4/trancos_hydra4.caffemodel 25 | #DEPLOY=models/trancos/hydra4/hydra4_deploy.prototxt 26 | 27 | LOG="experiments/logs/trancos_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 28 | exec &> >(tee -a "$LOG") 29 | echo Logging output to "$LOG" 30 | 31 | # Time the task 32 | T="$(date +%s)" 33 | 34 | # Test Net 35 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL} --cfg ${CONFIG_FILE} 36 | 37 | T="$(($(date +%s)-T))" 38 | echo "Time in seconds: ${T}" 39 | -------------------------------------------------------------------------------- /tools/get_all_ucf_models.md: -------------------------------------------------------------------------------- 1 | # Download all the pretrained models using the UCF dataset 2 | 3 | Follow these instructions: 4 | 5 | 1. Download all the models in [this fhared folder](https://universidaddealcala-my.sharepoint.com/:f:/g/personal/gram_uah_es/EkrXzZVeEqZKpiN7GtZNP6EBfYOACzFsTyY6rehtwiwatQ?e=SskaLd). 6 | 2. Create the following dirs 7 | 8 | ``` 9 | mkdir models/pretrained_models/ucf 10 | mkdir models/pretrained_models/ucf/ccnn 11 | mkdir models/pretrained_models/ucf/hydra2 12 | mkdir models/pretrained_models/ucf/hydra3 13 | ``` 14 | 3. Organize the files (untar the files, move and clean) 15 | ``` 16 | for FOLD_NUM in 0 1 2 3 4 17 | do 18 | # Form tar files names 19 | CCNN_TAR=ucf_ccnn_${FOLD_NUM}.caffemodel.tar.gz 20 | CCNN_MODEL=ucf_ccnn_${FOLD_NUM}.caffemodel 21 | HYDRA2_TAR=ucf_hydra2_${FOLD_NUM}.caffemodel.tar.gz 22 | HYDRA2_MODEL=ucf_hydra2_${FOLD_NUM}.caffemodel 23 | HYDRA3_TAR=ucf_hydra3_${FOLD_NUM}.caffemodel.tar.gz 24 | HYDRA3_MODEL=ucf_hydra3_${FOLD_NUM}.caffemodel 25 | 26 | #CCNN models 27 | tar -zxvf ${CCNN_TAR} 28 | mv ${CCNN_MODEL} models/pretrained_models/ucf/ccnn 29 | rm ${CCNN_TAR} 30 | 31 | #Hydra2 models 32 | tar -zxvf ${HYDRA2_TAR} 33 | mv ${HYDRA2_MODEL} models/pretrained_models/ucf/hydra2 34 | rm ${HYDRA2_TAR} 35 | 36 | #Hydra3 models 37 | tar -zxvf ${HYDRA3_TAR} 38 | mv ${HYDRA3_MODEL} models/pretrained_models/ucf/hydra3 39 | rm ${HYDRA3_TAR} 40 | 41 | done 42 | ``` 43 | -------------------------------------------------------------------------------- /tools/get_ucsd.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Download dataset 4 | wget http://www.svcl.ucsd.edu/projects/peoplecnt/db/ucsdpeds.zip 5 | 6 | # Extract 7 | unzip ucsdpeds.zip 8 | 9 | # Build Directory tree 10 | mkdir data/UCSD 11 | mkdir data/UCSD/images 12 | mkdir data/UCSD/image_sets 13 | mkdir data/UCSD/params 14 | 15 | # Move annotated images 16 | mv ucsdpeds/vidf/vidf1_33_000.y/*.png data/UCSD/images 17 | mv ucsdpeds/vidf/vidf1_33_001.y/*.png data/UCSD/images 18 | mv ucsdpeds/vidf/vidf1_33_002.y/*.png data/UCSD/images 19 | mv ucsdpeds/vidf/vidf1_33_003.y/*.png data/UCSD/images 20 | mv ucsdpeds/vidf/vidf1_33_004.y/*.png data/UCSD/images 21 | mv ucsdpeds/vidf/vidf1_33_005.y/*.png data/UCSD/images 22 | mv ucsdpeds/vidf/vidf1_33_006.y/*.png data/UCSD/images 23 | mv ucsdpeds/vidf/vidf1_33_007.y/*.png data/UCSD/images 24 | mv ucsdpeds/vidf/vidf1_33_008.y/*.png data/UCSD/images 25 | mv ucsdpeds/vidf/vidf1_33_009.y/*.png data/UCSD/images 26 | 27 | # Generate datasets 28 | python tools/gen_ucsd_dataset.py --imfolder data/UCSD/images --setsfolder data/UCSD/image_sets 29 | 30 | # Get annotations 31 | wget http://www.svcl.ucsd.edu/projects/peoplecnt/db/vidf-cvpr.zip 32 | 33 | # Extract 34 | unzip vidf-cvpr.zip 35 | 36 | # Generate annotations 37 | python tools/gen_ucsd_dotmaps.py --folder vidf-cvpr/ --output data/UCSD/images 38 | python tools/gen_ucsd_extranotation.py --notation vidf-cvpr/ --output data/UCSD/params 39 | 40 | # Clean 41 | rm ucsdpeds.zip 42 | rm vidf-cvpr.zip 43 | rm -fr ucsdpeds 44 | rm -fr vidf-cvpr 45 | -------------------------------------------------------------------------------- /experiments/scripts/ucsd_train_test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Usage: 4 | # ./experiments/scripts/ucsd_train_net.sh GPU_ID 5 | 6 | export PYTHONUNBUFFERED="True" 7 | 8 | # Parameters 9 | GPU_DEV=0 10 | 11 | # Uncomment one of the following set of parameters 12 | 13 | # CCNN 14 | CONFIG_FILE=models/ucsd/ccnn/ccnn_ucsd_cfg.yml 15 | CAFFE_MODEL=genfiles/output_models/ucsd/ccnn/ccnn_ucsd_max_iter_50000.caffemodel 16 | DEPLOY=models/ucsd/ccnn/ccnn_deploy.prototxt 17 | SOLVER=models/ucsd/ccnn/ccnn_max_solver.prototxt 18 | 19 | # HYDRA 2s 20 | #CONFIG_FILE=models/ucsd/hydra2/hydra2_ucsd_cfg.yml 21 | #CAFFE_MODEL=genfiles/output_models/ucsd/hydra2/hydra2_ucsd_max_iter_25000.caffemodel 22 | #DEPLOY=models/ucsd/hydra2/hydra2_deploy.prototxt 23 | #SOLVER=models/ucsd/hydra2/hydra2_max_solver.prototxt 24 | 25 | # HYDRA 3s 26 | #CONFIG_FILE=models/ucsd/hydra3/hydra3_ucsd_cfg.yml 27 | #CAFFE_MODEL=genfiles/output_models/ucsd/hydra3/hydra3_ucsd_max_iter_25000.caffemodel 28 | #DEPLOY=models/ucsd/hydra3/hydra3_deploy.prototxt 29 | #SOLVER=models/ucsd/hydra3/hydra3_max_solver.prototxt 30 | 31 | LOG="experiments/logs/ucsd_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 32 | exec &> >(tee -a "$LOG") 33 | echo Logging output to "$LOG" 34 | 35 | # Time the task 36 | T="$(date +%s)" 37 | 38 | # Generate Features 39 | python src/gen_features.py --cfg ${CONFIG_FILE} 40 | 41 | # Train Net 42 | caffe train -solver ${SOLVER} 43 | 44 | # Test Net 45 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL} --cfg ${CONFIG_FILE} 46 | 47 | T="$(($(date +%s)-T))" 48 | echo "Time in seconds: ${T}" 49 | -------------------------------------------------------------------------------- /experiments/scripts/ucf_train_test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Usage: 4 | # ./experiments/scripts/_train_net.sh GPU_ID 5 | 6 | export PYTHONUNBUFFERED="True" 7 | 8 | # Parameters 9 | GPU_DEV=0 10 | 11 | # Uncomment one of the following set of parameters 12 | 13 | # CCNN 14 | CONFIG_FILE=models/ucf/ccnn/ccnn_ucf_set_ 15 | CAFFE_MODEL=genfiles/output_models/ucf/ccnn/ccnn_ucf_iter_50000.caffemodel 16 | DEPLOY=models/ucf/ccnn/ccnn_deploy.prototxt 17 | SOLVER=models/ucf/ccnn/ccnn_solver.prototxt 18 | 19 | # HYDRA 2s 20 | #CONFIG_FILE=models/ucf/hydra2/hydra2_ucf_set_ 21 | #CAFFE_MODEL=genfiles/output_models/ucf/hydra2/hydra2_trancos_iter_25000.caffemodel 22 | #DEPLOY=models/ucf/hydra2/hydra2_deploy.prototxt 23 | #SOLVER=models/ucf/hydra2/hydra2_solver.prototxt 24 | 25 | # HYDRA 3s 26 | #CONFIG_FILE=models/ucf/hydra3/hydra3_ucf_set_ 27 | #CAFFE_MODEL=genfiles/output_models/ucf/hydra3/hydra3_trancos_iter_25000.caffemodel 28 | #DEPLOY=models/ucf/hydra3/hydra3_deploy.prototxt 29 | #SOLVER=models/ucf/hydra3/hydra3_solver.prototxt 30 | 31 | LOG="experiments/logs/ucf_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 32 | exec &> >(tee -a "$LOG") 33 | echo Logging output to "$LOG" 34 | 35 | # Time the task 36 | T="$(date +%s)" 37 | 38 | for IX in 0 1 2 3 4 39 | do 40 | # Generate Features 41 | python src/gen_features.py --cfg ${CONFIG_FILE}${IX}_cfg.yml 42 | 43 | # Train Net 44 | caffe train -solver ${SOLVER} 45 | 46 | # Rename net in order to do not overwrite it in the next iteration 47 | mv ${CAFFE_MODEL} ${CAFFE_MODEL}_${IX} 48 | 49 | # Test Net 50 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL}_${IX} --cfg ${CONFIG_FILE}${IX}_cfg.yml 51 | done 52 | 53 | # Print MAE and MSD 54 | python tools/gen_ucf_results.py --results genfiles/results/ccnn_ucf_set_ 55 | 56 | T="$(($(date +%s)-T))" 57 | echo "Time in seconds: ${T}" 58 | -------------------------------------------------------------------------------- /experiments/scripts/trancos_train_test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Usage: 4 | # ./experiments/scripts/trancos_train_net.sh GPU_ID 5 | 6 | export PYTHONUNBUFFERED="True" 7 | 8 | # Parameters 9 | GPU_DEV=0 10 | 11 | # Uncomment one of the following set of parameters 12 | 13 | # CCNN 14 | CONFIG_FILE=models/trancos/ccnn/ccnn_trancos_cfg.yml 15 | CAFFE_MODEL=genfiles/output_models/trancos/ccnn/ccnn_trancos_iter_50000.caffemodel 16 | DEPLOY=models/trancos/ccnn/ccnn_deploy.prototxt 17 | SOLVER=models/trancos/ccnn/ccnn_solver.prototxt 18 | 19 | # HYDRA 2s 20 | #CONFIG_FILE=models/trancos/hydra2/hydra2_trancos_cfg.yml 21 | #CAFFE_MODEL=genfiles/output_models/trancos/hydra2/hydra2_trancos_iter_30000.caffemodel 22 | #DEPLOY=models/trancos/hydra2/hydra2_deploy.prototxt 23 | #SOLVER=models/trancos/hydra2/hydra2_solver.prototxt 24 | 25 | # HYDRA 3s 26 | #CONFIG_FILE=models/trancos/hydra3/hydra3_trancos_cfg.yml 27 | #CAFFE_MODEL=genfiles/output_models/trancos/hydra3/hydra3_trancos_iter_30000.caffemodel 28 | #DEPLOY=models/trancos/hydra3/hydra3_deploy.prototxt 29 | #SOLVER=models/trancos/hydra3/hydra3_solver.prototxt 30 | 31 | # HYDRA 4s 32 | #CONFIG_FILE=models/trancos/hydra4/hydra4_trancos_cfg.yml 33 | #CAFFE_MODEL=genfiles/output_models/trancos/hydra4/hydra4_trancos_iter_30000.caffemodel 34 | #DEPLOY=models/trancos/hydra4/hydra4_deploy.prototxt 35 | #SOLVER=models/trancos/hydra4/hydra4_solver.prototxt 36 | 37 | LOG="experiments/logs/trancos_ccnn_`date +'%Y-%m-%d_%H-%M-%S'`.txt" 38 | exec &> >(tee -a "$LOG") 39 | echo Logging output to "$LOG" 40 | 41 | # Time the task 42 | T="$(date +%s)" 43 | 44 | # Generate Features 45 | python src/gen_features.py --cfg ${CONFIG_FILE} 46 | 47 | # Train Net 48 | caffe train -solver ${SOLVER} 49 | 50 | # Test Net 51 | python src/test.py --dev ${GPU_DEV} --prototxt ${DEPLOY} --caffemodel ${CAFFE_MODEL} --cfg ${CONFIG_FILE} 52 | 53 | T="$(($(date +%s)-T))" 54 | echo "Time in seconds: ${T}" 55 | -------------------------------------------------------------------------------- /tools/get_all_trancos_models.md: -------------------------------------------------------------------------------- 1 | # Download all the pre-trained models using the TRANCOS dataset 2 | 3 | Follow these instructions 4 | 5 | 1. Create the following dir: 6 | 7 | ``` 8 | mkdir models/pretrained_models/trancos 9 | 10 | ``` 11 | 12 | 2. Download the models: 13 | * [trancos_ccnn.caffemodel.tar.gz](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/ERdcsUU57ZFCk28lbmG16WsBDWiU71yRwgJd0kpX-RmM8g?&Download=1) 14 | * [trancos_hydra2.caffemodel.tar.gz](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/ESiIMJj29KNEvmJX8pQVaRsBVBwB7EPoRusf6votOV-VTw?&Download=1) 15 | * [trancos_hydra3.caffemodel.tar.gz](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/EfJZknF50eJAvJfacXf1-CQBT7jTuSuGAXkegjuNkpDcNg?&Download=1) 16 | * [trancos_hydra4.caffemodel.tar.gz](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/EfF-6vzJL-9MnbJsCMYzO34BvT3r_o_awIq472BeaLjiMg?&Download=1) 17 | 18 | 3. Create dirs and extract the files (use this code if you wish) 19 | ``` 20 | tar -zxvf trancos_ccnn.caffemodel.tar.gz 21 | mkdir models/pretrained_models/trancos/ccnn 22 | mv trancos_ccnn.caffemodel models/pretrained_models/trancos/ccnn 23 | 24 | tar -zxvf trancos_hydra2.caffemodel.tar.gz 25 | mkdir models/pretrained_models/trancos/hydra2 26 | mv trancos_hydra2.caffemodel models/pretrained_models/trancos/hydra2 27 | 28 | tar -zxvf trancos_hydra3.caffemodel.tar.gz 29 | mkdir models/pretrained_models/trancos/hydra3 30 | mv trancos_hydra3.caffemodel models/pretrained_models/trancos/hydra3 31 | 32 | tar -zxvf trancos_hydra4.caffemodel.tar.gz 33 | mkdir models/pretrained_models/trancos/hydra4 34 | mv trancos_hydra4.caffemodel models/pretrained_models/trancos/hydra4 35 | 36 | ``` 37 | 4. Optional (clean the downloaded files) 38 | ``` 39 | rm trancos_ccnn.caffemodel.tar.gz 40 | rm trancos_hydra2.caffemodel.tar.gz 41 | rm trancos_hydra3.caffemodel.tar.gz 42 | rm trancos_hydra4.caffemodel.tar.gz 43 | ``` 44 | -------------------------------------------------------------------------------- /tools/gen_ucf_results.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | @author: Daniel Oñoro Rubio 6 | @organization: GRAM, University of Alcalá, Alcalá de Henares, Spain 7 | @copyright: See LICENSE.txt 8 | @contact: daniel.onoro@edu.uah.es 9 | @date: Created on August 11, 2016 10 | ''' 11 | 12 | """ 13 | This script read the obtained results of each fold for the UCF experiment and 14 | prints its MAE and MSD error. 15 | """ 16 | 17 | import numpy as np 18 | import sys, getopt 19 | 20 | 21 | def dispHelp(arg0): 22 | print "======================================================" 23 | print " Usage" 24 | print "======================================================" 25 | print "\t-h display this message" 26 | print "\t--results " 27 | 28 | def main(argv): 29 | UCF_K = 5 30 | 31 | cfg_file = "" 32 | 33 | # Get parameters 34 | try: 35 | opts, _ = getopt.getopt(argv, "h:", ["results="]) 36 | except getopt.GetoptError as err: 37 | print "Error while parsing parameters: ", err 38 | dispHelp(argv[0]) 39 | return 40 | 41 | for opt, arg in opts: 42 | if opt == '-h': 43 | dispHelp(argv[0]) 44 | return 45 | elif opt in ("--results"): 46 | results_prefix = arg 47 | 48 | # MAE and STD vectors 49 | mae_v = np.zeros(UCF_K) 50 | std_v = np.zeros(UCF_K) 51 | for i in range(UCF_K): 52 | # Read data 53 | gt_file = results_prefix + "{}_gt.txt".format(i) 54 | pred_file = results_prefix + "{}_pred.txt".format(i) 55 | gt = np.loadtxt(gt_file) 56 | pred = np.loadtxt(pred_file) 57 | 58 | # Compute error 59 | diff = gt - pred 60 | mae_v[i] = np.mean( np.abs( diff ) ) 61 | std_v[i] = np.std(diff) 62 | 63 | print "Total results:" 64 | print "MAE: ", mae_v.mean() 65 | print "STD: ", std_v.mean() 66 | 67 | return 0 68 | 69 | if __name__ == '__main__': 70 | main(sys.argv[1:]) 71 | -------------------------------------------------------------------------------- /tools/gen_ucsd_extranotation.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | @author: Daniel Oñoro Rubio 6 | @organization: GRAM, University of Alcalá, Alcalá de Henares, Spain 7 | @copyright: See LICENSE.txt 8 | @contact: daniel.onoro@edu.uah.es 9 | @date: Created on August 2, 2016 10 | ''' 11 | 12 | """ 13 | This script converts the perspective map and the roi of the UCSD dataset 14 | to the supported format. 15 | """ 16 | 17 | import sys, getopt, os 18 | import h5py 19 | import numpy as np 20 | import scipy.io as scio 21 | 22 | def dispHelp(arg0): 23 | print "======================================================" 24 | print " Usage" 25 | print "======================================================" 26 | print "\t-h display this message" 27 | print "\t--folder " 28 | 29 | 30 | def main(argv): 31 | notation_folder = 'vidf-cvpr/' 32 | output = 'data/UCSD/params' 33 | 34 | # Get parameters 35 | try: 36 | opts, _ = getopt.getopt(argv, "h:", ["notation=", "output="]) 37 | except getopt.GetoptError as err: 38 | print "Error while parsing parameters: ", err 39 | dispHelp(argv[0]) 40 | return 41 | 42 | for opt, arg in opts: 43 | if opt == '-h': 44 | dispHelp(argv[0]) 45 | return 46 | elif opt in ("--folder"): 47 | notation_folder = arg 48 | elif opt in ("--output"): 49 | output = arg 50 | 51 | # Extract and convert mask 52 | mask_file = os.path.join( notation_folder, 'vidf1_33_roi_mainwalkway.mat' ) 53 | m_obj = scio.loadmat(mask_file, struct_as_record=False, squeeze_me=True) 54 | mask = m_obj['roi'].mask 55 | 56 | mask_opt_fname = os.path.join( output, 'ucsd_mask.h5' ) 57 | with h5py.File(mask_opt_fname, 'w') as f: 58 | f.create_dataset('mask', data=mask) 59 | f.close() 60 | 61 | # Extract and convert perspective map 62 | pmap_file = os.path.join( notation_folder, 'vidf1_33_dmap3.mat' ) 63 | p_obj = scio.loadmat(pmap_file, struct_as_record=False, squeeze_me=True) 64 | pmap = p_obj['dmap'].pmapx 65 | 66 | # Scale pmap 67 | pmap = pmap/pmap.min() 68 | 69 | mask_opt_fname = os.path.join( output, 'ucsd_pmap_min_norm.h5' ) 70 | with h5py.File(mask_opt_fname, 'w') as f: 71 | f.create_dataset('pmap', data=pmap) 72 | f.close() 73 | 74 | return 0 75 | 76 | if __name__ == '__main__': 77 | main(sys.argv[1:]) 78 | -------------------------------------------------------------------------------- /tools/get_all_ucsd_models.md: -------------------------------------------------------------------------------- 1 | # Download all the pretrained models using the UCSD dataset 2 | 3 | Follow these instructions 4 | 5 | 1. Download all the models in [this shared folder](https://universidaddealcala-my.sharepoint.com/:f:/g/personal/gram_uah_es/EupJym-OdldIqJDvw4pwZRoBRjLcVwDPnpWSlXrlrHuf4g?e=b7ZGiB) 6 | 7 | 2. Create dir 8 | ``` 9 | mkdir models/pretrained_models/ucsd 10 | mkdir models/pretrained_models/ucsd/ccnn 11 | mkdir models/pretrained_models/ucsd/hydra2 12 | mkdir models/pretrained_models/ucsd/hydra3 13 | ``` 14 | 15 | 3. Untar, move and clean files 16 | ``` 17 | #CCNN 18 | tar -zxvf ucsd_ccnn_down.caffemodel.tar.gz 19 | mv ucsd_ccnn_down.caffemodel models/pretrained_models/ucsd/ccnn 20 | rm ucsd_ccnn_down.caffemodel.tar.gz 21 | 22 | tar -zxvf ucsd_ccnn_max.caffemodel.tar.gz 23 | mv ucsd_ccnn_max.caffemodel models/pretrained_models/ucsd/ccnn 24 | rm ucsd_ccnn_max.caffemodel.tar.gz 25 | 26 | tar -zxvf ucsd_ccnn_min.caffemodel.tar.gz 27 | mv ucsd_ccnn_min.caffemodel models/pretrained_models/ucsd/ccnn 28 | rm ucsd_ccnn_min.caffemodel.tar.gz 29 | 30 | tar -zxvf ucsd_ccnn_up.caffemodel.tar.gz 31 | mv ucsd_ccnn_up.caffemodel models/pretrained_models/ucsd/ccnn 32 | rm ucsd_ccnn_up.caffemodel.tar.gz 33 | 34 | #HYDRA2 35 | 36 | tar -zxvf ucsd_hydra2_down.caffemodel.tar.gz 37 | mv ucsd_hydra2_down.caffemodel models/pretrained_models/ucsd/hydra2 38 | rm ucsd_hydra2_down.caffemodel.tar.gz 39 | 40 | tar -zxvf ucsd_hydra2_max.caffemodel.tar.gz 41 | mv ucsd_hydra2_max.caffemodel models/pretrained_models/ucsd/hydra2 42 | rm ucsd_hydra2_max.caffemodel.tar.gz 43 | 44 | tar -zxvf ucsd_hydra2_min.caffemodel.tar.gz 45 | mv ucsd_hydra2_min.caffemodel models/pretrained_models/ucsd/hydra2 46 | rm ucsd_hydra2_min.caffemodel.tar.gz 47 | 48 | tar -zxvf ucsd_hydra2_up.caffemodel.tar.gz 49 | mv ucsd_hydra2_up.caffemodel models/pretrained_models/ucsd/hydra2 50 | rm ucsd_hydra2_up.caffemodel.tar.gz 51 | 52 | #HYDRA3 53 | 54 | tar -zxvf ucsd_hydra3_down.caffemodel.tar.gz 55 | mv ucsd_hydra3_down.caffemodel models/pretrained_models/ucsd/hydra3 56 | rm ucsd_hydra3_down.caffemodel.tar.gz 57 | 58 | tar -zxvf ucsd_hydra3_max.caffemodel.tar.gz 59 | mv ucsd_hydra3_max.caffemodel models/pretrained_models/ucsd/hydra3 60 | rm ucsd_hydra3_max.caffemodel.tar.gz 61 | 62 | tar -zxvf ucsd_hydra3_min.caffemodel.tar.gz 63 | mv ucsd_hydra3_min.caffemodel models/pretrained_models/ucsd/hydra3 64 | rm ucsd_hydra3_min.caffemodel.tar.gz 65 | 66 | tar -zxvf ucsd_hydra3_up.caffemodel.tar.gz 67 | mv ucsd_hydra3_up.caffemodel models/pretrained_models/ucsd/hydra3 68 | rm ucsd_hydra3_up.caffemodel.tar.gz 69 | ``` 70 | -------------------------------------------------------------------------------- /tools/gen_ucf_dataset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | @author: Daniel Oñoro Rubio 6 | @organization: GRAM, University of Alcalá, Alcalá de Henares, Spain 7 | @copyright: See LICENSE.txt 8 | @contact: daniel.onoro@edu.uah.es 9 | @date: Created on Jun 15, 2015 10 | ''' 11 | 12 | """ 13 | This script creates the defferent test/train sets 14 | """ 15 | 16 | import sys, getopt, os 17 | import glob 18 | import numpy as np 19 | 20 | def dispHelp(arg0): 21 | print "======================================================" 22 | print " Usage" 23 | print "======================================================" 24 | print "\t-h display this message" 25 | print "\t--orderfile " 26 | print "\t--setsfolder " 27 | 28 | def writeToFile(list, file): 29 | with open(file, 'w') as f: 30 | for name in list: 31 | f.write(name) 32 | 33 | f.close() 34 | 35 | def main(argv): 36 | conf_folder = './image_sets/' 37 | order_file = './images/' 38 | 39 | # UCF constans 40 | K = 5 41 | UDF_SIZE = 50 42 | TEST_SIZE = UDF_SIZE/K 43 | 44 | # Get parameters 45 | try: 46 | opts, _ = getopt.getopt(argv, "h:", ["orderfile=", "setsfolder="]) 47 | except getopt.GetoptError as err: 48 | print "Error while parsing parameters: ", err 49 | dispHelp(argv[0]) 50 | return 51 | 52 | for opt, arg in opts: 53 | if opt == '-h': 54 | dispHelp(argv[0]) 55 | return 56 | elif opt in ("--orderfile"): 57 | order_file = arg 58 | elif opt in ("--setsfolder"): 59 | conf_folder = arg 60 | 61 | # Read file 62 | with open(order_file,'r') as f: 63 | names_list = [name for name in f.readlines()] 64 | names_list = np.array(names_list) # Cast to numpy for a better indexing 65 | 66 | # Perform divisións 67 | for i in range(K): 68 | # Get test sets 69 | test_idx = np.arange(i*TEST_SIZE,(i+1)*TEST_SIZE) 70 | train_mask = np.ones(UDF_SIZE, dtype=np.bool) 71 | train_mask[test_idx] = False 72 | train_ix = np.where(train_mask) 73 | 74 | # Write test file 75 | tf_name = os.path.join( conf_folder, 'test_set_{}.txt'.format(i) ) 76 | writeToFile(names_list[test_idx], tf_name) 77 | 78 | # Write train file 79 | tf_name = os.path.join( conf_folder, 'train_set_{}.txt'.format(i) ) 80 | writeToFile(names_list[train_ix], tf_name) 81 | 82 | 83 | return 0 84 | 85 | if __name__ == '__main__': 86 | main(sys.argv[1:]) 87 | -------------------------------------------------------------------------------- /tools/gen_ucf_dotmaps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | @author: Daniel Oñoro Rubio 6 | @organization: GRAM, University of Alcalá, Alcalá de Henares, Spain 7 | @copyright: See LICENSE.txt 8 | @contact: daniel.onoro@edu.uah.es 9 | @date: Created on August 2, 2016 10 | ''' 11 | 12 | """ 13 | This script creates the "dot" maps that contain the ground truth of the UCF in 14 | the supported format. 15 | """ 16 | 17 | import sys, getopt, os 18 | import numpy as np 19 | import scipy.io as scio 20 | import cv2 21 | from PIL import Image 22 | 23 | 24 | def dispHelp(arg0): 25 | print "======================================================" 26 | print " Usage" 27 | print "======================================================" 28 | print "\t-h display this message" 29 | print "\t--noationdir " 30 | print "\t--imdir " 31 | 32 | 33 | def main(argv): 34 | UCF_N_IMAGES = 50 35 | 36 | notation_folder = 'data/UCF/params/' 37 | imdir = 'data/UCF/images/' 38 | 39 | # Get parameters 40 | try: 41 | opts, _ = getopt.getopt(argv, "h:", ["notationdir=", "imdir="]) 42 | except getopt.GetoptError as err: 43 | print "Error while parsing parameters: ", err 44 | dispHelp(argv[0]) 45 | return 46 | 47 | for opt, arg in opts: 48 | if opt == '-h': 49 | dispHelp(argv[0]) 50 | return 51 | elif opt in ("--notationdir"): 52 | notation_folder = arg 53 | elif opt in ("--imdir"): 54 | output = arg 55 | 56 | for i in range(UCF_N_IMAGES): 57 | notation_file = os.path.join( notation_folder, '{}_ann.mat'.format(i+1) ) 58 | img_file = os.path.join( imdir, '{}.jpg'.format(i+1) ) 59 | notation = scio.loadmat(notation_file, struct_as_record=False, squeeze_me=True) 60 | dots = notation['annPoints'] - 1 # Make 0 index (x,y) 61 | 62 | # Init image 63 | with Image.open(img_file) as im: 64 | [width, height] = im.size 65 | black_im = np.zeros((height,width,3), dtype=np.uint8) # UCSD size 66 | # Get dots 67 | dots = dots -1 # 0 index 68 | dots = dots.astype(np.int32) 69 | mask = dots[:,0]" 29 | print "\t--output " 30 | 31 | 32 | def main(argv): 33 | notation_folder = 'vidf-cvpr/' 34 | output = 'data/UCSD/images' 35 | 36 | # Get parameters 37 | try: 38 | opts, _ = getopt.getopt(argv, "h:", ["folder=", "output="]) 39 | except getopt.GetoptError as err: 40 | print "Error while parsing parameters: ", err 41 | dispHelp(argv[0]) 42 | return 43 | 44 | for opt, arg in opts: 45 | if opt == '-h': 46 | dispHelp(argv[0]) 47 | return 48 | elif opt in ("--folder"): 49 | notation_folder = arg 50 | elif opt in ("--output"): 51 | output = arg 52 | 53 | for i in range(10): 54 | notation_file = os.path.join( notation_folder, 'vidf1_33_00{}_frame_full.mat'.format(i) ) 55 | notation = scio.loadmat(notation_file, struct_as_record=False, squeeze_me=True) 56 | 57 | frames = notation['frame'] 58 | 59 | for jx, frame in enumerate(frames): 60 | 61 | # Init image 62 | black_im = np.zeros((158,238,3), dtype=np.uint8) # UCSD size 63 | 64 | # Get dots 65 | loc = frame.loc 66 | dots = loc[:, (1,0,2)] -1 # 0 index 67 | dots[:,2] = 2 # Set red channel 68 | dots = dots.astype(np.int32) 69 | mask = dots[:,0]<158 70 | mask = np.logical_and( mask, dots[:,1]<238 ) 71 | dots = dots[mask] 72 | # Draw dots 73 | black_im[dots[:,0],dots[:,1],dots[:,2]] = 255 74 | # Save image 75 | im_name = os.path.join( output, 'vidf1_33_00{}_f{:03d}dots.png'.format(i, jx+1) ) 76 | cv2.imwrite(im_name, black_im) 77 | 78 | return 0 79 | 80 | if __name__ == '__main__': 81 | main(sys.argv[1:]) 82 | -------------------------------------------------------------------------------- /models/trancos/ccnn/ccnn_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "TRANCOS_CCNN" 2 | input: "data_s0" 3 | input_dim: 1 4 | input_dim: 3 5 | input_dim: 72 6 | input_dim: 72 7 | 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data_s0" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 32 23 | pad: 3 24 | kernel_size: 7 25 | stride: 1 26 | weight_filler { 27 | type: "gaussian" 28 | std: 0.01 29 | } 30 | 31 | bias_filler { 32 | type: "constant" 33 | } 34 | } 35 | } 36 | layer { 37 | name: "relu1" 38 | type: "ReLU" 39 | bottom: "conv1" 40 | top: "conv1" 41 | } 42 | layer { 43 | name: "pool1" 44 | type: "Pooling" 45 | bottom: "conv1" 46 | top: "pool1" 47 | pooling_param { 48 | pool: MAX 49 | kernel_size: 2 50 | stride: 2 51 | } 52 | } 53 | 54 | layer { 55 | name: "conv2" 56 | type: "Convolution" 57 | bottom: "pool1" 58 | top: "conv2" 59 | param { 60 | lr_mult: 1 61 | decay_mult: 1 62 | } 63 | param { 64 | lr_mult: 2 65 | decay_mult: 0 66 | } 67 | convolution_param { 68 | num_output: 32 69 | pad: 3 70 | kernel_size: 7 71 | stride: 1 72 | weight_filler { 73 | type: "gaussian" 74 | std: 0.3 75 | } 76 | bias_filler { 77 | type: "constant" 78 | } 79 | } 80 | } 81 | layer { 82 | name: "relu2" 83 | type: "ReLU" 84 | bottom: "conv2" 85 | top: "conv2" 86 | } 87 | layer { 88 | name: "pool2" 89 | type: "Pooling" 90 | bottom: "conv2" 91 | top: "pool2" 92 | pooling_param { 93 | pool: MAX 94 | kernel_size: 2 95 | stride: 2 96 | } 97 | } 98 | 99 | layer { 100 | name: "conv3" 101 | type: "Convolution" 102 | bottom: "pool2" 103 | top: "conv3" 104 | param { 105 | lr_mult: 1 106 | decay_mult: 1 107 | } 108 | param { 109 | lr_mult: 2 110 | decay_mult: 0 111 | } 112 | convolution_param { 113 | num_output: 64 114 | kernel_size: 5 115 | stride: 1 116 | pad: 2 117 | weight_filler { 118 | type: "gaussian" 119 | std: 0.001 120 | } 121 | bias_filler { 122 | type: "constant" 123 | } 124 | } 125 | } 126 | layer { 127 | name: "relu3" 128 | type: "ReLU" 129 | bottom: "conv3" 130 | top: "conv3" 131 | } 132 | 133 | layer { 134 | name: "conv4" 135 | type: "Convolution" 136 | bottom: "conv3" 137 | top: "conv4" 138 | param { 139 | lr_mult: 1 140 | decay_mult: 1 141 | } 142 | param { 143 | lr_mult: 2 144 | decay_mult: 0 145 | } 146 | convolution_param { 147 | num_output: 1000 148 | kernel_size: 1 149 | stride: 1 150 | pad: 0 151 | weight_filler { 152 | type: "gaussian" 153 | std: 0.3 154 | } 155 | bias_filler { 156 | type: "constant" 157 | # value: 1 158 | } 159 | } 160 | } 161 | layer { 162 | name: "relu4" 163 | type: "ReLU" 164 | bottom: "conv4" 165 | top: "conv4" 166 | } 167 | 168 | layer { 169 | name: "conv5" 170 | type: "Convolution" 171 | bottom: "conv4" 172 | top: "conv5" 173 | param { 174 | lr_mult: 1 175 | decay_mult: 1 176 | } 177 | param { 178 | lr_mult: 2 179 | decay_mult: 0 180 | } 181 | convolution_param { 182 | num_output: 400 183 | kernel_size: 1 184 | stride: 1 185 | pad: 0 186 | weight_filler { 187 | type: "gaussian" 188 | std: 0.1 189 | } 190 | bias_filler { 191 | type: "constant" 192 | # value: 1 193 | } 194 | } 195 | } 196 | layer { 197 | name: "relu5" 198 | type: "ReLU" 199 | bottom: "conv5" 200 | top: "conv5" 201 | } 202 | 203 | layer { 204 | name: "conv6" 205 | type: "Convolution" 206 | bottom: "conv5" 207 | top: "conv6" 208 | param { 209 | lr_mult: 1 210 | decay_mult: 1 211 | } 212 | param { 213 | lr_mult: 2 214 | decay_mult: 0 215 | } 216 | convolution_param { 217 | num_output: 1 218 | kernel_size: 1 219 | stride: 1 220 | pad: 0 221 | weight_filler { 222 | type: "constant" 223 | value: 0 224 | } 225 | bias_filler { 226 | type: "constant" 227 | # value: 1 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | input: "data_s0" 3 | input_dim: 1 4 | input_dim: 1 5 | input_dim: 72 6 | input_dim: 72 7 | 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data_s0" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 32 23 | pad: 3 24 | kernel_size: 7 25 | stride: 1 26 | weight_filler { 27 | type: "gaussian" 28 | std: 0.01000 29 | } 30 | 31 | bias_filler { 32 | type: "constant" 33 | } 34 | } 35 | } 36 | layer { 37 | name: "relu1" 38 | type: "ReLU" 39 | bottom: "conv1" 40 | top: "conv1" 41 | } 42 | layer { 43 | name: "pool1" 44 | type: "Pooling" 45 | bottom: "conv1" 46 | top: "pool1" 47 | pooling_param { 48 | pool: MAX 49 | kernel_size: 2 50 | stride: 2 51 | } 52 | } 53 | 54 | layer { 55 | name: "conv2" 56 | type: "Convolution" 57 | bottom: "pool1" 58 | top: "conv2" 59 | param { 60 | lr_mult: 1 61 | decay_mult: 1 62 | } 63 | param { 64 | lr_mult: 2 65 | decay_mult: 0 66 | } 67 | convolution_param { 68 | num_output: 32 69 | pad: 3 70 | kernel_size: 7 71 | stride: 1 72 | weight_filler { 73 | type: "gaussian" 74 | std: 0.01000 75 | } 76 | bias_filler { 77 | type: "constant" 78 | } 79 | } 80 | } 81 | layer { 82 | name: "relu2" 83 | type: "ReLU" 84 | bottom: "conv2" 85 | top: "conv2" 86 | } 87 | layer { 88 | name: "pool2" 89 | type: "Pooling" 90 | bottom: "conv2" 91 | top: "pool2" 92 | pooling_param { 93 | pool: MAX 94 | kernel_size: 2 95 | stride: 2 96 | } 97 | } 98 | 99 | layer { 100 | name: "conv3" 101 | type: "Convolution" 102 | bottom: "pool2" 103 | top: "conv3" 104 | param { 105 | lr_mult: 1 106 | decay_mult: 1 107 | } 108 | param { 109 | lr_mult: 2 110 | decay_mult: 0 111 | } 112 | convolution_param { 113 | num_output: 64 114 | kernel_size: 5 115 | stride: 1 116 | pad: 2 117 | weight_filler { 118 | type: "gaussian" 119 | std: 0.20000 120 | } 121 | bias_filler { 122 | type: "constant" 123 | } 124 | } 125 | } 126 | layer { 127 | name: "relu3" 128 | type: "ReLU" 129 | bottom: "conv3" 130 | top: "conv3" 131 | } 132 | 133 | layer { 134 | name: "conv4" 135 | type: "Convolution" 136 | bottom: "conv3" 137 | top: "conv4" 138 | param { 139 | lr_mult: 1 140 | decay_mult: 1 141 | } 142 | param { 143 | lr_mult: 2 144 | decay_mult: 0 145 | } 146 | convolution_param { 147 | num_output: 1000 148 | kernel_size: 1 149 | stride: 1 150 | pad: 0 151 | weight_filler { 152 | type: "gaussian" 153 | std: 0.20000 154 | } 155 | bias_filler { 156 | type: "constant" 157 | # value: 1 158 | } 159 | } 160 | } 161 | layer { 162 | name: "relu4" 163 | type: "ReLU" 164 | bottom: "conv4" 165 | top: "conv4" 166 | } 167 | 168 | layer { 169 | name: "conv5" 170 | type: "Convolution" 171 | bottom: "conv4" 172 | top: "conv5" 173 | param { 174 | lr_mult: 1 175 | decay_mult: 1 176 | } 177 | param { 178 | lr_mult: 2 179 | decay_mult: 0 180 | } 181 | convolution_param { 182 | num_output: 400 183 | kernel_size: 1 184 | stride: 1 185 | pad: 0 186 | weight_filler { 187 | type: "gaussian" 188 | std: 0.05000 189 | } 190 | bias_filler { 191 | type: "constant" 192 | # value: 1 193 | } 194 | } 195 | } 196 | layer { 197 | name: "relu5" 198 | type: "ReLU" 199 | bottom: "conv5" 200 | top: "conv5" 201 | } 202 | 203 | layer { 204 | name: "conv6" 205 | type: "Convolution" 206 | bottom: "conv5" 207 | top: "conv6" 208 | param { 209 | lr_mult: 1 210 | decay_mult: 1 211 | } 212 | param { 213 | lr_mult: 2 214 | decay_mult: 0 215 | } 216 | convolution_param { 217 | num_output: 1 218 | kernel_size: 1 219 | stride: 1 220 | pad: 0 221 | weight_filler { 222 | type: "constant" 223 | value: 0 224 | } 225 | bias_filler { 226 | type: "constant" 227 | # value: 1 228 | } 229 | } 230 | } 231 | 232 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCF_CNN" 2 | input: "data_s0" 3 | input_dim: 1 4 | input_dim: 1 5 | input_dim: 72 6 | input_dim: 72 7 | 8 | layer { 9 | name: "conv1" 10 | type: "Convolution" 11 | bottom: "data_s0" 12 | top: "conv1" 13 | param { 14 | lr_mult: 1 15 | decay_mult: 1 16 | } 17 | param { 18 | lr_mult: 2 19 | decay_mult: 0 20 | } 21 | convolution_param { 22 | num_output: 32 23 | pad: 3 24 | kernel_size: 7 25 | stride: 1 26 | weight_filler { 27 | type: "gaussian" 28 | std: 0.001 29 | } 30 | # weight_filler { 31 | # type: "xavier" 32 | # } 33 | bias_filler { 34 | type: "constant" 35 | # value: 1 36 | } 37 | } 38 | } 39 | layer { 40 | name: "relu1" 41 | type: "ReLU" 42 | bottom: "conv1" 43 | top: "conv1" 44 | } 45 | layer { 46 | name: "pool1" 47 | type: "Pooling" 48 | bottom: "conv1" 49 | top: "pool1" 50 | pooling_param { 51 | pool: MAX 52 | kernel_size: 2 53 | stride: 2 54 | } 55 | } 56 | 57 | layer { 58 | name: "conv2" 59 | type: "Convolution" 60 | bottom: "pool1" 61 | top: "conv2" 62 | param { 63 | lr_mult: 1 64 | decay_mult: 1 65 | } 66 | param { 67 | lr_mult: 2 68 | decay_mult: 0 69 | } 70 | convolution_param { 71 | num_output: 32 72 | pad: 3 73 | kernel_size: 7 74 | stride: 1 75 | # weight_filler { 76 | # type: "xavier" 77 | # } 78 | weight_filler { 79 | type: "gaussian" 80 | std: 0.1 81 | } 82 | bias_filler { 83 | type: "constant" 84 | # value: 1 85 | } 86 | } 87 | } 88 | layer { 89 | name: "relu2" 90 | type: "ReLU" 91 | bottom: "conv2" 92 | top: "conv2" 93 | } 94 | layer { 95 | name: "pool2" 96 | type: "Pooling" 97 | bottom: "conv2" 98 | top: "pool2" 99 | pooling_param { 100 | pool: MAX 101 | kernel_size: 2 102 | stride: 2 103 | } 104 | } 105 | 106 | layer { 107 | name: "conv3" 108 | type: "Convolution" 109 | bottom: "pool2" 110 | top: "conv3" 111 | param { 112 | lr_mult: 1 113 | decay_mult: 1 114 | } 115 | param { 116 | lr_mult: 2 117 | decay_mult: 0 118 | } 119 | convolution_param { 120 | num_output: 64 121 | kernel_size: 5 122 | stride: 1 123 | pad: 2 124 | weight_filler { 125 | type: "gaussian" 126 | std: 0.2 127 | } 128 | # weight_filler { 129 | # type: "xavier" 130 | # } 131 | bias_filler { 132 | type: "constant" 133 | # value: 1 134 | } 135 | } 136 | } 137 | layer { 138 | name: "relu3" 139 | type: "ReLU" 140 | bottom: "conv3" 141 | top: "conv3" 142 | } 143 | 144 | layer { 145 | name: "conv4" 146 | type: "Convolution" 147 | bottom: "conv3" 148 | top: "conv4" 149 | param { 150 | lr_mult: 1 151 | decay_mult: 1 152 | } 153 | param { 154 | lr_mult: 2 155 | decay_mult: 0 156 | } 157 | convolution_param { 158 | num_output: 1000 159 | kernel_size: 1 160 | stride: 1 161 | pad: 0 162 | weight_filler { 163 | type: "gaussian" 164 | std: 0.2 165 | } 166 | # weight_filler { 167 | # type: "xavier" 168 | # } 169 | bias_filler { 170 | type: "constant" 171 | # value: 1 172 | } 173 | } 174 | } 175 | 176 | layer { 177 | name: "relu4" 178 | type: "ReLU" 179 | bottom: "conv4" 180 | top: "conv4" 181 | } 182 | 183 | layer { 184 | name: "conv5" 185 | type: "Convolution" 186 | bottom: "conv4" 187 | top: "conv5" 188 | param { 189 | lr_mult: 1 190 | decay_mult: 1 191 | } 192 | param { 193 | lr_mult: 2 194 | decay_mult: 0 195 | } 196 | convolution_param { 197 | num_output: 400 198 | kernel_size: 1 199 | stride: 1 200 | pad: 0 201 | weight_filler { 202 | type: "gaussian" 203 | std: 0.2 204 | } 205 | # weight_filler { 206 | # type: "xavier" 207 | # } 208 | bias_filler { 209 | type: "constant" 210 | # value: 1 211 | } 212 | } 213 | } 214 | 215 | layer { 216 | name: "relu5" 217 | type: "ReLU" 218 | bottom: "conv5" 219 | top: "conv5" 220 | } 221 | 222 | layer { 223 | name: "fc6" 224 | type: "InnerProduct" 225 | bottom: "conv5" 226 | top: "fc6" 227 | param { 228 | lr_mult: 1 229 | decay_mult: 1 230 | } 231 | param { 232 | lr_mult: 2 233 | decay_mult: 0 234 | } 235 | inner_product_param { 236 | num_output: 324 237 | # weight_filler { 238 | # type: "gaussian" 239 | # std: 0.005 240 | # } 241 | weight_filler { 242 | type: "constant" 243 | value: 0 244 | } 245 | # weight_filler { 246 | # type: "xavier" 247 | # } 248 | bias_filler { 249 | type: "constant" 250 | # value: 1 251 | } 252 | } 253 | } 254 | 255 | 256 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_down_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "label" 7 | # include { 8 | # phase: TRAIN 9 | # } 10 | hdf5_data_param { 11 | source: "genfiles/features/down_train.txt" 12 | batch_size: 64 13 | shuffle: true 14 | } 15 | } 16 | #layer { 17 | # name: "data" 18 | # type: "HDF5Data" 19 | # top: "data_s0" 20 | # top: "label" 21 | # include { 22 | # phase: TEST 23 | # } 24 | # hdf5_data_param { 25 | # source: "genfiles/features/down_test.txt" 26 | # batch_size: 64 27 | ## shuffle: true 28 | # } 29 | #} 30 | # Convolutional Layers 31 | ################################################################################ 32 | layer { 33 | name: "conv1" 34 | type: "Convolution" 35 | bottom: "data_s0" 36 | top: "conv1" 37 | param { 38 | lr_mult: 1 39 | decay_mult: 1 40 | } 41 | param { 42 | lr_mult: 2 43 | decay_mult: 0 44 | } 45 | convolution_param { 46 | num_output: 32 47 | pad: 3 48 | kernel_size: 7 49 | stride: 1 50 | weight_filler { 51 | type: "gaussian" 52 | std: 0.01 53 | } 54 | 55 | bias_filler { 56 | type: "constant" 57 | } 58 | } 59 | } 60 | layer { 61 | name: "relu1" 62 | type: "ReLU" 63 | bottom: "conv1" 64 | top: "conv1" 65 | } 66 | layer { 67 | name: "pool1" 68 | type: "Pooling" 69 | bottom: "conv1" 70 | top: "pool1" 71 | pooling_param { 72 | pool: MAX 73 | kernel_size: 2 74 | stride: 2 75 | } 76 | } 77 | 78 | layer { 79 | name: "conv2" 80 | type: "Convolution" 81 | bottom: "pool1" 82 | top: "conv2" 83 | param { 84 | lr_mult: 1 85 | decay_mult: 1 86 | } 87 | param { 88 | lr_mult: 2 89 | decay_mult: 0 90 | } 91 | convolution_param { 92 | num_output: 32 93 | pad: 3 94 | kernel_size: 7 95 | stride: 1 96 | weight_filler { 97 | type: "gaussian" 98 | std: 0.35 99 | } 100 | bias_filler { 101 | type: "constant" 102 | } 103 | } 104 | } 105 | layer { 106 | name: "relu2" 107 | type: "ReLU" 108 | bottom: "conv2" 109 | top: "conv2" 110 | } 111 | layer { 112 | name: "pool2" 113 | type: "Pooling" 114 | bottom: "conv2" 115 | top: "pool2" 116 | pooling_param { 117 | pool: MAX 118 | kernel_size: 2 119 | stride: 2 120 | } 121 | } 122 | 123 | layer { 124 | name: "conv3" 125 | type: "Convolution" 126 | bottom: "pool2" 127 | top: "conv3" 128 | param { 129 | lr_mult: 1 130 | decay_mult: 1 131 | } 132 | param { 133 | lr_mult: 2 134 | decay_mult: 0 135 | } 136 | convolution_param { 137 | num_output: 64 138 | kernel_size: 5 139 | stride: 1 140 | pad: 2 141 | weight_filler { 142 | type: "gaussian" 143 | std: 0.01 144 | } 145 | bias_filler { 146 | type: "constant" 147 | } 148 | } 149 | } 150 | layer { 151 | name: "relu3" 152 | type: "ReLU" 153 | bottom: "conv3" 154 | top: "conv3" 155 | } 156 | 157 | layer { 158 | name: "conv4" 159 | type: "Convolution" 160 | bottom: "conv3" 161 | top: "conv4" 162 | param { 163 | lr_mult: 1 164 | decay_mult: 1 165 | } 166 | param { 167 | lr_mult: 2 168 | decay_mult: 0 169 | } 170 | convolution_param { 171 | num_output: 1000 172 | kernel_size: 1 173 | stride: 1 174 | pad: 0 175 | weight_filler { 176 | type: "gaussian" 177 | std: 0.2 178 | } 179 | bias_filler { 180 | type: "constant" 181 | # value: 1 182 | } 183 | } 184 | } 185 | layer { 186 | name: "relu4" 187 | type: "ReLU" 188 | bottom: "conv4" 189 | top: "conv4" 190 | } 191 | 192 | layer { 193 | name: "conv5" 194 | type: "Convolution" 195 | bottom: "conv4" 196 | top: "conv5" 197 | param { 198 | lr_mult: 1 199 | decay_mult: 1 200 | } 201 | param { 202 | lr_mult: 2 203 | decay_mult: 0 204 | } 205 | convolution_param { 206 | num_output: 400 207 | kernel_size: 1 208 | stride: 1 209 | pad: 0 210 | weight_filler { 211 | type: "gaussian" 212 | std: 0.2 213 | } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | layer { 221 | name: "relu5" 222 | type: "ReLU" 223 | bottom: "conv5" 224 | top: "conv5" 225 | } 226 | 227 | layer { 228 | name: "conv6" 229 | type: "Convolution" 230 | bottom: "conv5" 231 | top: "conv6" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 1 242 | kernel_size: 1 243 | stride: 1 244 | pad: 0 245 | weight_filler { 246 | type: "constant" 247 | value: 0 248 | } 249 | bias_filler { 250 | type: "constant" 251 | # value: 1 252 | } 253 | } 254 | } 255 | 256 | layer { 257 | name: "loss" 258 | type: "EuclideanLoss" 259 | bottom: "conv6" 260 | bottom: "label" 261 | top: "loss" 262 | } 263 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_max_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "label" 7 | # include { 8 | # phase: TRAIN 9 | # } 10 | hdf5_data_param { 11 | source: "genfiles/features/max_train.txt" 12 | batch_size: 64 13 | shuffle: true 14 | } 15 | } 16 | #layer { 17 | # name: "data" 18 | # type: "HDF5Data" 19 | # top: "data_s0" 20 | # top: "label" 21 | # include { 22 | # phase: TEST 23 | # } 24 | # hdf5_data_param { 25 | # source: "genfiles/features/max_test.txt" 26 | # batch_size: 64 27 | ## shuffle: true 28 | # } 29 | #} 30 | # Convolutional Layers 31 | ################################################################################ 32 | layer { 33 | name: "conv1" 34 | type: "Convolution" 35 | bottom: "data_s0" 36 | top: "conv1" 37 | param { 38 | lr_mult: 1 39 | decay_mult: 1 40 | } 41 | param { 42 | lr_mult: 2 43 | decay_mult: 0 44 | } 45 | convolution_param { 46 | num_output: 32 47 | pad: 3 48 | kernel_size: 7 49 | stride: 1 50 | weight_filler { 51 | type: "gaussian" 52 | std: 0.01 53 | } 54 | 55 | bias_filler { 56 | type: "constant" 57 | } 58 | } 59 | } 60 | layer { 61 | name: "relu1" 62 | type: "ReLU" 63 | bottom: "conv1" 64 | top: "conv1" 65 | } 66 | layer { 67 | name: "pool1" 68 | type: "Pooling" 69 | bottom: "conv1" 70 | top: "pool1" 71 | pooling_param { 72 | pool: MAX 73 | kernel_size: 2 74 | stride: 2 75 | } 76 | } 77 | 78 | layer { 79 | name: "conv2" 80 | type: "Convolution" 81 | bottom: "pool1" 82 | top: "conv2" 83 | param { 84 | lr_mult: 1 85 | decay_mult: 1 86 | } 87 | param { 88 | lr_mult: 2 89 | decay_mult: 0 90 | } 91 | convolution_param { 92 | num_output: 32 93 | pad: 3 94 | kernel_size: 7 95 | stride: 1 96 | weight_filler { 97 | type: "gaussian" 98 | std: 0.35 99 | } 100 | bias_filler { 101 | type: "constant" 102 | } 103 | } 104 | } 105 | layer { 106 | name: "relu2" 107 | type: "ReLU" 108 | bottom: "conv2" 109 | top: "conv2" 110 | } 111 | layer { 112 | name: "pool2" 113 | type: "Pooling" 114 | bottom: "conv2" 115 | top: "pool2" 116 | pooling_param { 117 | pool: MAX 118 | kernel_size: 2 119 | stride: 2 120 | } 121 | } 122 | 123 | layer { 124 | name: "conv3" 125 | type: "Convolution" 126 | bottom: "pool2" 127 | top: "conv3" 128 | param { 129 | lr_mult: 1 130 | decay_mult: 1 131 | } 132 | param { 133 | lr_mult: 2 134 | decay_mult: 0 135 | } 136 | convolution_param { 137 | num_output: 64 138 | kernel_size: 5 139 | stride: 1 140 | pad: 2 141 | weight_filler { 142 | type: "gaussian" 143 | std: 0.0001 144 | } 145 | bias_filler { 146 | type: "constant" 147 | } 148 | } 149 | } 150 | layer { 151 | name: "relu3" 152 | type: "ReLU" 153 | bottom: "conv3" 154 | top: "conv3" 155 | } 156 | 157 | layer { 158 | name: "conv4" 159 | type: "Convolution" 160 | bottom: "conv3" 161 | top: "conv4" 162 | param { 163 | lr_mult: 1 164 | decay_mult: 1 165 | } 166 | param { 167 | lr_mult: 2 168 | decay_mult: 0 169 | } 170 | convolution_param { 171 | num_output: 1000 172 | kernel_size: 1 173 | stride: 1 174 | pad: 0 175 | weight_filler { 176 | type: "gaussian" 177 | std: 0.2 178 | } 179 | bias_filler { 180 | type: "constant" 181 | # value: 1 182 | } 183 | } 184 | } 185 | layer { 186 | name: "relu4" 187 | type: "ReLU" 188 | bottom: "conv4" 189 | top: "conv4" 190 | } 191 | 192 | layer { 193 | name: "conv5" 194 | type: "Convolution" 195 | bottom: "conv4" 196 | top: "conv5" 197 | param { 198 | lr_mult: 1 199 | decay_mult: 1 200 | } 201 | param { 202 | lr_mult: 2 203 | decay_mult: 0 204 | } 205 | convolution_param { 206 | num_output: 400 207 | kernel_size: 1 208 | stride: 1 209 | pad: 0 210 | weight_filler { 211 | type: "gaussian" 212 | std: 0.1 213 | } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | layer { 221 | name: "relu5" 222 | type: "ReLU" 223 | bottom: "conv5" 224 | top: "conv5" 225 | } 226 | 227 | layer { 228 | name: "conv6" 229 | type: "Convolution" 230 | bottom: "conv5" 231 | top: "conv6" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 1 242 | kernel_size: 1 243 | stride: 1 244 | pad: 0 245 | weight_filler { 246 | type: "constant" 247 | value: 0 248 | } 249 | bias_filler { 250 | type: "constant" 251 | # value: 1 252 | } 253 | } 254 | } 255 | 256 | layer { 257 | name: "loss" 258 | type: "EuclideanLoss" 259 | bottom: "conv6" 260 | bottom: "label" 261 | top: "loss" 262 | } 263 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_min_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "label" 7 | # include { 8 | # phase: TRAIN 9 | # } 10 | hdf5_data_param { 11 | source: "genfiles/features/min_train.txt" 12 | batch_size: 64 13 | shuffle: true 14 | } 15 | } 16 | #layer { 17 | # name: "data" 18 | # type: "HDF5Data" 19 | # top: "data_s0" 20 | # top: "label" 21 | # include { 22 | # phase: TEST 23 | # } 24 | # hdf5_data_param { 25 | # source: "genfiles/features/min_test.txt" 26 | # batch_size: 64 27 | ## shuffle: true 28 | # } 29 | #} 30 | # Convolutional Layers 31 | ################################################################################ 32 | layer { 33 | name: "conv1" 34 | type: "Convolution" 35 | bottom: "data_s0" 36 | top: "conv1" 37 | param { 38 | lr_mult: 1 39 | decay_mult: 1 40 | } 41 | param { 42 | lr_mult: 2 43 | decay_mult: 0 44 | } 45 | convolution_param { 46 | num_output: 32 47 | pad: 3 48 | kernel_size: 7 49 | stride: 1 50 | weight_filler { 51 | type: "gaussian" 52 | std: 0.01 53 | } 54 | 55 | bias_filler { 56 | type: "constant" 57 | } 58 | } 59 | } 60 | layer { 61 | name: "relu1" 62 | type: "ReLU" 63 | bottom: "conv1" 64 | top: "conv1" 65 | } 66 | layer { 67 | name: "pool1" 68 | type: "Pooling" 69 | bottom: "conv1" 70 | top: "pool1" 71 | pooling_param { 72 | pool: MAX 73 | kernel_size: 2 74 | stride: 2 75 | } 76 | } 77 | 78 | layer { 79 | name: "conv2" 80 | type: "Convolution" 81 | bottom: "pool1" 82 | top: "conv2" 83 | param { 84 | lr_mult: 1 85 | decay_mult: 1 86 | } 87 | param { 88 | lr_mult: 2 89 | decay_mult: 0 90 | } 91 | convolution_param { 92 | num_output: 32 93 | pad: 3 94 | kernel_size: 7 95 | stride: 1 96 | weight_filler { 97 | type: "gaussian" 98 | std: 0.35 99 | } 100 | bias_filler { 101 | type: "constant" 102 | } 103 | } 104 | } 105 | layer { 106 | name: "relu2" 107 | type: "ReLU" 108 | bottom: "conv2" 109 | top: "conv2" 110 | } 111 | layer { 112 | name: "pool2" 113 | type: "Pooling" 114 | bottom: "conv2" 115 | top: "pool2" 116 | pooling_param { 117 | pool: MAX 118 | kernel_size: 2 119 | stride: 2 120 | } 121 | } 122 | 123 | layer { 124 | name: "conv3" 125 | type: "Convolution" 126 | bottom: "pool2" 127 | top: "conv3" 128 | param { 129 | lr_mult: 1 130 | decay_mult: 1 131 | } 132 | param { 133 | lr_mult: 2 134 | decay_mult: 0 135 | } 136 | convolution_param { 137 | num_output: 64 138 | kernel_size: 5 139 | stride: 1 140 | pad: 2 141 | weight_filler { 142 | type: "gaussian" 143 | std: 0.001 144 | } 145 | bias_filler { 146 | type: "constant" 147 | } 148 | } 149 | } 150 | layer { 151 | name: "relu3" 152 | type: "ReLU" 153 | bottom: "conv3" 154 | top: "conv3" 155 | } 156 | 157 | layer { 158 | name: "conv4" 159 | type: "Convolution" 160 | bottom: "conv3" 161 | top: "conv4" 162 | param { 163 | lr_mult: 1 164 | decay_mult: 1 165 | } 166 | param { 167 | lr_mult: 2 168 | decay_mult: 0 169 | } 170 | convolution_param { 171 | num_output: 1000 172 | kernel_size: 1 173 | stride: 1 174 | pad: 0 175 | weight_filler { 176 | type: "gaussian" 177 | std: 0.3 178 | } 179 | bias_filler { 180 | type: "constant" 181 | # value: 1 182 | } 183 | } 184 | } 185 | layer { 186 | name: "relu4" 187 | type: "ReLU" 188 | bottom: "conv4" 189 | top: "conv4" 190 | } 191 | 192 | layer { 193 | name: "conv5" 194 | type: "Convolution" 195 | bottom: "conv4" 196 | top: "conv5" 197 | param { 198 | lr_mult: 1 199 | decay_mult: 1 200 | } 201 | param { 202 | lr_mult: 2 203 | decay_mult: 0 204 | } 205 | convolution_param { 206 | num_output: 400 207 | kernel_size: 1 208 | stride: 1 209 | pad: 0 210 | weight_filler { 211 | type: "gaussian" 212 | std: 0.2 213 | } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | layer { 221 | name: "relu5" 222 | type: "ReLU" 223 | bottom: "conv5" 224 | top: "conv5" 225 | } 226 | 227 | layer { 228 | name: "conv6" 229 | type: "Convolution" 230 | bottom: "conv5" 231 | top: "conv6" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 1 242 | kernel_size: 1 243 | stride: 1 244 | pad: 0 245 | weight_filler { 246 | type: "constant" 247 | value: 0 248 | } 249 | bias_filler { 250 | type: "constant" 251 | # value: 1 252 | } 253 | } 254 | } 255 | 256 | layer { 257 | name: "loss" 258 | type: "EuclideanLoss" 259 | bottom: "conv6" 260 | bottom: "label" 261 | top: "loss" 262 | } 263 | -------------------------------------------------------------------------------- /models/ucsd/ccnn/ccnn_up_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "label" 7 | # include { 8 | # phase: TRAIN 9 | # } 10 | hdf5_data_param { 11 | source: "genfiles/features/up_train.txt" 12 | batch_size: 64 13 | shuffle: true 14 | } 15 | } 16 | #layer { 17 | # name: "data" 18 | # type: "HDF5Data" 19 | # top: "data_s0" 20 | # top: "label" 21 | # include { 22 | # phase: TEST 23 | # } 24 | # hdf5_data_param { 25 | # source: "genfiles/features/up_test.txt" 26 | # batch_size: 64 27 | ## shuffle: true 28 | # } 29 | #} 30 | # Convolutional Layers 31 | ################################################################################ 32 | layer { 33 | name: "conv1" 34 | type: "Convolution" 35 | bottom: "data_s0" 36 | top: "conv1" 37 | param { 38 | lr_mult: 1 39 | decay_mult: 1 40 | } 41 | param { 42 | lr_mult: 2 43 | decay_mult: 0 44 | } 45 | convolution_param { 46 | num_output: 32 47 | pad: 3 48 | kernel_size: 7 49 | stride: 1 50 | weight_filler { 51 | type: "gaussian" 52 | std: 0.01 53 | } 54 | 55 | bias_filler { 56 | type: "constant" 57 | } 58 | } 59 | } 60 | layer { 61 | name: "relu1" 62 | type: "ReLU" 63 | bottom: "conv1" 64 | top: "conv1" 65 | } 66 | layer { 67 | name: "pool1" 68 | type: "Pooling" 69 | bottom: "conv1" 70 | top: "pool1" 71 | pooling_param { 72 | pool: MAX 73 | kernel_size: 2 74 | stride: 2 75 | } 76 | } 77 | 78 | layer { 79 | name: "conv2" 80 | type: "Convolution" 81 | bottom: "pool1" 82 | top: "conv2" 83 | param { 84 | lr_mult: 1 85 | decay_mult: 1 86 | } 87 | param { 88 | lr_mult: 2 89 | decay_mult: 0 90 | } 91 | convolution_param { 92 | num_output: 32 93 | pad: 3 94 | kernel_size: 7 95 | stride: 1 96 | weight_filler { 97 | type: "gaussian" 98 | std: 0.2 99 | } 100 | bias_filler { 101 | type: "constant" 102 | } 103 | } 104 | } 105 | layer { 106 | name: "relu2" 107 | type: "ReLU" 108 | bottom: "conv2" 109 | top: "conv2" 110 | } 111 | layer { 112 | name: "pool2" 113 | type: "Pooling" 114 | bottom: "conv2" 115 | top: "pool2" 116 | pooling_param { 117 | pool: MAX 118 | kernel_size: 2 119 | stride: 2 120 | } 121 | } 122 | 123 | layer { 124 | name: "conv3" 125 | type: "Convolution" 126 | bottom: "pool2" 127 | top: "conv3" 128 | param { 129 | lr_mult: 1 130 | decay_mult: 1 131 | } 132 | param { 133 | lr_mult: 2 134 | decay_mult: 0 135 | } 136 | convolution_param { 137 | num_output: 64 138 | kernel_size: 5 139 | stride: 1 140 | pad: 2 141 | weight_filler { 142 | type: "gaussian" 143 | std: 0.0001 144 | } 145 | bias_filler { 146 | type: "constant" 147 | } 148 | } 149 | } 150 | layer { 151 | name: "relu3" 152 | type: "ReLU" 153 | bottom: "conv3" 154 | top: "conv3" 155 | } 156 | 157 | layer { 158 | name: "conv4" 159 | type: "Convolution" 160 | bottom: "conv3" 161 | top: "conv4" 162 | param { 163 | lr_mult: 1 164 | decay_mult: 1 165 | } 166 | param { 167 | lr_mult: 2 168 | decay_mult: 0 169 | } 170 | convolution_param { 171 | num_output: 1000 172 | kernel_size: 1 173 | stride: 1 174 | pad: 0 175 | weight_filler { 176 | type: "gaussian" 177 | std: 0.35 178 | } 179 | bias_filler { 180 | type: "constant" 181 | # value: 1 182 | } 183 | } 184 | } 185 | layer { 186 | name: "relu4" 187 | type: "ReLU" 188 | bottom: "conv4" 189 | top: "conv4" 190 | } 191 | 192 | layer { 193 | name: "conv5" 194 | type: "Convolution" 195 | bottom: "conv4" 196 | top: "conv5" 197 | param { 198 | lr_mult: 1 199 | decay_mult: 1 200 | } 201 | param { 202 | lr_mult: 2 203 | decay_mult: 0 204 | } 205 | convolution_param { 206 | num_output: 400 207 | kernel_size: 1 208 | stride: 1 209 | pad: 0 210 | weight_filler { 211 | type: "gaussian" 212 | std: 0.1 213 | } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | layer { 221 | name: "relu5" 222 | type: "ReLU" 223 | bottom: "conv5" 224 | top: "conv5" 225 | } 226 | 227 | layer { 228 | name: "conv6" 229 | type: "Convolution" 230 | bottom: "conv5" 231 | top: "conv6" 232 | param { 233 | lr_mult: 1 234 | decay_mult: 1 235 | } 236 | param { 237 | lr_mult: 2 238 | decay_mult: 0 239 | } 240 | convolution_param { 241 | num_output: 1 242 | kernel_size: 1 243 | stride: 1 244 | pad: 0 245 | weight_filler { 246 | type: "constant" 247 | value: 0 248 | } 249 | bias_filler { 250 | type: "constant" 251 | # value: 1 252 | } 253 | } 254 | } 255 | 256 | layer { 257 | name: "loss" 258 | type: "EuclideanLoss" 259 | bottom: "conv6" 260 | bottom: "label" 261 | top: "loss" 262 | } 263 | -------------------------------------------------------------------------------- /models/trancos/ccnn/ccnn_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "TRANCOS_CNN" 2 | 3 | layer { 4 | name: "data" 5 | type: "HDF5Data" 6 | top: "data_s0" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/train.txt" 13 | batch_size: 128 14 | #shuffle: true 15 | } 16 | } 17 | 18 | #layer { 19 | # name: "data" 20 | # type: "HDF5Data" 21 | # top: "data_s0" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/test.txt" 28 | # batch_size: 128 29 | # #shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.01 55 | } 56 | 57 | bias_filler { 58 | type: "constant" 59 | } 60 | } 61 | } 62 | layer { 63 | name: "relu1" 64 | type: "ReLU" 65 | bottom: "conv1" 66 | top: "conv1" 67 | } 68 | layer { 69 | name: "pool1" 70 | type: "Pooling" 71 | bottom: "conv1" 72 | top: "pool1" 73 | pooling_param { 74 | pool: MAX 75 | kernel_size: 2 76 | stride: 2 77 | } 78 | } 79 | 80 | layer { 81 | name: "conv2" 82 | type: "Convolution" 83 | bottom: "pool1" 84 | top: "conv2" 85 | param { 86 | lr_mult: 1 87 | decay_mult: 1 88 | } 89 | param { 90 | lr_mult: 2 91 | decay_mult: 0 92 | } 93 | convolution_param { 94 | num_output: 32 95 | pad: 3 96 | kernel_size: 7 97 | stride: 1 98 | weight_filler { 99 | type: "gaussian" 100 | std: 0.3 101 | } 102 | bias_filler { 103 | type: "constant" 104 | } 105 | } 106 | } 107 | layer { 108 | name: "relu2" 109 | type: "ReLU" 110 | bottom: "conv2" 111 | top: "conv2" 112 | } 113 | layer { 114 | name: "pool2" 115 | type: "Pooling" 116 | bottom: "conv2" 117 | top: "pool2" 118 | pooling_param { 119 | pool: MAX 120 | kernel_size: 2 121 | stride: 2 122 | } 123 | } 124 | 125 | layer { 126 | name: "conv3" 127 | type: "Convolution" 128 | bottom: "pool2" 129 | top: "conv3" 130 | param { 131 | lr_mult: 1 132 | decay_mult: 1 133 | } 134 | param { 135 | lr_mult: 2 136 | decay_mult: 0 137 | } 138 | convolution_param { 139 | num_output: 64 140 | kernel_size: 5 141 | stride: 1 142 | pad: 2 143 | weight_filler { 144 | type: "gaussian" 145 | std: 0.001 146 | } 147 | bias_filler { 148 | type: "constant" 149 | } 150 | } 151 | } 152 | layer { 153 | name: "relu3" 154 | type: "ReLU" 155 | bottom: "conv3" 156 | top: "conv3" 157 | } 158 | 159 | layer { 160 | name: "conv4" 161 | type: "Convolution" 162 | bottom: "conv3" 163 | top: "conv4" 164 | param { 165 | lr_mult: 1 166 | decay_mult: 1 167 | } 168 | param { 169 | lr_mult: 2 170 | decay_mult: 0 171 | } 172 | convolution_param { 173 | num_output: 1000 174 | kernel_size: 1 175 | stride: 1 176 | pad: 0 177 | weight_filler { 178 | type: "gaussian" 179 | std: 0.3 180 | } 181 | bias_filler { 182 | type: "constant" 183 | # value: 1 184 | } 185 | } 186 | } 187 | layer { 188 | name: "relu4" 189 | type: "ReLU" 190 | bottom: "conv4" 191 | top: "conv4" 192 | } 193 | 194 | layer { 195 | name: "conv5" 196 | type: "Convolution" 197 | bottom: "conv4" 198 | top: "conv5" 199 | param { 200 | lr_mult: 1 201 | decay_mult: 1 202 | } 203 | param { 204 | lr_mult: 2 205 | decay_mult: 0 206 | } 207 | convolution_param { 208 | num_output: 400 209 | kernel_size: 1 210 | stride: 1 211 | pad: 0 212 | weight_filler { 213 | type: "gaussian" 214 | std: 0.1 215 | } 216 | bias_filler { 217 | type: "constant" 218 | # value: 1 219 | } 220 | } 221 | } 222 | layer { 223 | name: "relu5" 224 | type: "ReLU" 225 | bottom: "conv5" 226 | top: "conv5" 227 | } 228 | 229 | layer { 230 | name: "conv6" 231 | type: "Convolution" 232 | bottom: "conv5" 233 | top: "conv6" 234 | param { 235 | lr_mult: 1 236 | decay_mult: 1 237 | } 238 | param { 239 | lr_mult: 2 240 | decay_mult: 0 241 | } 242 | convolution_param { 243 | num_output: 1 244 | kernel_size: 1 245 | stride: 1 246 | pad: 0 247 | weight_filler { 248 | type: "constant" 249 | value: 0 250 | } 251 | bias_filler { 252 | type: "constant" 253 | # value: 1 254 | } 255 | } 256 | } 257 | 258 | layer { 259 | name: "loss" 260 | type: "EuclideanLoss" 261 | bottom: "conv6" 262 | bottom: "label" 263 | top: "loss" 264 | } 265 | -------------------------------------------------------------------------------- /tools/gen_ucsd_dataset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | @author: Daniel Oñoro Rubio 6 | @organization: GRAM, University of Alcalá, Alcalá de Henares, Spain 7 | @copyright: See LICENSE.txt 8 | @contact: daniel.onoro@edu.uah.es 9 | @date: Created on Jun 15, 2015 10 | ''' 11 | 12 | """ 13 | This script creates the "maximal", "downscale", "upscale" and "minimal" 14 | datasets for training and testing. 15 | """ 16 | 17 | import sys, getopt, os 18 | import glob 19 | import numpy as np 20 | 21 | def dispHelp(arg0): 22 | print "======================================================" 23 | print " Usage" 24 | print "======================================================" 25 | print "\t-h display this message" 26 | print "\t--imfolder " 27 | print "\t--setsfolder " 28 | 29 | 30 | def main(argv): 31 | conf_folder = './image_sets/' 32 | img_folder = './images/' 33 | 34 | # Get parameters 35 | try: 36 | opts, _ = getopt.getopt(argv, "h:", ["imfolder=", "setsfolder="]) 37 | except getopt.GetoptError as err: 38 | print "Error while parsing parameters: ", err 39 | dispHelp(argv[0]) 40 | return 41 | 42 | for opt, arg in opts: 43 | if opt == '-h': 44 | dispHelp(argv[0]) 45 | return 46 | elif opt in ("--imfolder"): 47 | img_folder = arg 48 | elif opt in ("--setsfolder"): 49 | conf_folder = arg 50 | 51 | # Get UCSD image names 52 | image_names = glob.glob(os.path.join( img_folder, '*[0-9].png') ) 53 | # Sort frames by name 54 | image_names = sorted(image_names) 55 | 56 | n_imgs = len(image_names) 57 | 58 | # Generate Maximal dataset 59 | # Traning 60 | training_f = open(os.path.join(conf_folder,'training_maximal.txt'),'w') 61 | for ix in range(600, 1400+5,5): 62 | slash_pos = image_names[ix].rfind('/') 63 | name = image_names[ix][slash_pos + 1 : ] 64 | print name 65 | training_f.write( name + '\n' ) 66 | training_f.close() 67 | 68 | # Testing 69 | testing_f = open(os.path.join(conf_folder, 'testing_maximal.txt'),'w') 70 | for ix in range(600, 1400+5): 71 | # Check if it belongs to training set 72 | if ix % 5 == 0: 73 | continue 74 | 75 | slash_pos = image_names[ix].rfind('/') 76 | name = image_names[ix][slash_pos + 1 : ] 77 | print name 78 | testing_f.write( name + '\n' ) 79 | testing_f.close() 80 | 81 | 82 | # Generate Downscale dataset 83 | # Traning 84 | training_f = open(os.path.join(conf_folder,'training_downscale.txt'),'w') 85 | for ix in range(1205, 1600+5,5): 86 | slash_pos = image_names[ix].rfind('/') 87 | name = image_names[ix][slash_pos + 1 : ] 88 | print name 89 | training_f.write( name + '\n' ) 90 | training_f.close() 91 | 92 | # Testing 93 | testing_f = open(os.path.join(conf_folder,'testing_downscale.txt'),'w') 94 | for ix in range(1205, 1600+5): 95 | # Check if it belongs to training set 96 | if ix % 5 == 0: 97 | continue 98 | 99 | slash_pos = image_names[ix].rfind('/') 100 | name = image_names[ix][slash_pos + 1 : ] 101 | print name 102 | testing_f.write( name + '\n' ) 103 | testing_f.close() 104 | 105 | # Generate Upscale dataset 106 | # Traning 107 | training_f = open(os.path.join(conf_folder,'training_upscale.txt'),'w') 108 | for ix in range(805, 1100+5,5): 109 | slash_pos = image_names[ix].rfind('/') 110 | name = image_names[ix][slash_pos + 1 : ] 111 | print name 112 | training_f.write( name + '\n' ) 113 | training_f.close() 114 | 115 | # Testing 116 | testing_f = open(os.path.join(conf_folder,'testing_upscale.txt'),'w') 117 | for ix in range(805, 1100+5): 118 | # Check if it belongs to training set 119 | if ix % 5 == 0: 120 | continue 121 | 122 | slash_pos = image_names[ix].rfind('/') 123 | name = image_names[ix][slash_pos + 1 : ] 124 | print name 125 | testing_f.write( name + '\n' ) 126 | testing_f.close() 127 | 128 | # Generate Minimal dataset 129 | # Traning 130 | training_f = open(os.path.join(conf_folder,'training_minimal.txt'),'w') 131 | for ix in range(640, 1360+80,80): 132 | slash_pos = image_names[ix].rfind('/') 133 | name = image_names[ix][slash_pos + 1 : ] 134 | print name 135 | training_f.write( name + '\n' ) 136 | training_f.close() 137 | 138 | # Testing 139 | testing_f = open(os.path.join(conf_folder,'testing_minimal.txt'),'w') 140 | for ix in range(640, 1360+80): 141 | # Check if it belongs to training set 142 | if ix % 80 == 0: 143 | continue 144 | 145 | slash_pos = image_names[ix].rfind('/') 146 | name = image_names[ix][slash_pos + 1 : ] 147 | print name 148 | testing_f.write( name + '\n' ) 149 | testing_f.close() 150 | 151 | 152 | return 0 153 | 154 | if __name__ == '__main__': 155 | main(sys.argv[1:]) 156 | -------------------------------------------------------------------------------- /models/ucf/ccnn/ccnn_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCF_CNN" 2 | 3 | layer { 4 | name: "data" 5 | type: "HDF5Data" 6 | top: "data_s0" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/train.txt" 13 | batch_size: 16 14 | shuffle: true 15 | } 16 | } 17 | 18 | #layer { 19 | # name: "data" 20 | # type: "HDF5Data" 21 | # top: "data_s0" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/test.txt" 28 | # batch_size: 16 29 | # #shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.0001 55 | } 56 | # weight_filler { 57 | # type: "xavier" 58 | # } 59 | bias_filler { 60 | type: "constant" 61 | # value: 1 62 | } 63 | } 64 | } 65 | layer { 66 | name: "relu1" 67 | type: "ReLU" 68 | bottom: "conv1" 69 | top: "conv1" 70 | } 71 | layer { 72 | name: "pool1" 73 | type: "Pooling" 74 | bottom: "conv1" 75 | top: "pool1" 76 | pooling_param { 77 | pool: MAX 78 | kernel_size: 2 79 | stride: 2 80 | } 81 | } 82 | 83 | layer { 84 | name: "conv2" 85 | type: "Convolution" 86 | bottom: "pool1" 87 | top: "conv2" 88 | param { 89 | lr_mult: 1 90 | decay_mult: 1 91 | } 92 | param { 93 | lr_mult: 2 94 | decay_mult: 0 95 | } 96 | convolution_param { 97 | num_output: 32 98 | pad: 3 99 | kernel_size: 7 100 | stride: 1 101 | # weight_filler { 102 | # type: "xavier" 103 | # } 104 | weight_filler { 105 | type: "gaussian" 106 | std: 0.01 107 | } 108 | bias_filler { 109 | type: "constant" 110 | # value: 1 111 | } 112 | } 113 | } 114 | layer { 115 | name: "relu2" 116 | type: "ReLU" 117 | bottom: "conv2" 118 | top: "conv2" 119 | } 120 | layer { 121 | name: "pool2" 122 | type: "Pooling" 123 | bottom: "conv2" 124 | top: "pool2" 125 | pooling_param { 126 | pool: MAX 127 | kernel_size: 2 128 | stride: 2 129 | } 130 | } 131 | 132 | layer { 133 | name: "conv3" 134 | type: "Convolution" 135 | bottom: "pool2" 136 | top: "conv3" 137 | param { 138 | lr_mult: 1 139 | decay_mult: 1 140 | } 141 | param { 142 | lr_mult: 2 143 | decay_mult: 0 144 | } 145 | convolution_param { 146 | num_output: 64 147 | kernel_size: 5 148 | stride: 1 149 | pad: 2 150 | weight_filler { 151 | type: "gaussian" 152 | std: 0.3 153 | } 154 | # weight_filler { 155 | # type: "xavier" 156 | # } 157 | bias_filler { 158 | type: "constant" 159 | # value: 1 160 | } 161 | } 162 | } 163 | layer { 164 | name: "relu3" 165 | type: "ReLU" 166 | bottom: "conv3" 167 | top: "conv3" 168 | } 169 | 170 | layer { 171 | name: "conv4" 172 | type: "Convolution" 173 | bottom: "conv3" 174 | top: "conv4" 175 | param { 176 | lr_mult: 1 177 | decay_mult: 1 178 | } 179 | param { 180 | lr_mult: 2 181 | decay_mult: 0 182 | } 183 | convolution_param { 184 | num_output: 1000 185 | kernel_size: 1 186 | stride: 1 187 | pad: 0 188 | weight_filler { 189 | type: "gaussian" 190 | std: 0.2 191 | } 192 | # weight_filler { 193 | # type: "xavier" 194 | # } 195 | bias_filler { 196 | type: "constant" 197 | # value: 1 198 | } 199 | } 200 | } 201 | 202 | layer { 203 | name: "relu4" 204 | type: "ReLU" 205 | bottom: "conv4" 206 | top: "conv4" 207 | } 208 | 209 | layer { 210 | name: "conv5" 211 | type: "Convolution" 212 | bottom: "conv4" 213 | top: "conv5" 214 | param { 215 | lr_mult: 1 216 | decay_mult: 1 217 | } 218 | param { 219 | lr_mult: 2 220 | decay_mult: 0 221 | } 222 | convolution_param { 223 | num_output: 400 224 | kernel_size: 1 225 | stride: 1 226 | pad: 0 227 | weight_filler { 228 | type: "gaussian" 229 | std: 0.005 230 | } 231 | # weight_filler { 232 | # type: "xavier" 233 | # } 234 | bias_filler { 235 | type: "constant" 236 | # value: 1 237 | } 238 | } 239 | } 240 | 241 | layer { 242 | name: "relu5" 243 | type: "ReLU" 244 | bottom: "conv5" 245 | top: "conv5" 246 | } 247 | 248 | layer { 249 | name: "fc6" 250 | type: "InnerProduct" 251 | bottom: "conv5" 252 | top: "fc6" 253 | param { 254 | lr_mult: 1 255 | decay_mult: 1 256 | } 257 | param { 258 | lr_mult: 2 259 | decay_mult: 0 260 | } 261 | inner_product_param { 262 | num_output: 324 263 | # weight_filler { 264 | # type: "gaussian" 265 | # std: 0.005 266 | # } 267 | weight_filler { 268 | type: "constant" 269 | value: 0 270 | } 271 | # weight_filler { 272 | # type: "xavier" 273 | # } 274 | bias_filler { 275 | type: "constant" 276 | # value: 1 277 | } 278 | } 279 | } 280 | 281 | 282 | # Loss Layers and Test 283 | ################################################################################ 284 | layer { 285 | name: "loss" 286 | type: "EuclideanLoss" 287 | bottom: "fc6" 288 | bottom: "label" 289 | top: "loss" 290 | } 291 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Towards perspective-free object counting with deep learning 2 | 3 | By [Daniel Oñoro-Rubio](https://es.linkedin.com/in/daniel-oñoro-71062756) and [Roberto J. López-Sastre](https://gram.web.uah.es/people/rober/). 4 | 5 | GRAM, University of Alcalá, Alcalá de Henares, Spain. 6 | 7 | This is the official code repository of the work described in our [ECCV 2016 paper](https://gram.web.uah.es/data/publications/eccv2016-onoro.pdf). 8 | 9 | 10 | This repository provides the implementation of CCNN and Hydra models for object counting. 11 | 12 | ## Cite us 13 | 14 | Was our code useful for you? Please cite us: 15 | 16 | @inproceedings{onoro2016, 17 | Author = {O\~noro-Rubio, D. and L\'opez-Sastre, R.~J.}, 18 | Title = {Towards perspective-free object counting with deep learning}, 19 | Booktitle = {ECCV}, 20 | Year = {2016} 21 | } 22 | 23 | 24 | ## License 25 | 26 | The license information of this project is described in the file "LICENSE.txt". 27 | 28 | 29 | 30 | ## Contents 31 | 1. [Requirements: software](#requirements-software) 32 | 2. [Requirements: hardware](#requirements-hardware) 33 | 3. [Basic installation](#basic-installation-sufficient-for-the-demo) 34 | 4. [Demo](#demo) 35 | 5. [How to reproduce the results of the paper](#how-to-reproduce-the-results-of-the-paper) 36 | 6. [Remarks](#remarks) 37 | 7. [Acknowledgements](#acknowledgements) 38 | 39 | ### Requirements: software 40 | 41 | 1. Use a Linux distribution. We have developed and tested the code on [Ubuntu](http://www.ubuntu.com/). 42 | 43 | 2. [Python 2.7](https://www.python.org/download/releases/2.7/). 44 | 45 | 3. Requirements for `Caffe` and `pycaffe`. Follow the [Caffe installation instructions](http://caffe.berkeleyvision.org/installation.html). 46 | 47 | **Note:** Caffe *must* be built with support for Python layers! 48 | 49 | ```make 50 | # In your Makefile.config, make sure to have this line uncommented 51 | WITH_PYTHON_LAYER := 1 52 | ``` 53 | 54 | 4. Python packages you need: `cython`, `python-opencv`, `python-h5py`, `easydict`, `pillow (version >= 3.4.2)`. 55 | 56 | 57 | ### Requirements: hardware 58 | 59 | This code allows the usage of CPU and GPU, but we strongly recommend the usage of GPU. 60 | 61 | 1. For training, we recommend using a GPU with at least 3GB of memory. 62 | 63 | 2. For testing, a GPU with 2GB of memory is enough. 64 | 65 | ### Basic installation (sufficient for the demo) 66 | 67 | 1. Be sure you have added to your `PATH` the `tools` directory of your `Caffe` installation: 68 | 69 | ```Shell 70 | export PATH=/build/tools:$PATH 71 | ``` 72 | 73 | 2. Be sure you have added your `pycaffe` compilation into your `PYTHONPATH`: 74 | 75 | ```Shell 76 | export PYTHONPATH=/python:$PYTHONPATH 77 | ``` 78 | 79 | ### Demo 80 | 81 | Here, we provide a demo for predicting the number of vehicles in the test images of the [TRANCOS dataset](https://gram.web.uah.es/data/datasets/trancos/index.html), which was used in our ECCV paper. 82 | 83 | This demo uses the CCNN model described in the paper. The results reported in the paper can be reproduced with this demo. 84 | 85 | To run the demo, these are the steps to follow: 86 | 87 | 1. Download the [TRANCOS dataset](https://gram.web.uah.es/data/datasets/trancos/index.html) and extract it in the path `data/TRANCOS`. 88 | 89 | 2. Download our TRANCOS CCNN pretrained model. Follow the instructions detailed [here](tools/get_trancos_model.md) 90 | 91 | 3. Finally, to run the demo, simply execute the following command: 92 | ```Shell 93 | ./tools/demo.sh 94 | ``` 95 | 96 | ### How to reproduce the results of the paper? 97 | 98 | We provide the scripts needed to **train** and **test** our models (CCNN and Hydra) on the datasets used in our ECCV paper. These are the steps to follow: 99 | 100 | #### Download a dataset 101 | 102 | To download and set up a dataset we recommend following these instructions: 103 | 104 | * [TRANCOS dataset](https://gram.web.uah.es/data/datasets/trancos/index.html): Download it using this [direct link](https://universidaddealcala-my.sharepoint.com/:u:/g/personal/gram_uah_es/Eank6osXQgxEqa-1bb0nVsoBc3xO4XDwENc_g0nc6t58BA?&Download=1), and extract the file in the path `data/TRANCOS`. 105 | 106 | * [UCSD dataset](http://www.svcl.ucsd.edu/projects/peoplecnt/): just place yourself in the $PROJECT directory and run the following script 107 | 108 | ```Shell 109 | ./tools/get_ucsd.sh 110 | ``` 111 | * [UCF dataset](http://crcv.ucf.edu/data/crowd_counting.php): just place yourself in the $PROJECT directory and run the following script 112 | 113 | ```Shell 114 | ./tools/get_ucf.sh 115 | ``` 116 | 117 | **Note:** Make sure the folder "data/" does not already contain the dataset. 118 | 119 | 120 | #### Download pre-trained models 121 | 122 | All our pre-trained models can be downloaded following these instructions: 123 | 1. [TRANCOS Models](tools/get_all_trancos_models.md) 124 | 2. [UCSD Models](tools/get_all_ucsd_models.md) 125 | 3. [UCF Models](tools/get_all_ucf_models.md) 126 | 127 | #### Test the pretrained models 128 | 1. Edit the corresponding script $PROJECT/experiments/scripts/DATASET_CHOSEN_test_pretrained.sh 129 | 130 | 2. Run the corresponding scripts. 131 | 132 | ```Shell 133 | ./experiments/scripts/DATASET_CHOSEN_test_pretrained.sh 134 | ``` 135 | 136 | Note that the pre-trained models will let you reproduce the results in our paper. 137 | 138 | 139 | #### Train/test the model chosen 140 | 141 | 1. Edit the launching script (e.g.: $PROJECT/experiments/scripts/DATASET_CHOSEN_train_test.sh). 142 | 143 | 2. Place you in $PROJECT folder and run the launching script by typing: 144 | ```Shell 145 | ./experiments/scripts/DATASET_CHOSEN_train_test.sh 146 | ``` 147 | 148 | 149 | ### Remarks 150 | 151 | To provide a better distribution, this repository *unifies and reimplements* in Python some of the original modules. Due to these changes in the libraries used, the results produced by this software might be slightly different from the ones reported in the paper. 152 | 153 | 154 | ### Acknowledgements 155 | This work is supported by the projects of the DGT with references SPIP2014-1468 and SPIP2015-01809, and the project of the MINECO TEC2013-45183-R. 156 | -------------------------------------------------------------------------------- /src/utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import glob 3 | import vigra 4 | import numpy as np 5 | import scipy.io 6 | from skimage.transform import resize 7 | 8 | def resizeMaxSize(im, max_size): 9 | """ 10 | Resize an image leting its maximun size to max_size without modifing its 11 | aspect ratio. 12 | @param im: input image 13 | @param max_size: maxinum size 14 | @return: resized image 15 | """ 16 | 17 | h,w = im.shape[0:2] 18 | 19 | im_resized = None 20 | if w > h: 21 | s = float(max_size)/w 22 | im_resized = resize(im, (int(h*s), max_size)) 23 | else: 24 | s = float(max_size)/h 25 | im_resized = resize(im, (max_size, int(w*s))) 26 | 27 | return im_resized 28 | 29 | def cfgFromFile(filename): 30 | """Load a config file.""" 31 | import yaml 32 | from easydict import EasyDict as edict 33 | with open(filename, 'r') as f: 34 | yaml_cfg = edict(yaml.load(f)) 35 | 36 | return yaml_cfg 37 | 38 | def cartesian(arrays, out=None): 39 | """ 40 | Generate a cartesian product of input arrays. 41 | 42 | Parameters 43 | ---------- 44 | arrays : list of array-like 45 | 1-D arrays to form the cartesian product of. 46 | out : ndarray 47 | Array to place the cartesian product in. 48 | 49 | Returns 50 | ------- 51 | out : ndarray 52 | 2-D array of shape (M, len(arrays)) containing cartesian products 53 | formed of input arrays. 54 | 55 | Examples 56 | -------- 57 | >>> cartesian(([1, 2, 3], [4, 5], [6, 7])) 58 | array([[1, 4, 6], 59 | [1, 4, 7], 60 | [1, 5, 6], 61 | [1, 5, 7], 62 | [2, 4, 6], 63 | [2, 4, 7], 64 | [2, 5, 6], 65 | [2, 5, 7], 66 | [3, 4, 6], 67 | [3, 4, 7], 68 | [3, 5, 6], 69 | [3, 5, 7]]) 70 | 71 | """ 72 | 73 | arrays = [np.asarray(x) for x in arrays] 74 | dtype = arrays[0].dtype 75 | 76 | n = np.prod([x.size for x in arrays]) 77 | if out is None: 78 | out = np.zeros([n, len(arrays)], dtype=dtype) 79 | 80 | m = n / arrays[0].size 81 | out[:,0] = np.repeat(arrays[0], m) 82 | if arrays[1:]: 83 | cartesian(arrays[1:], out=out[0:m,1:]) 84 | for j in xrange(1, arrays[0].size): 85 | out[j*m:(j+1)*m,1:] = out[0:m,1:] 86 | return out 87 | 88 | def get_dense_pos(heith, width, pw, stride = 1): 89 | ''' 90 | @brief: Generate a dense list of patch position. 91 | @param heith: image height. 92 | @param width: image width. 93 | @param pw: patch with. 94 | @param stride: stride. 95 | @return: returns a list with the patches positions. 96 | ''' 97 | # Compute patch halfs 98 | dx=dy=pw/2 99 | # Create a combination which corresponds to all the points of a dense 100 | # extraction 101 | pos = cartesian( (range(dx, heith - dx, stride), range(dy, width -dy, stride) ) ) 102 | # return pos 103 | bot_line = cartesian( (heith - dx -1, range(dy, width -dy, stride) ) ) 104 | right_line = cartesian( (range(dx, heith - dx, stride), width -dy - 1) ) 105 | return np.vstack( (pos, bot_line, right_line) ) 106 | 107 | 108 | def cropPerspective(im, pos, pmap, pw): 109 | ''' 110 | @brief: Crop patches from im at the position pos with a width of pw multiply 111 | by the perspective map at pmap. 112 | @param im: input image. 113 | @param pos: position list. 114 | @param pw: patch with. 115 | @return: returns a list with the patches. 116 | ''' 117 | 118 | dx=dy=pw/2 119 | 120 | lpatch = [] 121 | for p in pos: 122 | # Get gain 123 | g = pmap[p[0],p[1]] 124 | aux_pw = pw / g 125 | 126 | # Diferential 127 | dx=dy=int(aux_pw/2) 128 | 129 | x,y=p 130 | sx=slice(x-dx,x+dx+1,None) 131 | sy=slice(y-dy,y+dy+1,None) 132 | 133 | # Compute patch size 134 | sx_size = sx.stop - sx.start 135 | sy_size = sy.stop - sy.start 136 | 137 | crop_im=im[sx,sy,...] 138 | 139 | # print crop_im.shape 140 | h, w = crop_im.shape[0:2] 141 | 142 | if h!=w or (h<=0): 143 | # print "Patch out of boundaries: ", h, w 144 | continue 145 | 146 | lpatch.append(crop_im) 147 | 148 | return lpatch 149 | 150 | def resizeDensityPatch(patch, opt_size): 151 | ''' 152 | @brief: Take a density map and resize it to the opt_size. 153 | @param patch: input density map. 154 | @param opt_size: output size. 155 | @return: returns resized version of the density map. 156 | ''' 157 | # Get patch size 158 | h, w = patch.shape[0:2] 159 | 160 | # Total sum 161 | patch_sum = patch.sum() 162 | 163 | # Normalize values between 0 and 1. It is in order to performa a resize. 164 | p_max = patch.max() 165 | p_min = patch.min() 166 | # Avoid 0 division 167 | if patch_sum !=0: 168 | patch = (patch - p_min)/(p_max - p_min) 169 | 170 | # Resize 171 | patch = resize(patch, opt_size) 172 | 173 | # Return back to the previous scale 174 | patch = patch*(p_max - p_min) + p_min 175 | 176 | # Keep count 177 | res_sum = patch.sum() 178 | if res_sum != 0: 179 | return patch * (patch_sum/res_sum) 180 | 181 | return patch 182 | 183 | def resizeListDens(patch_list, psize): 184 | for ix, patch in enumerate(patch_list): 185 | # Keep count 186 | patch_list[ix] = resizeDensityPatch(patch, psize) 187 | 188 | return patch_list 189 | 190 | def resizePatches(patch_list, psize): 191 | for ix, patch in enumerate(patch_list): 192 | # Get patch size 193 | h, w, _ = patch.shape 194 | 195 | # Resize 196 | patch = resize(patch, psize) 197 | patch_list[ix] = patch 198 | 199 | return patch_list 200 | 201 | def genRandomPos(imSize, pw, N): 202 | ih=imSize[0] 203 | iw=imSize[1] 204 | 205 | dx=dy=pw/2 206 | 207 | y=np.random.randint(dy,iw-dy,N).reshape(N,1) 208 | x=np.random.randint(dx,ih-dx,N).reshape(N,1) 209 | 210 | return np.hstack((x,y)) 211 | 212 | def batch(iterable, n = 1): 213 | ''' 214 | @brief: Batch an iterable object. 215 | Example: 216 | for x in batch(range(0, 10), 3): 217 | ... print x 218 | ... 219 | [0, 1, 2] 220 | [3, 4, 5] 221 | [6, 7, 8] 222 | [9] 223 | @param iterable: iterable object. 224 | @param n: batch size. 225 | @return splits: return the iterable object splits 226 | ''' 227 | 228 | l = len(iterable) 229 | for ndx in range(0, l, n): 230 | yield iterable[ndx:min(ndx+n, l)] 231 | 232 | 233 | def extendName(name, im_folder, use_ending=False, pattern=[]): 234 | ''' 235 | @brief: This gets a file name format and adds the root directory and change 236 | the extension if needed 237 | @param fname: file name. 238 | @param im_folder: im_folder path to add to each file name. 239 | @param use_ending: flag use to change the file extension. 240 | @param pattern: string that will substitute the original file ending. 241 | @return new_name: list which contains all the converted names. 242 | ''' 243 | final_name = im_folder + os.path.sep + name 244 | 245 | if use_ending: 246 | l_dot = final_name.rfind('.') 247 | final_name = final_name[0:l_dot] + pattern 248 | 249 | return final_name 250 | 251 | def extendImNames(txt_file, im_folder, use_ending=False, pattern=[]): 252 | ''' 253 | @brief: This function gets a txt file that contains a list of file names 254 | and extend each name with the path to the root folder and/or change the 255 | extension. 256 | @param txt_file: text file which contains a file name list. 257 | @param im_folder: im_folder path to add to each file name. 258 | @param use_ending: flag use to change the file extension. 259 | @param pattern: string that will substitute the original file ending. 260 | @return: names_list: list which contains all the converted names. 261 | ''' 262 | txt_names = np.loadtxt(txt_file, dtype='str') 263 | 264 | names = [] 265 | for name in txt_names: 266 | final_name = extendName(name, im_folder, use_ending, pattern) 267 | names.append(final_name) 268 | 269 | return names 270 | 271 | def importImagesFolder(im_names, skip=1, stop=-1, verbose=True): 272 | '''import all images from a folder that follow a certain pattern''' 273 | 274 | count = 0 275 | imgs = [] 276 | for name in im_names[::skip]: 277 | if verbose: print name 278 | img = vigra.impex.readImage(name).view(np.ndarray).swapaxes(0, 1).squeeze() 279 | imgs.append(img) 280 | count += 1 281 | if count >= stop and stop != -1: 282 | break 283 | 284 | return imgs 285 | 286 | def getMasks(fnames): 287 | 288 | masks = [] 289 | for name in fnames: 290 | bw = scipy.io.loadmat(name, chars_as_strings=1, matlab_compatible=1) 291 | masks.append(bw.get('BW')) 292 | 293 | return masks 294 | 295 | 296 | def shuffleWithIndex(listv, seed=None): 297 | # Shuffle a list and return the indexes 298 | if seed != None: np.random.seed(seed) 299 | listvp = np.asarray(listv, dtype=object) 300 | ind = np.arange(len(listv)) 301 | ind = np.random.permutation(ind) 302 | listvp = listvp[ind] 303 | listvp = list(listvp) 304 | return listvp, ind 305 | 306 | 307 | def takeIndexFromList(listv, ind): 308 | listvp = np.asarray(listv, dtype=object) 309 | return list(listvp[ind]) 310 | 311 | 312 | def shuffleRows(array): 313 | ind = np.arange(array.shape[0]) 314 | np.random.shuffle(ind) 315 | array = np.take(array, ind, axis=0) 316 | return array, ind 317 | 318 | def generateRandomOdd(pwbase, treeCount): 319 | # Generate random odd numbers in the interavel [0,pwbase] 320 | res = [] 321 | count = 0 322 | while count < treeCount: 323 | ext = np.random.randint(0, pwbase, 1) 324 | if np.mod(ext, 2) == 1: 325 | res.append(ext) 326 | count += 1 327 | 328 | return res 329 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | input: "data_s0" 3 | input_dim: 1 4 | input_dim: 1 5 | input_dim: 72 6 | input_dim: 72 7 | 8 | input: "data_s1" 9 | input_dim: 1 10 | input_dim: 1 11 | input_dim: 72 12 | input_dim: 72 13 | 14 | layer { 15 | name: "head0_conv1" 16 | type: "Convolution" 17 | bottom: "data_s0" 18 | top: "head0_conv1" 19 | param { 20 | lr_mult: 1 21 | decay_mult: 1 22 | } 23 | param { 24 | lr_mult: 2 25 | decay_mult: 0 26 | } 27 | convolution_param { 28 | num_output: 32 29 | pad: 3 30 | kernel_size: 7 31 | stride: 1 32 | weight_filler { 33 | type: "gaussian" 34 | std: 0.01 35 | } 36 | # weight_filler { 37 | # type: "xavier" 38 | # } 39 | bias_filler { 40 | type: "constant" 41 | # value: 1 42 | } 43 | } 44 | } 45 | layer { 46 | name: "head0_relu1" 47 | type: "ReLU" 48 | bottom: "head0_conv1" 49 | top: "head0_conv1" 50 | } 51 | layer { 52 | name: "head0_pool1" 53 | type: "Pooling" 54 | bottom: "head0_conv1" 55 | top: "head0_pool1" 56 | pooling_param { 57 | pool: MAX 58 | kernel_size: 2 59 | stride: 2 60 | } 61 | } 62 | 63 | layer { 64 | name: "head0_conv2" 65 | type: "Convolution" 66 | bottom: "head0_pool1" 67 | top: "head0_conv2" 68 | param { 69 | lr_mult: 1 70 | decay_mult: 1 71 | } 72 | param { 73 | lr_mult: 2 74 | decay_mult: 0 75 | } 76 | convolution_param { 77 | num_output: 32 78 | pad: 3 79 | kernel_size: 7 80 | stride: 1 81 | # weight_filler { 82 | # type: "xavier" 83 | # } 84 | weight_filler { 85 | type: "gaussian" 86 | std: 0.2 87 | } 88 | bias_filler { 89 | type: "constant" 90 | # value: 1 91 | } 92 | } 93 | } 94 | layer { 95 | name: "head0_relu2" 96 | type: "ReLU" 97 | bottom: "head0_conv2" 98 | top: "head0_conv2" 99 | } 100 | layer { 101 | name: "head0_pool2" 102 | type: "Pooling" 103 | bottom: "head0_conv2" 104 | top: "head0_pool2" 105 | pooling_param { 106 | pool: MAX 107 | kernel_size: 2 108 | stride: 2 109 | } 110 | } 111 | 112 | layer { 113 | name: "head0_conv3" 114 | type: "Convolution" 115 | bottom: "head0_pool2" 116 | top: "head0_conv3" 117 | param { 118 | lr_mult: 1 119 | decay_mult: 1 120 | } 121 | param { 122 | lr_mult: 2 123 | decay_mult: 0 124 | } 125 | convolution_param { 126 | num_output: 64 127 | kernel_size: 5 128 | stride: 1 129 | pad: 2 130 | weight_filler { 131 | type: "gaussian" 132 | std: 0.0001 133 | } 134 | # weight_filler { 135 | # type: "xavier" 136 | # } 137 | bias_filler { 138 | type: "constant" 139 | # value: 1 140 | } 141 | } 142 | } 143 | layer { 144 | name: "head0_relu3" 145 | type: "ReLU" 146 | bottom: "head0_conv3" 147 | top: "head0_conv3" 148 | } 149 | 150 | layer { 151 | name: "head0_conv4" 152 | type: "Convolution" 153 | bottom: "head0_conv3" 154 | top: "head0_conv4" 155 | param { 156 | lr_mult: 1 157 | decay_mult: 1 158 | } 159 | param { 160 | lr_mult: 2 161 | decay_mult: 0 162 | } 163 | convolution_param { 164 | num_output: 1000 165 | kernel_size: 1 166 | stride: 1 167 | pad: 0 168 | weight_filler { 169 | type: "gaussian" 170 | std: 0.35 171 | } 172 | # weight_filler { 173 | # type: "xavier" 174 | # } 175 | bias_filler { 176 | type: "constant" 177 | # value: 1 178 | } 179 | } 180 | } 181 | 182 | layer { 183 | name: "head0_relu4" 184 | type: "ReLU" 185 | bottom: "head0_conv4" 186 | top: "head0_conv4" 187 | } 188 | 189 | layer { 190 | name: "head0_conv5" 191 | type: "Convolution" 192 | bottom: "head0_conv4" 193 | top: "head0_conv5" 194 | param { 195 | lr_mult: 1 196 | decay_mult: 1 197 | } 198 | param { 199 | lr_mult: 2 200 | decay_mult: 0 201 | } 202 | convolution_param { 203 | num_output: 400 204 | kernel_size: 1 205 | stride: 1 206 | pad: 0 207 | weight_filler { 208 | type: "gaussian" 209 | std: 0.1 210 | } 211 | # weight_filler { 212 | # type: "xavier" 213 | # } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | 221 | layer { 222 | name: "head0_relu5" 223 | type: "ReLU" 224 | bottom: "head0_conv5" 225 | top: "head0_conv5" 226 | } 227 | 228 | 229 | # Convolutional Layers 230 | ################################################################################ 231 | layer { 232 | name: "head1_conv1" 233 | type: "Convolution" 234 | bottom: "data_s1" 235 | top: "head1_conv1" 236 | param { 237 | lr_mult: 1 238 | decay_mult: 1 239 | } 240 | param { 241 | lr_mult: 2 242 | decay_mult: 0 243 | } 244 | convolution_param { 245 | num_output: 32 246 | pad: 3 247 | kernel_size: 7 248 | stride: 1 249 | weight_filler { 250 | type: "gaussian" 251 | std: 0.01 252 | } 253 | # weight_filler { 254 | # type: "xavier" 255 | # } 256 | bias_filler { 257 | type: "constant" 258 | # value: 1 259 | } 260 | } 261 | } 262 | layer { 263 | name: "head1_relu1" 264 | type: "ReLU" 265 | bottom: "head1_conv1" 266 | top: "head1_conv1" 267 | } 268 | layer { 269 | name: "head1_pool1" 270 | type: "Pooling" 271 | bottom: "head1_conv1" 272 | top: "head1_pool1" 273 | pooling_param { 274 | pool: MAX 275 | kernel_size: 2 276 | stride: 2 277 | } 278 | } 279 | 280 | layer { 281 | name: "head1_conv2" 282 | type: "Convolution" 283 | bottom: "head1_pool1" 284 | top: "head1_conv2" 285 | param { 286 | lr_mult: 1 287 | decay_mult: 1 288 | } 289 | param { 290 | lr_mult: 2 291 | decay_mult: 0 292 | } 293 | convolution_param { 294 | num_output: 32 295 | pad: 3 296 | kernel_size: 7 297 | stride: 1 298 | # weight_filler { 299 | # type: "xavier" 300 | # } 301 | weight_filler { 302 | type: "gaussian" 303 | std: 0.2 304 | } 305 | bias_filler { 306 | type: "constant" 307 | # value: 1 308 | } 309 | } 310 | } 311 | layer { 312 | name: "head1_relu2" 313 | type: "ReLU" 314 | bottom: "head1_conv2" 315 | top: "head1_conv2" 316 | } 317 | layer { 318 | name: "head1_pool2" 319 | type: "Pooling" 320 | bottom: "head1_conv2" 321 | top: "head1_pool2" 322 | pooling_param { 323 | pool: MAX 324 | kernel_size: 2 325 | stride: 2 326 | } 327 | } 328 | 329 | layer { 330 | name: "head1_conv3" 331 | type: "Convolution" 332 | bottom: "head1_pool2" 333 | top: "head1_conv3" 334 | param { 335 | lr_mult: 1 336 | decay_mult: 1 337 | } 338 | param { 339 | lr_mult: 2 340 | decay_mult: 0 341 | } 342 | convolution_param { 343 | num_output: 64 344 | kernel_size: 5 345 | stride: 1 346 | pad: 2 347 | weight_filler { 348 | type: "gaussian" 349 | std: 0.0001 350 | } 351 | # weight_filler { 352 | # type: "xavier" 353 | # } 354 | bias_filler { 355 | type: "constant" 356 | # value: 1 357 | } 358 | } 359 | } 360 | layer { 361 | name: "head1_relu3" 362 | type: "ReLU" 363 | bottom: "head1_conv3" 364 | top: "head1_conv3" 365 | } 366 | 367 | layer { 368 | name: "head1_conv4" 369 | type: "Convolution" 370 | bottom: "head1_conv3" 371 | top: "head1_conv4" 372 | param { 373 | lr_mult: 1 374 | decay_mult: 1 375 | } 376 | param { 377 | lr_mult: 2 378 | decay_mult: 0 379 | } 380 | convolution_param { 381 | num_output: 1000 382 | kernel_size: 1 383 | stride: 1 384 | pad: 0 385 | weight_filler { 386 | type: "gaussian" 387 | std: 0.35 388 | } 389 | # weight_filler { 390 | # type: "xavier" 391 | # } 392 | bias_filler { 393 | type: "constant" 394 | # value: 1 395 | } 396 | } 397 | } 398 | 399 | layer { 400 | name: "head1_relu4" 401 | type: "ReLU" 402 | bottom: "head1_conv4" 403 | top: "head1_conv4" 404 | } 405 | 406 | layer { 407 | name: "head1_conv5" 408 | type: "Convolution" 409 | bottom: "head1_conv4" 410 | top: "head1_conv5" 411 | param { 412 | lr_mult: 1 413 | decay_mult: 1 414 | } 415 | param { 416 | lr_mult: 2 417 | decay_mult: 0 418 | } 419 | convolution_param { 420 | num_output: 400 421 | kernel_size: 1 422 | stride: 1 423 | pad: 0 424 | weight_filler { 425 | type: "gaussian" 426 | std: 0.01 427 | } 428 | # weight_filler { 429 | # type: "xavier" 430 | # } 431 | bias_filler { 432 | type: "constant" 433 | # value: 1 434 | } 435 | } 436 | } 437 | 438 | layer { 439 | name: "head1_relu5" 440 | type: "ReLU" 441 | bottom: "head1_conv5" 442 | top: "head1_conv5" 443 | } 444 | 445 | 446 | # Convolutional Layers 447 | ################################################################################ 448 | 449 | layer { 450 | name: "concat5" 451 | bottom: "head0_conv5" 452 | bottom: "head1_conv5" 453 | top: "shoulder_concat5" 454 | type: "Concat" 455 | concat_param { 456 | axis: 1 457 | } 458 | } 459 | 460 | layer { 461 | name: "body_fc6" 462 | type: "InnerProduct" 463 | bottom: "shoulder_concat5" 464 | top: "body_fc6" 465 | param { 466 | lr_mult: 1 467 | decay_mult: 1 468 | } 469 | param { 470 | lr_mult: 2 471 | decay_mult: 0 472 | } 473 | inner_product_param { 474 | num_output: 512 475 | weight_filler { 476 | type: "gaussian" 477 | std: 0.05 478 | } 479 | # weight_filler { 480 | # type: "xavier" 481 | # } 482 | bias_filler { 483 | type: "constant" 484 | # value: 1 485 | } 486 | } 487 | } 488 | 489 | layer { 490 | name: "body_relu6" 491 | type: "ReLU" 492 | bottom: "body_fc6" 493 | top: "body_fc6" 494 | } 495 | 496 | layer { 497 | name: "body_fc7" 498 | type: "InnerProduct" 499 | bottom: "body_fc6" 500 | top: "body_fc7" 501 | param { 502 | lr_mult: 1 503 | decay_mult: 1 504 | } 505 | param { 506 | lr_mult: 2 507 | decay_mult: 0 508 | } 509 | inner_product_param { 510 | num_output: 512 511 | weight_filler { 512 | type: "gaussian" 513 | std: 0.05 514 | } 515 | # weight_filler { 516 | # type: "xavier" 517 | # } 518 | bias_filler { 519 | type: "constant" 520 | # value: 1 521 | } 522 | } 523 | } 524 | 525 | layer { 526 | name: "body_relu7" 527 | type: "ReLU" 528 | bottom: "body_fc7" 529 | top: "body_fc7" 530 | } 531 | 532 | 533 | layer { 534 | name: "body_fc8" 535 | type: "InnerProduct" 536 | bottom: "body_fc7" 537 | top: "body_fc8" 538 | param { 539 | lr_mult: 1 540 | decay_mult: 1 541 | } 542 | param { 543 | lr_mult: 2 544 | decay_mult: 0 545 | } 546 | inner_product_param { 547 | num_output: 324 548 | weight_filler { 549 | type: "constant" 550 | value: 0 551 | } 552 | # weight_filler { 553 | # type: "xavier" 554 | # } 555 | bias_filler { 556 | type: "constant" 557 | # value: 1 558 | } 559 | } 560 | } 561 | 562 | -------------------------------------------------------------------------------- /models/trancos/hydra2/hydra2_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "TRANCOS_HYDRA_2S_CNN" 2 | input: "data_s0" 3 | input_dim: 1 4 | input_dim: 3 5 | input_dim: 72 6 | input_dim: 72 7 | 8 | input: "data_s1" 9 | input_dim: 1 10 | input_dim: 3 11 | input_dim: 72 12 | input_dim: 72 13 | 14 | layer { 15 | name: "head0_conv1" 16 | type: "Convolution" 17 | bottom: "data_s0" 18 | top: "head0_conv1" 19 | param { 20 | lr_mult: 1 21 | decay_mult: 1 22 | } 23 | param { 24 | lr_mult: 2 25 | decay_mult: 0 26 | } 27 | convolution_param { 28 | num_output: 32 29 | pad: 3 30 | kernel_size: 7 31 | stride: 1 32 | weight_filler { 33 | type: "gaussian" 34 | std: 0.001 35 | } 36 | # weight_filler { 37 | # type: "xavier" 38 | # } 39 | bias_filler { 40 | type: "constant" 41 | # value: 1 42 | } 43 | } 44 | } 45 | layer { 46 | name: "head0_relu1" 47 | type: "ReLU" 48 | bottom: "head0_conv1" 49 | top: "head0_conv1" 50 | } 51 | layer { 52 | name: "head0_pool1" 53 | type: "Pooling" 54 | bottom: "head0_conv1" 55 | top: "head0_pool1" 56 | pooling_param { 57 | pool: MAX 58 | kernel_size: 2 59 | stride: 2 60 | } 61 | } 62 | 63 | layer { 64 | name: "head0_conv2" 65 | type: "Convolution" 66 | bottom: "head0_pool1" 67 | top: "head0_conv2" 68 | param { 69 | lr_mult: 1 70 | decay_mult: 1 71 | } 72 | param { 73 | lr_mult: 2 74 | decay_mult: 0 75 | } 76 | convolution_param { 77 | num_output: 32 78 | pad: 3 79 | kernel_size: 7 80 | stride: 1 81 | # weight_filler { 82 | # type: "xavier" 83 | # } 84 | weight_filler { 85 | type: "gaussian" 86 | std: 0.1 87 | } 88 | bias_filler { 89 | type: "constant" 90 | # value: 1 91 | } 92 | } 93 | } 94 | layer { 95 | name: "head0_relu2" 96 | type: "ReLU" 97 | bottom: "head0_conv2" 98 | top: "head0_conv2" 99 | } 100 | layer { 101 | name: "head0_pool2" 102 | type: "Pooling" 103 | bottom: "head0_conv2" 104 | top: "head0_pool2" 105 | pooling_param { 106 | pool: MAX 107 | kernel_size: 2 108 | stride: 2 109 | } 110 | } 111 | 112 | layer { 113 | name: "head0_conv3" 114 | type: "Convolution" 115 | bottom: "head0_pool2" 116 | top: "head0_conv3" 117 | param { 118 | lr_mult: 1 119 | decay_mult: 1 120 | } 121 | param { 122 | lr_mult: 2 123 | decay_mult: 0 124 | } 125 | convolution_param { 126 | num_output: 64 127 | kernel_size: 5 128 | stride: 1 129 | pad: 2 130 | weight_filler { 131 | type: "gaussian" 132 | std: 0.2 133 | } 134 | # weight_filler { 135 | # type: "xavier" 136 | # } 137 | bias_filler { 138 | type: "constant" 139 | # value: 1 140 | } 141 | } 142 | } 143 | layer { 144 | name: "head0_relu3" 145 | type: "ReLU" 146 | bottom: "head0_conv3" 147 | top: "head0_conv3" 148 | } 149 | 150 | layer { 151 | name: "head0_conv4" 152 | type: "Convolution" 153 | bottom: "head0_conv3" 154 | top: "head0_conv4" 155 | param { 156 | lr_mult: 1 157 | decay_mult: 1 158 | } 159 | param { 160 | lr_mult: 2 161 | decay_mult: 0 162 | } 163 | convolution_param { 164 | num_output: 1000 165 | kernel_size: 1 166 | stride: 1 167 | pad: 0 168 | weight_filler { 169 | type: "gaussian" 170 | std: 0.2 171 | } 172 | # weight_filler { 173 | # type: "xavier" 174 | # } 175 | bias_filler { 176 | type: "constant" 177 | # value: 1 178 | } 179 | } 180 | } 181 | 182 | layer { 183 | name: "head0_relu4" 184 | type: "ReLU" 185 | bottom: "head0_conv4" 186 | top: "head0_conv4" 187 | } 188 | 189 | layer { 190 | name: "head0_conv5" 191 | type: "Convolution" 192 | bottom: "head0_conv4" 193 | top: "head0_conv5" 194 | param { 195 | lr_mult: 1 196 | decay_mult: 1 197 | } 198 | param { 199 | lr_mult: 2 200 | decay_mult: 0 201 | } 202 | convolution_param { 203 | num_output: 400 204 | kernel_size: 1 205 | stride: 1 206 | pad: 0 207 | weight_filler { 208 | type: "gaussian" 209 | std: 0.2 210 | } 211 | # weight_filler { 212 | # type: "xavier" 213 | # } 214 | bias_filler { 215 | type: "constant" 216 | # value: 1 217 | } 218 | } 219 | } 220 | 221 | layer { 222 | name: "head0_relu5" 223 | type: "ReLU" 224 | bottom: "head0_conv5" 225 | top: "head0_conv5" 226 | } 227 | 228 | 229 | # Convolutional Layers 230 | ################################################################################ 231 | layer { 232 | name: "head1_conv1" 233 | type: "Convolution" 234 | bottom: "data_s1" 235 | top: "head1_conv1" 236 | param { 237 | lr_mult: 1 238 | decay_mult: 1 239 | } 240 | param { 241 | lr_mult: 2 242 | decay_mult: 0 243 | } 244 | convolution_param { 245 | num_output: 32 246 | pad: 3 247 | kernel_size: 7 248 | stride: 1 249 | weight_filler { 250 | type: "gaussian" 251 | std: 0.001 252 | } 253 | # weight_filler { 254 | # type: "xavier" 255 | # } 256 | bias_filler { 257 | type: "constant" 258 | # value: 1 259 | } 260 | } 261 | } 262 | layer { 263 | name: "head1_relu1" 264 | type: "ReLU" 265 | bottom: "head1_conv1" 266 | top: "head1_conv1" 267 | } 268 | layer { 269 | name: "head1_pool1" 270 | type: "Pooling" 271 | bottom: "head1_conv1" 272 | top: "head1_pool1" 273 | pooling_param { 274 | pool: MAX 275 | kernel_size: 2 276 | stride: 2 277 | } 278 | } 279 | 280 | layer { 281 | name: "head1_conv2" 282 | type: "Convolution" 283 | bottom: "head1_pool1" 284 | top: "head1_conv2" 285 | param { 286 | lr_mult: 1 287 | decay_mult: 1 288 | } 289 | param { 290 | lr_mult: 2 291 | decay_mult: 0 292 | } 293 | convolution_param { 294 | num_output: 32 295 | pad: 3 296 | kernel_size: 7 297 | stride: 1 298 | # weight_filler { 299 | # type: "xavier" 300 | # } 301 | weight_filler { 302 | type: "gaussian" 303 | std: 0.1 304 | } 305 | bias_filler { 306 | type: "constant" 307 | # value: 1 308 | } 309 | } 310 | } 311 | layer { 312 | name: "head1_relu2" 313 | type: "ReLU" 314 | bottom: "head1_conv2" 315 | top: "head1_conv2" 316 | } 317 | layer { 318 | name: "head1_pool2" 319 | type: "Pooling" 320 | bottom: "head1_conv2" 321 | top: "head1_pool2" 322 | pooling_param { 323 | pool: MAX 324 | kernel_size: 2 325 | stride: 2 326 | } 327 | } 328 | 329 | layer { 330 | name: "head1_conv3" 331 | type: "Convolution" 332 | bottom: "head1_pool2" 333 | top: "head1_conv3" 334 | param { 335 | lr_mult: 1 336 | decay_mult: 1 337 | } 338 | param { 339 | lr_mult: 2 340 | decay_mult: 0 341 | } 342 | convolution_param { 343 | num_output: 64 344 | kernel_size: 5 345 | stride: 1 346 | pad: 2 347 | weight_filler { 348 | type: "gaussian" 349 | std: 0.2 350 | } 351 | # weight_filler { 352 | # type: "xavier" 353 | # } 354 | bias_filler { 355 | type: "constant" 356 | # value: 1 357 | } 358 | } 359 | } 360 | layer { 361 | name: "head1_relu3" 362 | type: "ReLU" 363 | bottom: "head1_conv3" 364 | top: "head1_conv3" 365 | } 366 | 367 | layer { 368 | name: "head1_conv4" 369 | type: "Convolution" 370 | bottom: "head1_conv3" 371 | top: "head1_conv4" 372 | param { 373 | lr_mult: 1 374 | decay_mult: 1 375 | } 376 | param { 377 | lr_mult: 2 378 | decay_mult: 0 379 | } 380 | convolution_param { 381 | num_output: 1000 382 | kernel_size: 1 383 | stride: 1 384 | pad: 0 385 | weight_filler { 386 | type: "gaussian" 387 | std: 0.2 388 | } 389 | # weight_filler { 390 | # type: "xavier" 391 | # } 392 | bias_filler { 393 | type: "constant" 394 | # value: 1 395 | } 396 | } 397 | } 398 | 399 | layer { 400 | name: "head1_relu4" 401 | type: "ReLU" 402 | bottom: "head1_conv4" 403 | top: "head1_conv4" 404 | } 405 | 406 | layer { 407 | name: "head1_conv5" 408 | type: "Convolution" 409 | bottom: "head1_conv4" 410 | top: "head1_conv5" 411 | param { 412 | lr_mult: 1 413 | decay_mult: 1 414 | } 415 | param { 416 | lr_mult: 2 417 | decay_mult: 0 418 | } 419 | convolution_param { 420 | num_output: 400 421 | kernel_size: 1 422 | stride: 1 423 | pad: 0 424 | weight_filler { 425 | type: "gaussian" 426 | std: 0.2 427 | } 428 | # weight_filler { 429 | # type: "xavier" 430 | # } 431 | bias_filler { 432 | type: "constant" 433 | # value: 1 434 | } 435 | } 436 | } 437 | 438 | layer { 439 | name: "head1_relu5" 440 | type: "ReLU" 441 | bottom: "head1_conv5" 442 | top: "head1_conv5" 443 | } 444 | 445 | 446 | # Convolutional Layers 447 | ################################################################################ 448 | 449 | layer { 450 | name: "concat5" 451 | bottom: "head0_conv5" 452 | bottom: "head1_conv5" 453 | top: "shoulder_concat5" 454 | type: "Concat" 455 | concat_param { 456 | axis: 1 457 | } 458 | } 459 | 460 | layer { 461 | name: "body_fc6" 462 | type: "InnerProduct" 463 | bottom: "shoulder_concat5" 464 | top: "body_fc6" 465 | param { 466 | lr_mult: 1 467 | decay_mult: 1 468 | } 469 | param { 470 | lr_mult: 2 471 | decay_mult: 0 472 | } 473 | inner_product_param { 474 | num_output: 512 475 | weight_filler { 476 | type: "gaussian" 477 | std: 0.05 478 | } 479 | # weight_filler { 480 | # type: "xavier" 481 | # } 482 | bias_filler { 483 | type: "constant" 484 | # value: 1 485 | } 486 | } 487 | } 488 | 489 | layer { 490 | name: "body_relu6" 491 | type: "ReLU" 492 | bottom: "body_fc6" 493 | top: "body_fc6" 494 | } 495 | 496 | layer { 497 | name: "body_fc7" 498 | type: "InnerProduct" 499 | bottom: "body_fc6" 500 | top: "body_fc7" 501 | param { 502 | lr_mult: 1 503 | decay_mult: 1 504 | } 505 | param { 506 | lr_mult: 2 507 | decay_mult: 0 508 | } 509 | inner_product_param { 510 | num_output: 512 511 | weight_filler { 512 | type: "gaussian" 513 | std: 0.05 514 | } 515 | # weight_filler { 516 | # type: "xavier" 517 | # } 518 | bias_filler { 519 | type: "constant" 520 | # value: 1 521 | } 522 | } 523 | } 524 | 525 | layer { 526 | name: "body_relu7" 527 | type: "ReLU" 528 | bottom: "body_fc7" 529 | top: "body_fc7" 530 | } 531 | 532 | 533 | layer { 534 | name: "body_fc8" 535 | type: "InnerProduct" 536 | bottom: "body_fc7" 537 | top: "body_fc8" 538 | param { 539 | lr_mult: 1 540 | decay_mult: 1 541 | } 542 | param { 543 | lr_mult: 2 544 | decay_mult: 0 545 | } 546 | inner_product_param { 547 | num_output: 324 548 | weight_filler { 549 | type: "constant" 550 | value: 0 551 | } 552 | # weight_filler { 553 | # type: "xavier" 554 | # } 555 | bias_filler { 556 | type: "constant" 557 | # value: 1 558 | } 559 | } 560 | } 561 | 562 | -------------------------------------------------------------------------------- /models/ucf/hydra2/hydra2_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCF_CNN" 2 | 3 | input: "data_s0" 4 | input_dim: 1 5 | input_dim: 1 6 | input_dim: 72 7 | input_dim: 72 8 | 9 | input: "data_s1" 10 | input_dim: 1 11 | input_dim: 1 12 | input_dim: 72 13 | input_dim: 72 14 | 15 | layer { 16 | name: "head0_conv1" 17 | type: "Convolution" 18 | bottom: "data_s0" 19 | top: "head0_conv1" 20 | param { 21 | lr_mult: 1 22 | decay_mult: 1 23 | } 24 | param { 25 | lr_mult: 2 26 | decay_mult: 0 27 | } 28 | convolution_param { 29 | num_output: 32 30 | pad: 3 31 | kernel_size: 7 32 | stride: 1 33 | weight_filler { 34 | type: "gaussian" 35 | std: 0.01 36 | } 37 | # weight_filler { 38 | # type: "xavier" 39 | # } 40 | bias_filler { 41 | type: "constant" 42 | # value: 1 43 | } 44 | } 45 | } 46 | layer { 47 | name: "head0_relu1" 48 | type: "ReLU" 49 | bottom: "head0_conv1" 50 | top: "head0_conv1" 51 | } 52 | layer { 53 | name: "head0_pool1" 54 | type: "Pooling" 55 | bottom: "head0_conv1" 56 | top: "head0_pool1" 57 | pooling_param { 58 | pool: MAX 59 | kernel_size: 2 60 | stride: 2 61 | } 62 | } 63 | 64 | layer { 65 | name: "head0_conv2" 66 | type: "Convolution" 67 | bottom: "head0_pool1" 68 | top: "head0_conv2" 69 | param { 70 | lr_mult: 1 71 | decay_mult: 1 72 | } 73 | param { 74 | lr_mult: 2 75 | decay_mult: 0 76 | } 77 | convolution_param { 78 | num_output: 32 79 | pad: 3 80 | kernel_size: 7 81 | stride: 1 82 | # weight_filler { 83 | # type: "xavier" 84 | # } 85 | weight_filler { 86 | type: "gaussian" 87 | std: 0.2 88 | } 89 | bias_filler { 90 | type: "constant" 91 | # value: 1 92 | } 93 | } 94 | } 95 | layer { 96 | name: "head0_relu2" 97 | type: "ReLU" 98 | bottom: "head0_conv2" 99 | top: "head0_conv2" 100 | } 101 | layer { 102 | name: "head0_pool2" 103 | type: "Pooling" 104 | bottom: "head0_conv2" 105 | top: "head0_pool2" 106 | pooling_param { 107 | pool: MAX 108 | kernel_size: 2 109 | stride: 2 110 | } 111 | } 112 | 113 | layer { 114 | name: "head0_conv3" 115 | type: "Convolution" 116 | bottom: "head0_pool2" 117 | top: "head0_conv3" 118 | param { 119 | lr_mult: 1 120 | decay_mult: 1 121 | } 122 | param { 123 | lr_mult: 2 124 | decay_mult: 0 125 | } 126 | convolution_param { 127 | num_output: 64 128 | kernel_size: 5 129 | stride: 1 130 | pad: 2 131 | weight_filler { 132 | type: "gaussian" 133 | std: 0.0001 134 | } 135 | # weight_filler { 136 | # type: "xavier" 137 | # } 138 | bias_filler { 139 | type: "constant" 140 | # value: 1 141 | } 142 | } 143 | } 144 | layer { 145 | name: "head0_relu3" 146 | type: "ReLU" 147 | bottom: "head0_conv3" 148 | top: "head0_conv3" 149 | } 150 | 151 | layer { 152 | name: "head0_conv4" 153 | type: "Convolution" 154 | bottom: "head0_conv3" 155 | top: "head0_conv4" 156 | param { 157 | lr_mult: 1 158 | decay_mult: 1 159 | } 160 | param { 161 | lr_mult: 2 162 | decay_mult: 0 163 | } 164 | convolution_param { 165 | num_output: 1000 166 | kernel_size: 1 167 | stride: 1 168 | pad: 0 169 | weight_filler { 170 | type: "gaussian" 171 | std: 0.35 172 | } 173 | # weight_filler { 174 | # type: "xavier" 175 | # } 176 | bias_filler { 177 | type: "constant" 178 | # value: 1 179 | } 180 | } 181 | } 182 | 183 | layer { 184 | name: "head0_relu4" 185 | type: "ReLU" 186 | bottom: "head0_conv4" 187 | top: "head0_conv4" 188 | } 189 | 190 | layer { 191 | name: "head0_conv5" 192 | type: "Convolution" 193 | bottom: "head0_conv4" 194 | top: "head0_conv5" 195 | param { 196 | lr_mult: 1 197 | decay_mult: 1 198 | } 199 | param { 200 | lr_mult: 2 201 | decay_mult: 0 202 | } 203 | convolution_param { 204 | num_output: 400 205 | kernel_size: 1 206 | stride: 1 207 | pad: 0 208 | weight_filler { 209 | type: "gaussian" 210 | std: 0.1 211 | } 212 | # weight_filler { 213 | # type: "xavier" 214 | # } 215 | bias_filler { 216 | type: "constant" 217 | # value: 1 218 | } 219 | } 220 | } 221 | 222 | layer { 223 | name: "head0_relu5" 224 | type: "ReLU" 225 | bottom: "head0_conv5" 226 | top: "head0_conv5" 227 | } 228 | 229 | 230 | # Convolutional Layers 231 | ################################################################################ 232 | layer { 233 | name: "head1_conv1" 234 | type: "Convolution" 235 | bottom: "data_s1" 236 | top: "head1_conv1" 237 | param { 238 | lr_mult: 1 239 | decay_mult: 1 240 | } 241 | param { 242 | lr_mult: 2 243 | decay_mult: 0 244 | } 245 | convolution_param { 246 | num_output: 32 247 | pad: 3 248 | kernel_size: 7 249 | stride: 1 250 | weight_filler { 251 | type: "gaussian" 252 | std: 0.01 253 | } 254 | # weight_filler { 255 | # type: "xavier" 256 | # } 257 | bias_filler { 258 | type: "constant" 259 | # value: 1 260 | } 261 | } 262 | } 263 | layer { 264 | name: "head1_relu1" 265 | type: "ReLU" 266 | bottom: "head1_conv1" 267 | top: "head1_conv1" 268 | } 269 | layer { 270 | name: "head1_pool1" 271 | type: "Pooling" 272 | bottom: "head1_conv1" 273 | top: "head1_pool1" 274 | pooling_param { 275 | pool: MAX 276 | kernel_size: 2 277 | stride: 2 278 | } 279 | } 280 | 281 | layer { 282 | name: "head1_conv2" 283 | type: "Convolution" 284 | bottom: "head1_pool1" 285 | top: "head1_conv2" 286 | param { 287 | lr_mult: 1 288 | decay_mult: 1 289 | } 290 | param { 291 | lr_mult: 2 292 | decay_mult: 0 293 | } 294 | convolution_param { 295 | num_output: 32 296 | pad: 3 297 | kernel_size: 7 298 | stride: 1 299 | # weight_filler { 300 | # type: "xavier" 301 | # } 302 | weight_filler { 303 | type: "gaussian" 304 | std: 0.2 305 | } 306 | bias_filler { 307 | type: "constant" 308 | # value: 1 309 | } 310 | } 311 | } 312 | layer { 313 | name: "head1_relu2" 314 | type: "ReLU" 315 | bottom: "head1_conv2" 316 | top: "head1_conv2" 317 | } 318 | layer { 319 | name: "head1_pool2" 320 | type: "Pooling" 321 | bottom: "head1_conv2" 322 | top: "head1_pool2" 323 | pooling_param { 324 | pool: MAX 325 | kernel_size: 2 326 | stride: 2 327 | } 328 | } 329 | 330 | layer { 331 | name: "head1_conv3" 332 | type: "Convolution" 333 | bottom: "head1_pool2" 334 | top: "head1_conv3" 335 | param { 336 | lr_mult: 1 337 | decay_mult: 1 338 | } 339 | param { 340 | lr_mult: 2 341 | decay_mult: 0 342 | } 343 | convolution_param { 344 | num_output: 64 345 | kernel_size: 5 346 | stride: 1 347 | pad: 2 348 | weight_filler { 349 | type: "gaussian" 350 | std: 0.0001 351 | } 352 | # weight_filler { 353 | # type: "xavier" 354 | # } 355 | bias_filler { 356 | type: "constant" 357 | # value: 1 358 | } 359 | } 360 | } 361 | layer { 362 | name: "head1_relu3" 363 | type: "ReLU" 364 | bottom: "head1_conv3" 365 | top: "head1_conv3" 366 | } 367 | 368 | layer { 369 | name: "head1_conv4" 370 | type: "Convolution" 371 | bottom: "head1_conv3" 372 | top: "head1_conv4" 373 | param { 374 | lr_mult: 1 375 | decay_mult: 1 376 | } 377 | param { 378 | lr_mult: 2 379 | decay_mult: 0 380 | } 381 | convolution_param { 382 | num_output: 1000 383 | kernel_size: 1 384 | stride: 1 385 | pad: 0 386 | weight_filler { 387 | type: "gaussian" 388 | std: 0.35 389 | } 390 | # weight_filler { 391 | # type: "xavier" 392 | # } 393 | bias_filler { 394 | type: "constant" 395 | # value: 1 396 | } 397 | } 398 | } 399 | 400 | layer { 401 | name: "head1_relu4" 402 | type: "ReLU" 403 | bottom: "head1_conv4" 404 | top: "head1_conv4" 405 | } 406 | 407 | layer { 408 | name: "head1_conv5" 409 | type: "Convolution" 410 | bottom: "head1_conv4" 411 | top: "head1_conv5" 412 | param { 413 | lr_mult: 1 414 | decay_mult: 1 415 | } 416 | param { 417 | lr_mult: 2 418 | decay_mult: 0 419 | } 420 | convolution_param { 421 | num_output: 400 422 | kernel_size: 1 423 | stride: 1 424 | pad: 0 425 | weight_filler { 426 | type: "gaussian" 427 | std: 0.01 428 | } 429 | # weight_filler { 430 | # type: "xavier" 431 | # } 432 | bias_filler { 433 | type: "constant" 434 | # value: 1 435 | } 436 | } 437 | } 438 | 439 | layer { 440 | name: "head1_relu5" 441 | type: "ReLU" 442 | bottom: "head1_conv5" 443 | top: "head1_conv5" 444 | } 445 | 446 | 447 | # Convolutional Layers 448 | ################################################################################ 449 | 450 | layer { 451 | name: "concat5" 452 | bottom: "head0_conv5" 453 | bottom: "head1_conv5" 454 | top: "shoulder_concat5" 455 | type: "Concat" 456 | concat_param { 457 | axis: 1 458 | } 459 | } 460 | 461 | layer { 462 | name: "body_fc6" 463 | type: "InnerProduct" 464 | bottom: "shoulder_concat5" 465 | top: "body_fc6" 466 | param { 467 | lr_mult: 1 468 | decay_mult: 1 469 | } 470 | param { 471 | lr_mult: 2 472 | decay_mult: 0 473 | } 474 | inner_product_param { 475 | num_output: 512 476 | weight_filler { 477 | type: "gaussian" 478 | std: 0.05 479 | } 480 | # weight_filler { 481 | # type: "xavier" 482 | # } 483 | bias_filler { 484 | type: "constant" 485 | # value: 1 486 | } 487 | } 488 | } 489 | 490 | layer { 491 | name: "body_relu6" 492 | type: "ReLU" 493 | bottom: "body_fc6" 494 | top: "body_fc6" 495 | } 496 | 497 | layer { 498 | name: "body_fc7" 499 | type: "InnerProduct" 500 | bottom: "body_fc6" 501 | top: "body_fc7" 502 | param { 503 | lr_mult: 1 504 | decay_mult: 1 505 | } 506 | param { 507 | lr_mult: 2 508 | decay_mult: 0 509 | } 510 | inner_product_param { 511 | num_output: 512 512 | weight_filler { 513 | type: "gaussian" 514 | std: 0.05 515 | } 516 | # weight_filler { 517 | # type: "xavier" 518 | # } 519 | bias_filler { 520 | type: "constant" 521 | # value: 1 522 | } 523 | } 524 | } 525 | 526 | layer { 527 | name: "body_relu7" 528 | type: "ReLU" 529 | bottom: "body_fc7" 530 | top: "body_fc7" 531 | } 532 | 533 | 534 | layer { 535 | name: "body_fc8" 536 | type: "InnerProduct" 537 | bottom: "body_fc7" 538 | top: "body_fc8" 539 | param { 540 | lr_mult: 1 541 | decay_mult: 1 542 | } 543 | param { 544 | lr_mult: 2 545 | decay_mult: 0 546 | } 547 | inner_product_param { 548 | num_output: 324 549 | weight_filler { 550 | type: "constant" 551 | value: 0 552 | } 553 | # weight_filler { 554 | # type: "xavier" 555 | # } 556 | bias_filler { 557 | type: "constant" 558 | # value: 1 559 | } 560 | } 561 | } 562 | 563 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_max_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "data_s1" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/max_train.txt" 13 | batch_size: 16 14 | shuffle: true 15 | } 16 | } 17 | #layer { 18 | # name: "data" 19 | # type: "HDF5Data" 20 | # top: "data_s0" 21 | # top: "data_s1" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/max_test.txt" 28 | # batch_size: 16 29 | # shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "head0_conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "head0_conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.01 55 | } 56 | # weight_filler { 57 | # type: "xavier" 58 | # } 59 | bias_filler { 60 | type: "constant" 61 | # value: 1 62 | } 63 | } 64 | } 65 | layer { 66 | name: "head0_relu1" 67 | type: "ReLU" 68 | bottom: "head0_conv1" 69 | top: "head0_conv1" 70 | } 71 | layer { 72 | name: "head0_pool1" 73 | type: "Pooling" 74 | bottom: "head0_conv1" 75 | top: "head0_pool1" 76 | pooling_param { 77 | pool: MAX 78 | kernel_size: 2 79 | stride: 2 80 | } 81 | } 82 | 83 | layer { 84 | name: "head0_conv2" 85 | type: "Convolution" 86 | bottom: "head0_pool1" 87 | top: "head0_conv2" 88 | param { 89 | lr_mult: 1 90 | decay_mult: 1 91 | } 92 | param { 93 | lr_mult: 2 94 | decay_mult: 0 95 | } 96 | convolution_param { 97 | num_output: 32 98 | pad: 3 99 | kernel_size: 7 100 | stride: 1 101 | # weight_filler { 102 | # type: "xavier" 103 | # } 104 | weight_filler { 105 | type: "gaussian" 106 | std: 0.2 107 | } 108 | bias_filler { 109 | type: "constant" 110 | # value: 1 111 | } 112 | } 113 | } 114 | layer { 115 | name: "head0_relu2" 116 | type: "ReLU" 117 | bottom: "head0_conv2" 118 | top: "head0_conv2" 119 | } 120 | layer { 121 | name: "head0_pool2" 122 | type: "Pooling" 123 | bottom: "head0_conv2" 124 | top: "head0_pool2" 125 | pooling_param { 126 | pool: MAX 127 | kernel_size: 2 128 | stride: 2 129 | } 130 | } 131 | 132 | layer { 133 | name: "head0_conv3" 134 | type: "Convolution" 135 | bottom: "head0_pool2" 136 | top: "head0_conv3" 137 | param { 138 | lr_mult: 1 139 | decay_mult: 1 140 | } 141 | param { 142 | lr_mult: 2 143 | decay_mult: 0 144 | } 145 | convolution_param { 146 | num_output: 64 147 | kernel_size: 5 148 | stride: 1 149 | pad: 2 150 | weight_filler { 151 | type: "gaussian" 152 | std: 0.001 153 | } 154 | # weight_filler { 155 | # type: "xavier" 156 | # } 157 | bias_filler { 158 | type: "constant" 159 | # value: 1 160 | } 161 | } 162 | } 163 | layer { 164 | name: "head0_relu3" 165 | type: "ReLU" 166 | bottom: "head0_conv3" 167 | top: "head0_conv3" 168 | } 169 | 170 | layer { 171 | name: "head0_conv4" 172 | type: "Convolution" 173 | bottom: "head0_conv3" 174 | top: "head0_conv4" 175 | param { 176 | lr_mult: 1 177 | decay_mult: 1 178 | } 179 | param { 180 | lr_mult: 2 181 | decay_mult: 0 182 | } 183 | convolution_param { 184 | num_output: 1000 185 | kernel_size: 1 186 | stride: 1 187 | pad: 0 188 | weight_filler { 189 | type: "gaussian" 190 | std: 0.35 191 | } 192 | # weight_filler { 193 | # type: "xavier" 194 | # } 195 | bias_filler { 196 | type: "constant" 197 | # value: 1 198 | } 199 | } 200 | } 201 | 202 | layer { 203 | name: "head0_relu4" 204 | type: "ReLU" 205 | bottom: "head0_conv4" 206 | top: "head0_conv4" 207 | } 208 | 209 | layer { 210 | name: "head0_conv5" 211 | type: "Convolution" 212 | bottom: "head0_conv4" 213 | top: "head0_conv5" 214 | param { 215 | lr_mult: 1 216 | decay_mult: 1 217 | } 218 | param { 219 | lr_mult: 2 220 | decay_mult: 0 221 | } 222 | convolution_param { 223 | num_output: 400 224 | kernel_size: 1 225 | stride: 1 226 | pad: 0 227 | weight_filler { 228 | type: "gaussian" 229 | std: 0.1 230 | } 231 | # weight_filler { 232 | # type: "xavier" 233 | # } 234 | bias_filler { 235 | type: "constant" 236 | # value: 1 237 | } 238 | } 239 | } 240 | 241 | layer { 242 | name: "head0_relu5" 243 | type: "ReLU" 244 | bottom: "head0_conv5" 245 | top: "head0_conv5" 246 | } 247 | 248 | 249 | # Convolutional Layers 250 | ################################################################################ 251 | layer { 252 | name: "head1_conv1" 253 | type: "Convolution" 254 | bottom: "data_s1" 255 | top: "head1_conv1" 256 | param { 257 | lr_mult: 1 258 | decay_mult: 1 259 | } 260 | param { 261 | lr_mult: 2 262 | decay_mult: 0 263 | } 264 | convolution_param { 265 | num_output: 32 266 | pad: 3 267 | kernel_size: 7 268 | stride: 1 269 | weight_filler { 270 | type: "gaussian" 271 | std: 0.01 272 | } 273 | # weight_filler { 274 | # type: "xavier" 275 | # } 276 | bias_filler { 277 | type: "constant" 278 | # value: 1 279 | } 280 | } 281 | } 282 | layer { 283 | name: "head1_relu1" 284 | type: "ReLU" 285 | bottom: "head1_conv1" 286 | top: "head1_conv1" 287 | } 288 | layer { 289 | name: "head1_pool1" 290 | type: "Pooling" 291 | bottom: "head1_conv1" 292 | top: "head1_pool1" 293 | pooling_param { 294 | pool: MAX 295 | kernel_size: 2 296 | stride: 2 297 | } 298 | } 299 | 300 | layer { 301 | name: "head1_conv2" 302 | type: "Convolution" 303 | bottom: "head1_pool1" 304 | top: "head1_conv2" 305 | param { 306 | lr_mult: 1 307 | decay_mult: 1 308 | } 309 | param { 310 | lr_mult: 2 311 | decay_mult: 0 312 | } 313 | convolution_param { 314 | num_output: 32 315 | pad: 3 316 | kernel_size: 7 317 | stride: 1 318 | # weight_filler { 319 | # type: "xavier" 320 | # } 321 | weight_filler { 322 | type: "gaussian" 323 | std: 0.3 324 | } 325 | bias_filler { 326 | type: "constant" 327 | # value: 1 328 | } 329 | } 330 | } 331 | layer { 332 | name: "head1_relu2" 333 | type: "ReLU" 334 | bottom: "head1_conv2" 335 | top: "head1_conv2" 336 | } 337 | layer { 338 | name: "head1_pool2" 339 | type: "Pooling" 340 | bottom: "head1_conv2" 341 | top: "head1_pool2" 342 | pooling_param { 343 | pool: MAX 344 | kernel_size: 2 345 | stride: 2 346 | } 347 | } 348 | 349 | layer { 350 | name: "head1_conv3" 351 | type: "Convolution" 352 | bottom: "head1_pool2" 353 | top: "head1_conv3" 354 | param { 355 | lr_mult: 1 356 | decay_mult: 1 357 | } 358 | param { 359 | lr_mult: 2 360 | decay_mult: 0 361 | } 362 | convolution_param { 363 | num_output: 64 364 | kernel_size: 5 365 | stride: 1 366 | pad: 2 367 | weight_filler { 368 | type: "gaussian" 369 | std: 0.001 370 | } 371 | # weight_filler { 372 | # type: "xavier" 373 | # } 374 | bias_filler { 375 | type: "constant" 376 | # value: 1 377 | } 378 | } 379 | } 380 | layer { 381 | name: "head1_relu3" 382 | type: "ReLU" 383 | bottom: "head1_conv3" 384 | top: "head1_conv3" 385 | } 386 | 387 | layer { 388 | name: "head1_conv4" 389 | type: "Convolution" 390 | bottom: "head1_conv3" 391 | top: "head1_conv4" 392 | param { 393 | lr_mult: 1 394 | decay_mult: 1 395 | } 396 | param { 397 | lr_mult: 2 398 | decay_mult: 0 399 | } 400 | convolution_param { 401 | num_output: 1000 402 | kernel_size: 1 403 | stride: 1 404 | pad: 0 405 | weight_filler { 406 | type: "gaussian" 407 | std: 0.3 408 | } 409 | # weight_filler { 410 | # type: "xavier" 411 | # } 412 | bias_filler { 413 | type: "constant" 414 | # value: 1 415 | } 416 | } 417 | } 418 | 419 | layer { 420 | name: "head1_relu4" 421 | type: "ReLU" 422 | bottom: "head1_conv4" 423 | top: "head1_conv4" 424 | } 425 | 426 | layer { 427 | name: "head1_conv5" 428 | type: "Convolution" 429 | bottom: "head1_conv4" 430 | top: "head1_conv5" 431 | param { 432 | lr_mult: 1 433 | decay_mult: 1 434 | } 435 | param { 436 | lr_mult: 2 437 | decay_mult: 0 438 | } 439 | convolution_param { 440 | num_output: 400 441 | kernel_size: 1 442 | stride: 1 443 | pad: 0 444 | weight_filler { 445 | type: "gaussian" 446 | std: 0.1 447 | } 448 | # weight_filler { 449 | # type: "xavier" 450 | # } 451 | bias_filler { 452 | type: "constant" 453 | # value: 1 454 | } 455 | } 456 | } 457 | 458 | layer { 459 | name: "head1_relu5" 460 | type: "ReLU" 461 | bottom: "head1_conv5" 462 | top: "head1_conv5" 463 | } 464 | 465 | 466 | # Convolutional Layers 467 | ################################################################################ 468 | 469 | layer { 470 | name: "concat5" 471 | bottom: "head0_conv5" 472 | bottom: "head1_conv5" 473 | top: "shoulder_concat5" 474 | type: "Concat" 475 | concat_param { 476 | axis: 1 477 | } 478 | } 479 | 480 | layer { 481 | name: "body_fc6" 482 | type: "InnerProduct" 483 | bottom: "shoulder_concat5" 484 | top: "body_fc6" 485 | param { 486 | lr_mult: 1 487 | decay_mult: 1 488 | } 489 | param { 490 | lr_mult: 2 491 | decay_mult: 0 492 | } 493 | inner_product_param { 494 | num_output: 512 495 | weight_filler { 496 | type: "gaussian" 497 | std: 0.1 498 | } 499 | # weight_filler { 500 | # type: "xavier" 501 | # } 502 | bias_filler { 503 | type: "constant" 504 | # value: 1 505 | } 506 | } 507 | } 508 | 509 | layer { 510 | name: "body_relu6" 511 | type: "ReLU" 512 | bottom: "body_fc6" 513 | top: "body_fc6" 514 | } 515 | 516 | layer { 517 | name: "body_fc7" 518 | type: "InnerProduct" 519 | bottom: "body_fc6" 520 | top: "body_fc7" 521 | param { 522 | lr_mult: 1 523 | decay_mult: 1 524 | } 525 | param { 526 | lr_mult: 2 527 | decay_mult: 0 528 | } 529 | inner_product_param { 530 | num_output: 512 531 | weight_filler { 532 | type: "gaussian" 533 | std: 0.2 534 | } 535 | # weight_filler { 536 | # type: "xavier" 537 | # } 538 | bias_filler { 539 | type: "constant" 540 | # value: 1 541 | } 542 | } 543 | } 544 | 545 | layer { 546 | name: "body_relu7" 547 | type: "ReLU" 548 | bottom: "body_fc7" 549 | top: "body_fc7" 550 | } 551 | 552 | 553 | layer { 554 | name: "body_fc8" 555 | type: "InnerProduct" 556 | bottom: "body_fc7" 557 | top: "body_fc8" 558 | param { 559 | lr_mult: 1 560 | decay_mult: 1 561 | } 562 | param { 563 | lr_mult: 2 564 | decay_mult: 0 565 | } 566 | inner_product_param { 567 | num_output: 324 568 | weight_filler { 569 | type: "constant" 570 | value: 0 571 | } 572 | # weight_filler { 573 | # type: "xavier" 574 | # } 575 | bias_filler { 576 | type: "constant" 577 | # value: 1 578 | } 579 | } 580 | } 581 | 582 | # Loss Layers and Test 583 | ################################################################################ 584 | layer { 585 | name: "loss" 586 | type: "EuclideanLoss" 587 | bottom: "body_fc8" 588 | bottom: "label" 589 | top: "loss" 590 | } 591 | 592 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_up_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "data_s1" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/up_train.txt" 13 | batch_size: 16 14 | shuffle: true 15 | } 16 | } 17 | #layer { 18 | # name: "data" 19 | # type: "HDF5Data" 20 | # top: "data_s0" 21 | # top: "data_s1" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/up_test.txt" 28 | # batch_size: 16 29 | # shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "head0_conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "head0_conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.01 55 | } 56 | # weight_filler { 57 | # type: "xavier" 58 | # } 59 | bias_filler { 60 | type: "constant" 61 | # value: 1 62 | } 63 | } 64 | } 65 | layer { 66 | name: "head0_relu1" 67 | type: "ReLU" 68 | bottom: "head0_conv1" 69 | top: "head0_conv1" 70 | } 71 | layer { 72 | name: "head0_pool1" 73 | type: "Pooling" 74 | bottom: "head0_conv1" 75 | top: "head0_pool1" 76 | pooling_param { 77 | pool: MAX 78 | kernel_size: 2 79 | stride: 2 80 | } 81 | } 82 | 83 | layer { 84 | name: "head0_conv2" 85 | type: "Convolution" 86 | bottom: "head0_pool1" 87 | top: "head0_conv2" 88 | param { 89 | lr_mult: 1 90 | decay_mult: 1 91 | } 92 | param { 93 | lr_mult: 2 94 | decay_mult: 0 95 | } 96 | convolution_param { 97 | num_output: 32 98 | pad: 3 99 | kernel_size: 7 100 | stride: 1 101 | # weight_filler { 102 | # type: "xavier" 103 | # } 104 | weight_filler { 105 | type: "gaussian" 106 | std: 0.2 107 | } 108 | bias_filler { 109 | type: "constant" 110 | # value: 1 111 | } 112 | } 113 | } 114 | layer { 115 | name: "head0_relu2" 116 | type: "ReLU" 117 | bottom: "head0_conv2" 118 | top: "head0_conv2" 119 | } 120 | layer { 121 | name: "head0_pool2" 122 | type: "Pooling" 123 | bottom: "head0_conv2" 124 | top: "head0_pool2" 125 | pooling_param { 126 | pool: MAX 127 | kernel_size: 2 128 | stride: 2 129 | } 130 | } 131 | 132 | layer { 133 | name: "head0_conv3" 134 | type: "Convolution" 135 | bottom: "head0_pool2" 136 | top: "head0_conv3" 137 | param { 138 | lr_mult: 1 139 | decay_mult: 1 140 | } 141 | param { 142 | lr_mult: 2 143 | decay_mult: 0 144 | } 145 | convolution_param { 146 | num_output: 64 147 | kernel_size: 5 148 | stride: 1 149 | pad: 2 150 | weight_filler { 151 | type: "gaussian" 152 | std: 0.0001 153 | } 154 | # weight_filler { 155 | # type: "xavier" 156 | # } 157 | bias_filler { 158 | type: "constant" 159 | # value: 1 160 | } 161 | } 162 | } 163 | layer { 164 | name: "head0_relu3" 165 | type: "ReLU" 166 | bottom: "head0_conv3" 167 | top: "head0_conv3" 168 | } 169 | 170 | layer { 171 | name: "head0_conv4" 172 | type: "Convolution" 173 | bottom: "head0_conv3" 174 | top: "head0_conv4" 175 | param { 176 | lr_mult: 1 177 | decay_mult: 1 178 | } 179 | param { 180 | lr_mult: 2 181 | decay_mult: 0 182 | } 183 | convolution_param { 184 | num_output: 1000 185 | kernel_size: 1 186 | stride: 1 187 | pad: 0 188 | weight_filler { 189 | type: "gaussian" 190 | std: 0.35 191 | } 192 | # weight_filler { 193 | # type: "xavier" 194 | # } 195 | bias_filler { 196 | type: "constant" 197 | # value: 1 198 | } 199 | } 200 | } 201 | 202 | layer { 203 | name: "head0_relu4" 204 | type: "ReLU" 205 | bottom: "head0_conv4" 206 | top: "head0_conv4" 207 | } 208 | 209 | layer { 210 | name: "head0_conv5" 211 | type: "Convolution" 212 | bottom: "head0_conv4" 213 | top: "head0_conv5" 214 | param { 215 | lr_mult: 1 216 | decay_mult: 1 217 | } 218 | param { 219 | lr_mult: 2 220 | decay_mult: 0 221 | } 222 | convolution_param { 223 | num_output: 400 224 | kernel_size: 1 225 | stride: 1 226 | pad: 0 227 | weight_filler { 228 | type: "gaussian" 229 | std: 0.1 230 | } 231 | # weight_filler { 232 | # type: "xavier" 233 | # } 234 | bias_filler { 235 | type: "constant" 236 | # value: 1 237 | } 238 | } 239 | } 240 | 241 | layer { 242 | name: "head0_relu5" 243 | type: "ReLU" 244 | bottom: "head0_conv5" 245 | top: "head0_conv5" 246 | } 247 | 248 | 249 | # Convolutional Layers 250 | ################################################################################ 251 | layer { 252 | name: "head1_conv1" 253 | type: "Convolution" 254 | bottom: "data_s1" 255 | top: "head1_conv1" 256 | param { 257 | lr_mult: 1 258 | decay_mult: 1 259 | } 260 | param { 261 | lr_mult: 2 262 | decay_mult: 0 263 | } 264 | convolution_param { 265 | num_output: 32 266 | pad: 3 267 | kernel_size: 7 268 | stride: 1 269 | weight_filler { 270 | type: "gaussian" 271 | std: 0.01 272 | } 273 | # weight_filler { 274 | # type: "xavier" 275 | # } 276 | bias_filler { 277 | type: "constant" 278 | # value: 1 279 | } 280 | } 281 | } 282 | layer { 283 | name: "head1_relu1" 284 | type: "ReLU" 285 | bottom: "head1_conv1" 286 | top: "head1_conv1" 287 | } 288 | layer { 289 | name: "head1_pool1" 290 | type: "Pooling" 291 | bottom: "head1_conv1" 292 | top: "head1_pool1" 293 | pooling_param { 294 | pool: MAX 295 | kernel_size: 2 296 | stride: 2 297 | } 298 | } 299 | 300 | layer { 301 | name: "head1_conv2" 302 | type: "Convolution" 303 | bottom: "head1_pool1" 304 | top: "head1_conv2" 305 | param { 306 | lr_mult: 1 307 | decay_mult: 1 308 | } 309 | param { 310 | lr_mult: 2 311 | decay_mult: 0 312 | } 313 | convolution_param { 314 | num_output: 32 315 | pad: 3 316 | kernel_size: 7 317 | stride: 1 318 | # weight_filler { 319 | # type: "xavier" 320 | # } 321 | weight_filler { 322 | type: "gaussian" 323 | std: 0.2 324 | } 325 | bias_filler { 326 | type: "constant" 327 | # value: 1 328 | } 329 | } 330 | } 331 | layer { 332 | name: "head1_relu2" 333 | type: "ReLU" 334 | bottom: "head1_conv2" 335 | top: "head1_conv2" 336 | } 337 | layer { 338 | name: "head1_pool2" 339 | type: "Pooling" 340 | bottom: "head1_conv2" 341 | top: "head1_pool2" 342 | pooling_param { 343 | pool: MAX 344 | kernel_size: 2 345 | stride: 2 346 | } 347 | } 348 | 349 | layer { 350 | name: "head1_conv3" 351 | type: "Convolution" 352 | bottom: "head1_pool2" 353 | top: "head1_conv3" 354 | param { 355 | lr_mult: 1 356 | decay_mult: 1 357 | } 358 | param { 359 | lr_mult: 2 360 | decay_mult: 0 361 | } 362 | convolution_param { 363 | num_output: 64 364 | kernel_size: 5 365 | stride: 1 366 | pad: 2 367 | weight_filler { 368 | type: "gaussian" 369 | std: 0.0001 370 | } 371 | # weight_filler { 372 | # type: "xavier" 373 | # } 374 | bias_filler { 375 | type: "constant" 376 | # value: 1 377 | } 378 | } 379 | } 380 | layer { 381 | name: "head1_relu3" 382 | type: "ReLU" 383 | bottom: "head1_conv3" 384 | top: "head1_conv3" 385 | } 386 | 387 | layer { 388 | name: "head1_conv4" 389 | type: "Convolution" 390 | bottom: "head1_conv3" 391 | top: "head1_conv4" 392 | param { 393 | lr_mult: 1 394 | decay_mult: 1 395 | } 396 | param { 397 | lr_mult: 2 398 | decay_mult: 0 399 | } 400 | convolution_param { 401 | num_output: 1000 402 | kernel_size: 1 403 | stride: 1 404 | pad: 0 405 | weight_filler { 406 | type: "gaussian" 407 | std: 0.35 408 | } 409 | # weight_filler { 410 | # type: "xavier" 411 | # } 412 | bias_filler { 413 | type: "constant" 414 | # value: 1 415 | } 416 | } 417 | } 418 | 419 | layer { 420 | name: "head1_relu4" 421 | type: "ReLU" 422 | bottom: "head1_conv4" 423 | top: "head1_conv4" 424 | } 425 | 426 | layer { 427 | name: "head1_conv5" 428 | type: "Convolution" 429 | bottom: "head1_conv4" 430 | top: "head1_conv5" 431 | param { 432 | lr_mult: 1 433 | decay_mult: 1 434 | } 435 | param { 436 | lr_mult: 2 437 | decay_mult: 0 438 | } 439 | convolution_param { 440 | num_output: 400 441 | kernel_size: 1 442 | stride: 1 443 | pad: 0 444 | weight_filler { 445 | type: "gaussian" 446 | std: 0.1 447 | } 448 | # weight_filler { 449 | # type: "xavier" 450 | # } 451 | bias_filler { 452 | type: "constant" 453 | # value: 1 454 | } 455 | } 456 | } 457 | 458 | layer { 459 | name: "head1_relu5" 460 | type: "ReLU" 461 | bottom: "head1_conv5" 462 | top: "head1_conv5" 463 | } 464 | 465 | 466 | # Convolutional Layers 467 | ################################################################################ 468 | 469 | layer { 470 | name: "concat5" 471 | bottom: "head0_conv5" 472 | bottom: "head1_conv5" 473 | top: "shoulder_concat5" 474 | type: "Concat" 475 | concat_param { 476 | axis: 1 477 | } 478 | } 479 | 480 | layer { 481 | name: "body_fc6" 482 | type: "InnerProduct" 483 | bottom: "shoulder_concat5" 484 | top: "body_fc6" 485 | param { 486 | lr_mult: 1 487 | decay_mult: 1 488 | } 489 | param { 490 | lr_mult: 2 491 | decay_mult: 0 492 | } 493 | inner_product_param { 494 | num_output: 512 495 | weight_filler { 496 | type: "gaussian" 497 | std: 0.1 498 | } 499 | # weight_filler { 500 | # type: "xavier" 501 | # } 502 | bias_filler { 503 | type: "constant" 504 | # value: 1 505 | } 506 | } 507 | } 508 | 509 | layer { 510 | name: "body_relu6" 511 | type: "ReLU" 512 | bottom: "body_fc6" 513 | top: "body_fc6" 514 | } 515 | 516 | layer { 517 | name: "body_fc7" 518 | type: "InnerProduct" 519 | bottom: "body_fc6" 520 | top: "body_fc7" 521 | param { 522 | lr_mult: 1 523 | decay_mult: 1 524 | } 525 | param { 526 | lr_mult: 2 527 | decay_mult: 0 528 | } 529 | inner_product_param { 530 | num_output: 512 531 | weight_filler { 532 | type: "gaussian" 533 | std: 0.2 534 | } 535 | # weight_filler { 536 | # type: "xavier" 537 | # } 538 | bias_filler { 539 | type: "constant" 540 | # value: 1 541 | } 542 | } 543 | } 544 | 545 | layer { 546 | name: "body_relu7" 547 | type: "ReLU" 548 | bottom: "body_fc7" 549 | top: "body_fc7" 550 | } 551 | 552 | 553 | layer { 554 | name: "body_fc8" 555 | type: "InnerProduct" 556 | bottom: "body_fc7" 557 | top: "body_fc8" 558 | param { 559 | lr_mult: 1 560 | decay_mult: 1 561 | } 562 | param { 563 | lr_mult: 2 564 | decay_mult: 0 565 | } 566 | inner_product_param { 567 | num_output: 324 568 | weight_filler { 569 | type: "constant" 570 | value: 0 571 | } 572 | # weight_filler { 573 | # type: "xavier" 574 | # } 575 | bias_filler { 576 | type: "constant" 577 | # value: 1 578 | } 579 | } 580 | } 581 | 582 | # Loss Layers and Test 583 | ################################################################################ 584 | layer { 585 | name: "loss" 586 | type: "EuclideanLoss" 587 | bottom: "body_fc8" 588 | bottom: "label" 589 | top: "loss" 590 | } 591 | 592 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_down_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "data_s1" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/down_train.txt" 13 | batch_size: 16 14 | shuffle: true 15 | } 16 | } 17 | #layer { 18 | # name: "data" 19 | # type: "HDF5Data" 20 | # top: "data_s0" 21 | # top: "data_s1" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/down_test.txt" 28 | # batch_size: 16 29 | # shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "head0_conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "head0_conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.01 55 | } 56 | # weight_filler { 57 | # type: "xavier" 58 | # } 59 | bias_filler { 60 | type: "constant" 61 | # value: 1 62 | } 63 | } 64 | } 65 | layer { 66 | name: "head0_relu1" 67 | type: "ReLU" 68 | bottom: "head0_conv1" 69 | top: "head0_conv1" 70 | } 71 | layer { 72 | name: "head0_pool1" 73 | type: "Pooling" 74 | bottom: "head0_conv1" 75 | top: "head0_pool1" 76 | pooling_param { 77 | pool: MAX 78 | kernel_size: 2 79 | stride: 2 80 | } 81 | } 82 | 83 | layer { 84 | name: "head0_conv2" 85 | type: "Convolution" 86 | bottom: "head0_pool1" 87 | top: "head0_conv2" 88 | param { 89 | lr_mult: 1 90 | decay_mult: 1 91 | } 92 | param { 93 | lr_mult: 2 94 | decay_mult: 0 95 | } 96 | convolution_param { 97 | num_output: 32 98 | pad: 3 99 | kernel_size: 7 100 | stride: 1 101 | # weight_filler { 102 | # type: "xavier" 103 | # } 104 | weight_filler { 105 | type: "gaussian" 106 | std: 0.2 107 | } 108 | bias_filler { 109 | type: "constant" 110 | # value: 1 111 | } 112 | } 113 | } 114 | layer { 115 | name: "head0_relu2" 116 | type: "ReLU" 117 | bottom: "head0_conv2" 118 | top: "head0_conv2" 119 | } 120 | layer { 121 | name: "head0_pool2" 122 | type: "Pooling" 123 | bottom: "head0_conv2" 124 | top: "head0_pool2" 125 | pooling_param { 126 | pool: MAX 127 | kernel_size: 2 128 | stride: 2 129 | } 130 | } 131 | 132 | layer { 133 | name: "head0_conv3" 134 | type: "Convolution" 135 | bottom: "head0_pool2" 136 | top: "head0_conv3" 137 | param { 138 | lr_mult: 1 139 | decay_mult: 1 140 | } 141 | param { 142 | lr_mult: 2 143 | decay_mult: 0 144 | } 145 | convolution_param { 146 | num_output: 64 147 | kernel_size: 5 148 | stride: 1 149 | pad: 2 150 | weight_filler { 151 | type: "gaussian" 152 | std: 0.0001 153 | } 154 | # weight_filler { 155 | # type: "xavier" 156 | # } 157 | bias_filler { 158 | type: "constant" 159 | # value: 1 160 | } 161 | } 162 | } 163 | layer { 164 | name: "head0_relu3" 165 | type: "ReLU" 166 | bottom: "head0_conv3" 167 | top: "head0_conv3" 168 | } 169 | 170 | layer { 171 | name: "head0_conv4" 172 | type: "Convolution" 173 | bottom: "head0_conv3" 174 | top: "head0_conv4" 175 | param { 176 | lr_mult: 1 177 | decay_mult: 1 178 | } 179 | param { 180 | lr_mult: 2 181 | decay_mult: 0 182 | } 183 | convolution_param { 184 | num_output: 1000 185 | kernel_size: 1 186 | stride: 1 187 | pad: 0 188 | weight_filler { 189 | type: "gaussian" 190 | std: 0.35 191 | } 192 | # weight_filler { 193 | # type: "xavier" 194 | # } 195 | bias_filler { 196 | type: "constant" 197 | # value: 1 198 | } 199 | } 200 | } 201 | 202 | layer { 203 | name: "head0_relu4" 204 | type: "ReLU" 205 | bottom: "head0_conv4" 206 | top: "head0_conv4" 207 | } 208 | 209 | layer { 210 | name: "head0_conv5" 211 | type: "Convolution" 212 | bottom: "head0_conv4" 213 | top: "head0_conv5" 214 | param { 215 | lr_mult: 1 216 | decay_mult: 1 217 | } 218 | param { 219 | lr_mult: 2 220 | decay_mult: 0 221 | } 222 | convolution_param { 223 | num_output: 400 224 | kernel_size: 1 225 | stride: 1 226 | pad: 0 227 | weight_filler { 228 | type: "gaussian" 229 | std: 0.1 230 | } 231 | # weight_filler { 232 | # type: "xavier" 233 | # } 234 | bias_filler { 235 | type: "constant" 236 | # value: 1 237 | } 238 | } 239 | } 240 | 241 | layer { 242 | name: "head0_relu5" 243 | type: "ReLU" 244 | bottom: "head0_conv5" 245 | top: "head0_conv5" 246 | } 247 | 248 | 249 | # Convolutional Layers 250 | ################################################################################ 251 | layer { 252 | name: "head1_conv1" 253 | type: "Convolution" 254 | bottom: "data_s1" 255 | top: "head1_conv1" 256 | param { 257 | lr_mult: 1 258 | decay_mult: 1 259 | } 260 | param { 261 | lr_mult: 2 262 | decay_mult: 0 263 | } 264 | convolution_param { 265 | num_output: 32 266 | pad: 3 267 | kernel_size: 7 268 | stride: 1 269 | weight_filler { 270 | type: "gaussian" 271 | std: 0.01 272 | } 273 | # weight_filler { 274 | # type: "xavier" 275 | # } 276 | bias_filler { 277 | type: "constant" 278 | # value: 1 279 | } 280 | } 281 | } 282 | layer { 283 | name: "head1_relu1" 284 | type: "ReLU" 285 | bottom: "head1_conv1" 286 | top: "head1_conv1" 287 | } 288 | layer { 289 | name: "head1_pool1" 290 | type: "Pooling" 291 | bottom: "head1_conv1" 292 | top: "head1_pool1" 293 | pooling_param { 294 | pool: MAX 295 | kernel_size: 2 296 | stride: 2 297 | } 298 | } 299 | 300 | layer { 301 | name: "head1_conv2" 302 | type: "Convolution" 303 | bottom: "head1_pool1" 304 | top: "head1_conv2" 305 | param { 306 | lr_mult: 1 307 | decay_mult: 1 308 | } 309 | param { 310 | lr_mult: 2 311 | decay_mult: 0 312 | } 313 | convolution_param { 314 | num_output: 32 315 | pad: 3 316 | kernel_size: 7 317 | stride: 1 318 | # weight_filler { 319 | # type: "xavier" 320 | # } 321 | weight_filler { 322 | type: "gaussian" 323 | std: 0.2 324 | } 325 | bias_filler { 326 | type: "constant" 327 | # value: 1 328 | } 329 | } 330 | } 331 | layer { 332 | name: "head1_relu2" 333 | type: "ReLU" 334 | bottom: "head1_conv2" 335 | top: "head1_conv2" 336 | } 337 | layer { 338 | name: "head1_pool2" 339 | type: "Pooling" 340 | bottom: "head1_conv2" 341 | top: "head1_pool2" 342 | pooling_param { 343 | pool: MAX 344 | kernel_size: 2 345 | stride: 2 346 | } 347 | } 348 | 349 | layer { 350 | name: "head1_conv3" 351 | type: "Convolution" 352 | bottom: "head1_pool2" 353 | top: "head1_conv3" 354 | param { 355 | lr_mult: 1 356 | decay_mult: 1 357 | } 358 | param { 359 | lr_mult: 2 360 | decay_mult: 0 361 | } 362 | convolution_param { 363 | num_output: 64 364 | kernel_size: 5 365 | stride: 1 366 | pad: 2 367 | weight_filler { 368 | type: "gaussian" 369 | std: 0.0001 370 | } 371 | # weight_filler { 372 | # type: "xavier" 373 | # } 374 | bias_filler { 375 | type: "constant" 376 | # value: 1 377 | } 378 | } 379 | } 380 | layer { 381 | name: "head1_relu3" 382 | type: "ReLU" 383 | bottom: "head1_conv3" 384 | top: "head1_conv3" 385 | } 386 | 387 | layer { 388 | name: "head1_conv4" 389 | type: "Convolution" 390 | bottom: "head1_conv3" 391 | top: "head1_conv4" 392 | param { 393 | lr_mult: 1 394 | decay_mult: 1 395 | } 396 | param { 397 | lr_mult: 2 398 | decay_mult: 0 399 | } 400 | convolution_param { 401 | num_output: 1000 402 | kernel_size: 1 403 | stride: 1 404 | pad: 0 405 | weight_filler { 406 | type: "gaussian" 407 | std: 0.35 408 | } 409 | # weight_filler { 410 | # type: "xavier" 411 | # } 412 | bias_filler { 413 | type: "constant" 414 | # value: 1 415 | } 416 | } 417 | } 418 | 419 | layer { 420 | name: "head1_relu4" 421 | type: "ReLU" 422 | bottom: "head1_conv4" 423 | top: "head1_conv4" 424 | } 425 | 426 | layer { 427 | name: "head1_conv5" 428 | type: "Convolution" 429 | bottom: "head1_conv4" 430 | top: "head1_conv5" 431 | param { 432 | lr_mult: 1 433 | decay_mult: 1 434 | } 435 | param { 436 | lr_mult: 2 437 | decay_mult: 0 438 | } 439 | convolution_param { 440 | num_output: 400 441 | kernel_size: 1 442 | stride: 1 443 | pad: 0 444 | weight_filler { 445 | type: "gaussian" 446 | std: 0.01 447 | } 448 | # weight_filler { 449 | # type: "xavier" 450 | # } 451 | bias_filler { 452 | type: "constant" 453 | # value: 1 454 | } 455 | } 456 | } 457 | 458 | layer { 459 | name: "head1_relu5" 460 | type: "ReLU" 461 | bottom: "head1_conv5" 462 | top: "head1_conv5" 463 | } 464 | 465 | 466 | # Convolutional Layers 467 | ################################################################################ 468 | 469 | layer { 470 | name: "concat5" 471 | bottom: "head0_conv5" 472 | bottom: "head1_conv5" 473 | top: "shoulder_concat5" 474 | type: "Concat" 475 | concat_param { 476 | axis: 1 477 | } 478 | } 479 | 480 | layer { 481 | name: "body_fc6" 482 | type: "InnerProduct" 483 | bottom: "shoulder_concat5" 484 | top: "body_fc6" 485 | param { 486 | lr_mult: 1 487 | decay_mult: 1 488 | } 489 | param { 490 | lr_mult: 2 491 | decay_mult: 0 492 | } 493 | inner_product_param { 494 | num_output: 512 495 | weight_filler { 496 | type: "gaussian" 497 | std: 0.05 498 | } 499 | # weight_filler { 500 | # type: "xavier" 501 | # } 502 | bias_filler { 503 | type: "constant" 504 | # value: 1 505 | } 506 | } 507 | } 508 | 509 | layer { 510 | name: "body_relu6" 511 | type: "ReLU" 512 | bottom: "body_fc6" 513 | top: "body_fc6" 514 | } 515 | 516 | layer { 517 | name: "body_fc7" 518 | type: "InnerProduct" 519 | bottom: "body_fc6" 520 | top: "body_fc7" 521 | param { 522 | lr_mult: 1 523 | decay_mult: 1 524 | } 525 | param { 526 | lr_mult: 2 527 | decay_mult: 0 528 | } 529 | inner_product_param { 530 | num_output: 512 531 | weight_filler { 532 | type: "gaussian" 533 | std: 0.05 534 | } 535 | # weight_filler { 536 | # type: "xavier" 537 | # } 538 | bias_filler { 539 | type: "constant" 540 | # value: 1 541 | } 542 | } 543 | } 544 | 545 | layer { 546 | name: "body_relu7" 547 | type: "ReLU" 548 | bottom: "body_fc7" 549 | top: "body_fc7" 550 | } 551 | 552 | 553 | layer { 554 | name: "body_fc8" 555 | type: "InnerProduct" 556 | bottom: "body_fc7" 557 | top: "body_fc8" 558 | param { 559 | lr_mult: 1 560 | decay_mult: 1 561 | } 562 | param { 563 | lr_mult: 2 564 | decay_mult: 0 565 | } 566 | inner_product_param { 567 | num_output: 324 568 | weight_filler { 569 | type: "constant" 570 | value: 0 571 | } 572 | # weight_filler { 573 | # type: "xavier" 574 | # } 575 | bias_filler { 576 | type: "constant" 577 | # value: 1 578 | } 579 | } 580 | } 581 | 582 | # Loss Layers and Test 583 | ################################################################################ 584 | layer { 585 | name: "loss" 586 | type: "EuclideanLoss" 587 | bottom: "body_fc8" 588 | bottom: "label" 589 | top: "loss" 590 | } 591 | 592 | -------------------------------------------------------------------------------- /models/ucsd/hydra2/hydra2_min_train_val.prototxt: -------------------------------------------------------------------------------- 1 | name: "UCSD_CNN" 2 | layer { 3 | name: "data" 4 | type: "HDF5Data" 5 | top: "data_s0" 6 | top: "data_s1" 7 | top: "label" 8 | # include { 9 | # phase: TRAIN 10 | # } 11 | hdf5_data_param { 12 | source: "genfiles/features/min_train.txt" 13 | batch_size: 16 14 | shuffle: true 15 | } 16 | } 17 | #layer { 18 | # name: "data" 19 | # type: "HDF5Data" 20 | # top: "data_s0" 21 | # top: "data_s1" 22 | # top: "label" 23 | # include { 24 | # phase: TEST 25 | # } 26 | # hdf5_data_param { 27 | # source: "genfiles/features/min_test.txt" 28 | # batch_size: 16 29 | # shuffle: true 30 | # } 31 | #} 32 | # Convolutional Layers 33 | ################################################################################ 34 | layer { 35 | name: "head0_conv1" 36 | type: "Convolution" 37 | bottom: "data_s0" 38 | top: "head0_conv1" 39 | param { 40 | lr_mult: 1 41 | decay_mult: 1 42 | } 43 | param { 44 | lr_mult: 2 45 | decay_mult: 0 46 | } 47 | convolution_param { 48 | num_output: 32 49 | pad: 3 50 | kernel_size: 7 51 | stride: 1 52 | weight_filler { 53 | type: "gaussian" 54 | std: 0.01 55 | } 56 | # weight_filler { 57 | # type: "xavier" 58 | # } 59 | bias_filler { 60 | type: "constant" 61 | # value: 1 62 | } 63 | } 64 | } 65 | layer { 66 | name: "head0_relu1" 67 | type: "ReLU" 68 | bottom: "head0_conv1" 69 | top: "head0_conv1" 70 | } 71 | layer { 72 | name: "head0_pool1" 73 | type: "Pooling" 74 | bottom: "head0_conv1" 75 | top: "head0_pool1" 76 | pooling_param { 77 | pool: MAX 78 | kernel_size: 2 79 | stride: 2 80 | } 81 | } 82 | 83 | layer { 84 | name: "head0_conv2" 85 | type: "Convolution" 86 | bottom: "head0_pool1" 87 | top: "head0_conv2" 88 | param { 89 | lr_mult: 1 90 | decay_mult: 1 91 | } 92 | param { 93 | lr_mult: 2 94 | decay_mult: 0 95 | } 96 | convolution_param { 97 | num_output: 32 98 | pad: 3 99 | kernel_size: 7 100 | stride: 1 101 | # weight_filler { 102 | # type: "xavier" 103 | # } 104 | weight_filler { 105 | type: "gaussian" 106 | std: 0.2 107 | } 108 | bias_filler { 109 | type: "constant" 110 | # value: 1 111 | } 112 | } 113 | } 114 | layer { 115 | name: "head0_relu2" 116 | type: "ReLU" 117 | bottom: "head0_conv2" 118 | top: "head0_conv2" 119 | } 120 | layer { 121 | name: "head0_pool2" 122 | type: "Pooling" 123 | bottom: "head0_conv2" 124 | top: "head0_pool2" 125 | pooling_param { 126 | pool: MAX 127 | kernel_size: 2 128 | stride: 2 129 | } 130 | } 131 | 132 | layer { 133 | name: "head0_conv3" 134 | type: "Convolution" 135 | bottom: "head0_pool2" 136 | top: "head0_conv3" 137 | param { 138 | lr_mult: 1 139 | decay_mult: 1 140 | } 141 | param { 142 | lr_mult: 2 143 | decay_mult: 0 144 | } 145 | convolution_param { 146 | num_output: 64 147 | kernel_size: 5 148 | stride: 1 149 | pad: 2 150 | weight_filler { 151 | type: "gaussian" 152 | std: 0.0001 153 | } 154 | # weight_filler { 155 | # type: "xavier" 156 | # } 157 | bias_filler { 158 | type: "constant" 159 | # value: 1 160 | } 161 | } 162 | } 163 | layer { 164 | name: "head0_relu3" 165 | type: "ReLU" 166 | bottom: "head0_conv3" 167 | top: "head0_conv3" 168 | } 169 | 170 | layer { 171 | name: "head0_conv4" 172 | type: "Convolution" 173 | bottom: "head0_conv3" 174 | top: "head0_conv4" 175 | param { 176 | lr_mult: 1 177 | decay_mult: 1 178 | } 179 | param { 180 | lr_mult: 2 181 | decay_mult: 0 182 | } 183 | convolution_param { 184 | num_output: 1000 185 | kernel_size: 1 186 | stride: 1 187 | pad: 0 188 | weight_filler { 189 | type: "gaussian" 190 | std: 0.35 191 | } 192 | # weight_filler { 193 | # type: "xavier" 194 | # } 195 | bias_filler { 196 | type: "constant" 197 | # value: 1 198 | } 199 | } 200 | } 201 | 202 | layer { 203 | name: "head0_relu4" 204 | type: "ReLU" 205 | bottom: "head0_conv4" 206 | top: "head0_conv4" 207 | } 208 | 209 | layer { 210 | name: "head0_conv5" 211 | type: "Convolution" 212 | bottom: "head0_conv4" 213 | top: "head0_conv5" 214 | param { 215 | lr_mult: 1 216 | decay_mult: 1 217 | } 218 | param { 219 | lr_mult: 2 220 | decay_mult: 0 221 | } 222 | convolution_param { 223 | num_output: 400 224 | kernel_size: 1 225 | stride: 1 226 | pad: 0 227 | weight_filler { 228 | type: "gaussian" 229 | std: 0.1 230 | } 231 | # weight_filler { 232 | # type: "xavier" 233 | # } 234 | bias_filler { 235 | type: "constant" 236 | # value: 1 237 | } 238 | } 239 | } 240 | 241 | layer { 242 | name: "head0_relu5" 243 | type: "ReLU" 244 | bottom: "head0_conv5" 245 | top: "head0_conv5" 246 | } 247 | 248 | 249 | # Convolutional Layers 250 | ################################################################################ 251 | layer { 252 | name: "head1_conv1" 253 | type: "Convolution" 254 | bottom: "data_s1" 255 | top: "head1_conv1" 256 | param { 257 | lr_mult: 1 258 | decay_mult: 1 259 | } 260 | param { 261 | lr_mult: 2 262 | decay_mult: 0 263 | } 264 | convolution_param { 265 | num_output: 32 266 | pad: 3 267 | kernel_size: 7 268 | stride: 1 269 | weight_filler { 270 | type: "gaussian" 271 | std: 0.01 272 | } 273 | # weight_filler { 274 | # type: "xavier" 275 | # } 276 | bias_filler { 277 | type: "constant" 278 | # value: 1 279 | } 280 | } 281 | } 282 | layer { 283 | name: "head1_relu1" 284 | type: "ReLU" 285 | bottom: "head1_conv1" 286 | top: "head1_conv1" 287 | } 288 | layer { 289 | name: "head1_pool1" 290 | type: "Pooling" 291 | bottom: "head1_conv1" 292 | top: "head1_pool1" 293 | pooling_param { 294 | pool: MAX 295 | kernel_size: 2 296 | stride: 2 297 | } 298 | } 299 | 300 | layer { 301 | name: "head1_conv2" 302 | type: "Convolution" 303 | bottom: "head1_pool1" 304 | top: "head1_conv2" 305 | param { 306 | lr_mult: 1 307 | decay_mult: 1 308 | } 309 | param { 310 | lr_mult: 2 311 | decay_mult: 0 312 | } 313 | convolution_param { 314 | num_output: 32 315 | pad: 3 316 | kernel_size: 7 317 | stride: 1 318 | # weight_filler { 319 | # type: "xavier" 320 | # } 321 | weight_filler { 322 | type: "gaussian" 323 | std: 0.2 324 | } 325 | bias_filler { 326 | type: "constant" 327 | # value: 1 328 | } 329 | } 330 | } 331 | layer { 332 | name: "head1_relu2" 333 | type: "ReLU" 334 | bottom: "head1_conv2" 335 | top: "head1_conv2" 336 | } 337 | layer { 338 | name: "head1_pool2" 339 | type: "Pooling" 340 | bottom: "head1_conv2" 341 | top: "head1_pool2" 342 | pooling_param { 343 | pool: MAX 344 | kernel_size: 2 345 | stride: 2 346 | } 347 | } 348 | 349 | layer { 350 | name: "head1_conv3" 351 | type: "Convolution" 352 | bottom: "head1_pool2" 353 | top: "head1_conv3" 354 | param { 355 | lr_mult: 1 356 | decay_mult: 1 357 | } 358 | param { 359 | lr_mult: 2 360 | decay_mult: 0 361 | } 362 | convolution_param { 363 | num_output: 64 364 | kernel_size: 5 365 | stride: 1 366 | pad: 2 367 | weight_filler { 368 | type: "gaussian" 369 | std: 0.0001 370 | } 371 | # weight_filler { 372 | # type: "xavier" 373 | # } 374 | bias_filler { 375 | type: "constant" 376 | # value: 1 377 | } 378 | } 379 | } 380 | layer { 381 | name: "head1_relu3" 382 | type: "ReLU" 383 | bottom: "head1_conv3" 384 | top: "head1_conv3" 385 | } 386 | 387 | layer { 388 | name: "head1_conv4" 389 | type: "Convolution" 390 | bottom: "head1_conv3" 391 | top: "head1_conv4" 392 | param { 393 | lr_mult: 1 394 | decay_mult: 1 395 | } 396 | param { 397 | lr_mult: 2 398 | decay_mult: 0 399 | } 400 | convolution_param { 401 | num_output: 1000 402 | kernel_size: 1 403 | stride: 1 404 | pad: 0 405 | weight_filler { 406 | type: "gaussian" 407 | std: 0.35 408 | } 409 | # weight_filler { 410 | # type: "xavier" 411 | # } 412 | bias_filler { 413 | type: "constant" 414 | # value: 1 415 | } 416 | } 417 | } 418 | 419 | layer { 420 | name: "head1_relu4" 421 | type: "ReLU" 422 | bottom: "head1_conv4" 423 | top: "head1_conv4" 424 | } 425 | 426 | layer { 427 | name: "head1_conv5" 428 | type: "Convolution" 429 | bottom: "head1_conv4" 430 | top: "head1_conv5" 431 | param { 432 | lr_mult: 1 433 | decay_mult: 1 434 | } 435 | param { 436 | lr_mult: 2 437 | decay_mult: 0 438 | } 439 | convolution_param { 440 | num_output: 400 441 | kernel_size: 1 442 | stride: 1 443 | pad: 0 444 | weight_filler { 445 | type: "gaussian" 446 | std: 0.01 447 | } 448 | # weight_filler { 449 | # type: "xavier" 450 | # } 451 | bias_filler { 452 | type: "constant" 453 | # value: 1 454 | } 455 | } 456 | } 457 | 458 | layer { 459 | name: "head1_relu5" 460 | type: "ReLU" 461 | bottom: "head1_conv5" 462 | top: "head1_conv5" 463 | } 464 | 465 | 466 | # Convolutional Layers 467 | ################################################################################ 468 | 469 | layer { 470 | name: "concat5" 471 | bottom: "head0_conv5" 472 | bottom: "head1_conv5" 473 | top: "shoulder_concat5" 474 | type: "Concat" 475 | concat_param { 476 | axis: 1 477 | } 478 | } 479 | 480 | layer { 481 | name: "body_fc6" 482 | type: "InnerProduct" 483 | bottom: "shoulder_concat5" 484 | top: "body_fc6" 485 | param { 486 | lr_mult: 1 487 | decay_mult: 1 488 | } 489 | param { 490 | lr_mult: 2 491 | decay_mult: 0 492 | } 493 | inner_product_param { 494 | num_output: 512 495 | weight_filler { 496 | type: "gaussian" 497 | std: 0.05 498 | } 499 | # weight_filler { 500 | # type: "xavier" 501 | # } 502 | bias_filler { 503 | type: "constant" 504 | # value: 1 505 | } 506 | } 507 | } 508 | 509 | layer { 510 | name: "body_relu6" 511 | type: "ReLU" 512 | bottom: "body_fc6" 513 | top: "body_fc6" 514 | } 515 | 516 | layer { 517 | name: "body_fc7" 518 | type: "InnerProduct" 519 | bottom: "body_fc6" 520 | top: "body_fc7" 521 | param { 522 | lr_mult: 1 523 | decay_mult: 1 524 | } 525 | param { 526 | lr_mult: 2 527 | decay_mult: 0 528 | } 529 | inner_product_param { 530 | num_output: 512 531 | weight_filler { 532 | type: "gaussian" 533 | std: 0.05 534 | } 535 | # weight_filler { 536 | # type: "xavier" 537 | # } 538 | bias_filler { 539 | type: "constant" 540 | # value: 1 541 | } 542 | } 543 | } 544 | 545 | layer { 546 | name: "body_relu7" 547 | type: "ReLU" 548 | bottom: "body_fc7" 549 | top: "body_fc7" 550 | } 551 | 552 | 553 | layer { 554 | name: "body_fc8" 555 | type: "InnerProduct" 556 | bottom: "body_fc7" 557 | top: "body_fc8" 558 | param { 559 | lr_mult: 1 560 | decay_mult: 1 561 | } 562 | param { 563 | lr_mult: 2 564 | decay_mult: 0 565 | } 566 | inner_product_param { 567 | num_output: 324 568 | weight_filler { 569 | type: "constant" 570 | value: 0 571 | } 572 | # weight_filler { 573 | # type: "xavier" 574 | # } 575 | bias_filler { 576 | type: "constant" 577 | # value: 1 578 | } 579 | } 580 | } 581 | 582 | # Loss Layers and Test 583 | ################################################################################ 584 | layer { 585 | name: "loss" 586 | type: "EuclideanLoss" 587 | bottom: "body_fc8" 588 | bottom: "label" 589 | top: "loss" 590 | } 591 | 592 | --------------------------------------------------------------------------------