Coder Social home page Coder Social logo

abrenjy / maskyolo_caffe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leon-liangwu/maskyolo_caffe

0.0 1.0 0.0 22.31 MB

YOLO V2 & V3 , YOLO Combined with RCNN and MaskRCNN

CMake 0.90% Makefile 0.24% Dockerfile 0.03% C++ 91.27% Cuda 2.78% Python 3.99% MATLAB 0.33% Shell 0.30% HTML 0.07% CSS 0.09%

maskyolo_caffe's Introduction

YOLO Caffe version with MaskRCNN

Statement: This repo was done before YOLACT: Real-time Instance Segmentation, ICCV 2019. And this project was actually completed at the begining of 2018.

Caffe-MaskYolo

What I add in this version of caffe?

  • Demos for object detection, mask segmentation and keypoints recognition
  • YOLO v2 (RegionLossLayer) and v3 (YoloLossLayer) are supported
  • Instance Mask segmentation with Yolo
  • Keypoints Recognition with yolo
  • training data preparation and training

preparation

# clone
git clone https://github.com/leon-liangwu/MaskYolo_Caffe.git --recursive

# install requirements
cd ROOT_MaskYolo
pip install -r requirements.txt

# compile box_utils
cd lib/box_utils
python setup.py build_ext --inplace

# compile caffe
cd caffe-maskyolo
cp Makefile.config.example Makefile.config
make -j
make pycaffe

download pretrained models

Click DropBox or WeiYun to download pretrained models

cd ROOT_MaskYolo
tar zxvf /your/downlaod/model/path/pretrained_models.tgz ./models_maskyolo/

Object Detection with YOLO

support to use yolo v2 or v3 to detect objects in images

objection demo

cd tools
python yolo_inference.py [--img_path=xxx.jpg] [--model=xxx.prototxt] [--weights=xxx.caffemodel]
# Net forward time consumed: 3.96ms

The demo result is shown below.

train for object detection

cd ROOT_MaskYolo

# prepare voc labels, set the categories you want to detect in scripts/voc_label.py
python scripts/voc_label.py --voc_dir=/path/to/voc_dir/

# generate lmdb for detection
sh ./scripts/convert_detection.sh  /path/to/train.txt /path/to/lmdb   

# train the detection model
cd ./models/mb_v2_t4_cls5_yolo/
sh train_yolo.sh

Yolo with Instance Masks

detection and instance mask demo

cd tools
python mask_inference.py [--img_path=xxx.jpg] [--model=xxx.prototxt] [--weights=xxx.caffemodel] 
# Net forward time consumed: 8.67ms

train for mask regression

# compile the pythonapi of cocoapi
cd ROOT_MaskYolo/lib/cocoapi/PythonAPI
make -j

# use the following command to generate lmdb which contains mask and keypoints information
cd ROOT_MaskYolo
python scripts/createdata_mask.py --coco_dir=/path/to/coco --lmdb_dir=/path/to/lmdb

# the training for mask consists of 2 steps 
cd ./models_maskyolo/mb_body_mask

# 1. freeze the weights of detection network, only update the roi mask part
sh train_maskyolo_step1.sh

# 2. update all the network with finetuning the model of step1
sh train_maskyolo_step2.sh

Try your trained model with

python mask_inference.py --weights=xxx.caffemodel

Yolo with Instance Keypoints

detection and keypoints demo

cd tools

python kps_inference.py [--img_path=xxx.jpg] [--model=xxx.prototxt] [--weights=xxx.caffemodel] 
# Net forward time consumed: 5.58ms

Reference

You Only Look Once: Unified, Real-Time Object detection http://arxiv.org/abs/1506.02640

YOLO9000: Better, Faster, Stronger https://arxiv.org/abs/1612.08242

YOLOv3: An Incremental Improvement https://pjreddie.com/media/files/papers/YOLOv3.pdf

Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks

Mask R-CNN

maskyolo_caffe's People

Contributors

leon-liangwu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.