All Projects → longcw → Yolo2 Pytorch

longcw / Yolo2 Pytorch

YOLOv2 in PyTorch

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Yolo2 Pytorch

Pine
🌲 Aimbot powered by real-time object detection with neural networks, GPU accelerated with Nvidia. Optimized for use with CS:GO.
Stars: ✭ 202 (-85.5%)
Mutual labels:  yolo, darknet, detection
Pytorch Yolo2
Convert https://pjreddie.com/darknet/yolo/ into pytorch
Stars: ✭ 941 (-32.45%)
Mutual labels:  yolo, darknet, yolo2
Map
mean Average Precision - This code evaluates the performance of your neural net for object recognition.
Stars: ✭ 2,324 (+66.83%)
Mutual labels:  yolo, darknet, detection
Yolov2.pytorch
YOLOv2 algorithm reimplementation with pytorch
Stars: ✭ 31 (-97.77%)
Mutual labels:  yolo, darknet, yolo2
Yolo 9000
YOLO9000: Better, Faster, Stronger - Real-Time Object Detection. 9000 classes!
Stars: ✭ 1,057 (-24.12%)
Mutual labels:  yolo, darknet, yolo2
darknet
php ffi darknet
Stars: ✭ 21 (-98.49%)
Mutual labels:  detection, yolo, darknet
Pytorch Caffe Darknet Convert
convert between pytorch, caffe prototxt/weights and darknet cfg/weights
Stars: ✭ 867 (-37.76%)
Mutual labels:  yolo, darknet, yolo2
Tensorflow 2.x Yolov3
YOLOv3 implementation in TensorFlow 2.3.1
Stars: ✭ 300 (-78.46%)
Mutual labels:  yolo, darknet, detection
VideoRecognition-realtime-autotrainer-alerts
State of the art object detection in real-time using YOLOV3 algorithm. Augmented with a process that allows easy training of the classifier as a plug & play solution . Provides alert if an item in an alert list is detected.
Stars: ✭ 36 (-97.42%)
Mutual labels:  yolo, darknet, yolo2
Tracking-with-darkflow
Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
Stars: ✭ 522 (-62.53%)
Mutual labels:  yolo, darknet, yolo2
object-tracking
Multiple Object Tracking System in Keras + (Detection Network - YOLO)
Stars: ✭ 89 (-93.61%)
Mutual labels:  detection, yolo, darknet
Tracking With Darkflow
Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
Stars: ✭ 515 (-63.03%)
Mutual labels:  yolo, darknet, yolo2
Openlabeling
Label images and video for Computer Vision applications
Stars: ✭ 706 (-49.32%)
Mutual labels:  yolo, darknet
Android Yolo
Real-time object detection on Android using the YOLO network with TensorFlow
Stars: ✭ 604 (-56.64%)
Mutual labels:  yolo, detection
Holocron
PyTorch implementations of recent Computer Vision tricks
Stars: ✭ 95 (-93.18%)
Mutual labels:  yolo, darknet
Ssds.pytorch
Repository for Single Shot MultiBox Detector and its variants, implemented with pytorch, python3.
Stars: ✭ 570 (-59.08%)
Mutual labels:  yolo, darknet
Yolo tensorflow
Tensorflow implementation of YOLO, including training and test phase.
Stars: ✭ 772 (-44.58%)
Mutual labels:  yolo, detection
Mobilenet Yolo
A caffe implementation of MobileNet-YOLO detection network
Stars: ✭ 825 (-40.78%)
Mutual labels:  yolo, darknet
Yolov5 ncnn
🍅 Deploy NCNN on mobile phones. Support Android and iOS. 移动端NCNN部署,支持Android与iOS。
Stars: ✭ 535 (-61.59%)
Mutual labels:  yolo, detection
Yolo annotation tool
Annotation tool for YOLO in opencv
Stars: ✭ 17 (-98.78%)
Mutual labels:  yolo, darknet

YOLOv2 in PyTorch

NOTE: This project is no longer maintained and may not compatible with the newest pytorch (after 0.4.0).

This is a PyTorch implementation of YOLOv2. This project is mainly based on darkflow and darknet.

I used a Cython extension for postprocessing and multiprocessing.Pool for image preprocessing. Testing an image in VOC2007 costs about 13~20ms.

For details about YOLO and YOLOv2 please refer to their project page and the paper: YOLO9000: Better, Faster, Stronger by Joseph Redmon and Ali Farhadi.

NOTE 1: This is still an experimental project. VOC07 test mAP is about 0.71 (trained on VOC07+12 trainval, reported by @cory8249). See issue1 and issue23 for more details about training.

NOTE 2: I recommend to write your own dataloader using torch.utils.data.Dataset since multiprocessing.Pool.imap won't stop even there is no enough memory space. An example of dataloader for VOCDataset: issue71.

NOTE 3: Upgrade to PyTorch 0.4: https://github.com/longcw/yolo2-pytorch/issues/59

Installation and demo

  1. Clone this repository

    git clone [email protected]:longcw/yolo2-pytorch.git
    
  2. Build the reorg layer (tf.extract_image_patches)

    cd yolo2-pytorch
    ./make.sh
    
  3. Download the trained model yolo-voc.weights.h5 and set the model path in demo.py

  4. Run demo python demo.py.

Training YOLOv2

You can train YOLO2 on any dataset. Here we train it on VOC2007/2012.

  1. Download the training, validation, test data and VOCdevkit

    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
    
  2. Extract all of these tars into one directory named VOCdevkit

    tar xvf VOCtrainval_06-Nov-2007.tar
    tar xvf VOCtest_06-Nov-2007.tar
    tar xvf VOCdevkit_08-Jun-2007.tar
    
  3. It should have this basic structure

    $VOCdevkit/                           # development kit
    $VOCdevkit/VOCcode/                   # VOC utility code
    $VOCdevkit/VOC2007                    # image sets, annotations, etc.
    # ... and several other directories ...
    
  4. Since the program loading the data in yolo2-pytorch/data by default, you can set the data path as following.

    cd yolo2-pytorch
    mkdir data
    cd data
    ln -s $VOCdevkit VOCdevkit2007
    
  5. Download the pretrained darknet19 model and set the path in yolo2-pytorch/cfgs/exps/darknet19_exp1.py.

  6. (optional) Training with TensorBoard.

    To use the TensorBoard, set use_tensorboard = True in yolo2-pytorch/cfgs/config.py and install TensorboardX (https://github.com/lanpa/tensorboard-pytorch). Tensorboard log will be saved in training/runs.

  7. Run the training program: python train.py.

Evaluation

Set the path of the trained_model in yolo2-pytorch/cfgs/config.py.

cd faster_rcnn_pytorch
mkdir output
python test.py

Training on your own data

The forward pass requires that you supply 4 arguments to the network:

  • im_data - image data.
    • This should be in the format C x H x W, where C corresponds to the color channels of the image and H and W are the height and width respectively.
    • Color channels should be in RGB format.
    • Use the imcv2_recolor function provided in utils/im_transform.py to preprocess your image. Also, make sure that images have been resized to 416 x 416 pixels
  • gt_boxes - A list of numpy arrays, where each one is of size N x 4, where N is the number of features in the image. The four values in each row should correspond to x_bottom_left, y_bottom_left, x_top_right, and y_top_right.
  • gt_classes - A list of numpy arrays, where each array contains an integer value corresponding to the class of each bounding box provided in gt_boxes
  • dontcare - a list of lists

License: MIT license (MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].