Final project by Group 2 (Localization) in HDU CS Innovation & Practice Course (2018 Spring).
This repo is based on Car-detection-PA, containing a tutorial for YOLOv2, which is a programming assignment in Convolutional Neural Networks by Andrew Ng.
- Keras
- Tensorflow (For Keras backend.)
- OpenCV
- h5py (For Keras model serialization.)
- Python 3
Use pip
to install the required packages in your command line. Visit the official sites above for more details.
pip install numpy h5py
pip install tensorflow # CPU-only
pip install keras
pip install opencv-python
- Download (Password: 8kim) an existing pretrained Keras YOLO model stored in
yolo.h5
. (These weights come from the official YOLO website, and were converted using a function written in YAD2K) and put it intomodel_data/
folder. - Put your test image/video in
images/
orvideos/
. - Set your image/video file and shape in
yolo_v2.py
.
if __name__ == '__main__':
'''
code
'''
# Set the original image/video shape
image_shape = (960., 544.) # (height, width)
# Detect a video
video_file = "traffic.mp4"
predict_video(sess, video_file) # output in out/
# Uncomment the code below to detect an image
# out_scores, out_boxes, out_classes = predict_image(sess, "person.jpg")
- Run the model in your command line.
python yolo_v2.py
- The prediction info will be printed into
output.txt
. - The notebook version will be uploaded very soon.
# todo
- Unify the interface in the video detection part.
- Train the model.
- Try YOLOv3.
- ...
- Joseph Redmon, Santosh Divvala, Ross Girshick, Ali Farhadi - You Only Look Once: Unified, Real-Time Object Detection (2015)
- Joseph Redmon, Ali Farhadi - YOLO9000: Better, Faster, Stronger (2016)
- Allan Zelener - YAD2K: Yet Another Darknet 2 Keras
- The official YOLO website (https://pjreddie.com/darknet/yolo/)