This repository implements the code for Repulsion Loss: Detecting pedestrians in a crowd. This page(code, project and presentation) is the submission for Group B for final project for the course CS 256: Topics in Artificial Intelligence, Section 2 led by Prof. Mashhour Soul, PhD. The group members include:
The code maybe used for educational and commercial use under no warranties.
For questions on this project and code please reach out to: Rakesh Nagaraju
at rakesh.nagaraju@sjsu.edu
- PyTorch: 0.4.0
- TorchVision: 0.2.0
- CUDA: 8.0
Download PASCAL VOC 2007 dataset
Clone this repository
git clone https://github.com/Raki2205/Raki2205-Pedestrian-Detection-using-Faster-RCNN-with-Repulsion-Loss.git
cd into the folder
cd RepulsionLoss
Export the path for CUDA:
export CUDA_HOME="/usr/local/cuda-8.0"
export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64":$LD_LIBRARY_PATH
export PATH="/usr/local/cuda-8.0/bin:$PATH"
Verify that CUDA is indeed set to CUDA8
nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Tue_Jan_10_13:22:03_CST_2017 Cuda compilation tools, release 8.0, V8.0.61
Install the requirements
pip install -r requirements.txt
Run the startup.sh
script
sh startup.sh
This will compile the required libraries in the lib folder and also download a pre-trained model in data/pretrained_model directory and download PASCAL VOC dataset in data folder(if not just download Pascal VOC 2007 dataset from the internet and put in the folder named data).
NOTE: The libraries in the current state are compiled for Nvidia Tesla K80 GPU. Change the CUDA_ARCH argument in lib/make.sh
if you're using a different GPU. Refer this link for the correct architecture for your GPU. You can also refer the CUDA WIKI to get the correct architecture.
python trainval_net.py --dataset pascal_voc --net vgg16 --bs 4 --nw 1 --cuda
- Keep batch size (bs) < 4 on a Tesla K80 GPU as it will run out of memory
- Currently only works for
vgg16
. Future updates might include resnet101. - dataset can be changed to pascal_voc_0712 for PASCAL VOC 2012
For testing the model download the pre-trained weights and store it in models/vgg16/pascal_voc/faster_rcnn_1_10_2504.pth
python test_net.py --net vgg16 --checksession 1 --checkepoch 10 --checkpoint 2504 --cuda
Store the images that you need to run in the images folder. New images with detections will be stored in the same folder
python demo.py --cuda --load_dir models --net vgg16 --checksession 1 --checkepoch 10 --checkpoint 2504
This project was conducted with free credits provided by AWS educate team.