Skip to content

Commit

Permalink
Add pytorch darknet to caffe code and demo script
Browse files Browse the repository at this point in the history
  • Loading branch information
eric612 committed Sep 21, 2018
1 parent 996f1bb commit cd26ae3
Show file tree
Hide file tree
Showing 9 changed files with 5,368 additions and 52 deletions.
50 changes: 0 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,56 +80,6 @@ If load success , you can see the image window like this

![alt tag](00002.jpg)

### Vehicle Dection

[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/oagXgyQHuNA/0.jpg)](https://www.youtube.com/watch?v=oagXgyQHuNA)

#### CLASS NAME

```
char* CLASSES2[6] = { "__background__","bicycle", "car", "motorbike", "person","cones" };
```

[model](models/vehicle)

## Maintenance

I'll appreciate if you can help me to

1. Miragrate to [modivius neural compute stick](https://github.com/eric612/YoloV2-MobileNet-NCS)
2. Mobilenet upgrade to v2 or model tunning

## Caffe

[![Build Status](https://travis-ci.org/BVLC/caffe.svg?branch=master)](https://travis-ci.org/BVLC/caffe)
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)

Caffe is a deep learning framework made with expression, speed, and modularity in mind.
It is developed by Berkeley AI Research ([BAIR](http://bair.berkeley.edu))/The Berkeley Vision and Learning Center (BVLC) and community contributors.

Check out the [project site](http://caffe.berkeleyvision.org) for all the details like

- [DIY Deep Learning for Vision with Caffe](https://docs.google.com/presentation/d/1UeKXVgRvvxg9OUdh_UiC5G71UMscNPlvArsWER41PsU/edit#slide=id.p)
- [Tutorial Documentation](http://caffe.berkeleyvision.org/tutorial/)
- [BAIR reference models](http://caffe.berkeleyvision.org/model_zoo.html) and the [community model zoo](https://github.com/BVLC/caffe/wiki/Model-Zoo)
- [Installation instructions](http://caffe.berkeleyvision.org/installation.html)

and step-by-step examples.

## Custom distributions

- [Intel Caffe](https://github.com/BVLC/caffe/tree/intel) (Optimized for CPU and support for multi-node), in particular Xeon processors (HSW, BDW, SKX, Xeon Phi).
- [OpenCL Caffe](https://github.com/BVLC/caffe/tree/opencl) e.g. for AMD or Intel devices.
- [Windows Caffe](https://github.com/BVLC/caffe/tree/windows)

## Community

[![Join the chat at https://gitter.im/BVLC/caffe](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/BVLC/caffe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Please join the [caffe-users group](https://groups.google.com/forum/#!forum/caffe-users) or [gitter chat](https://gitter.im/BVLC/caffe) to ask questions and talk about methods and models.
Framework development discussions and thorough bug reports are collected on [Issues](https://github.com/BVLC/caffe/issues).

Happy brewing!

## License and Citation

Expand Down
1 change: 1 addition & 0 deletions demo_darknet_yolov3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./examples/ssd/ssd_detect models/darknet_yolov3/yolov3.prototxt models/darknet_yolov3/yolov3.caffemodel -file_type image -wait_time 1500 -mean_value 0.0,0.0,0.0 -normalize_value 0.0039215 -confidence_threshold 0.2
26 changes: 24 additions & 2 deletions examples/ssd/ssd_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,30 @@
//char* CLASSES[6] = { "__background__",
//"bicyle", "car", "motorbike", "person","cones"
//};
char* CLASSES[5] = { "__background__",
"big car","car", "motorbike","person"
//char* CLASSES[5] = { "__background__",
//"big car","car", "motorbike","person"
//};
char* CLASSES[81] = { "__background__",
"person", "bicycle", "car", "motorcycle",
"airplane", "bus", "train", "truck", "boat",
"traffic light", "fire hydrant", "stop sign", "parking meter",
"bench", "bird", "cat",
"dog", "horse", "sheep", "cow"
"elephant", "bear", "zebra", "giraffe" ,
"backpack", "umbrella", "handbag", "tie" ,
"suitcase", "frisbee", "skis", "snowboard" ,
"sports ball", "kite", "baseball bat", "baseball glove" ,
"skateboard", "surfboard", "tennis racket", "bottle" ,
"wine glass", "cup", "fork", "knife" ,
"spoon", "bowl", "banana", "apple" ,
"sandwich", "orange", "broccoli", "carrot" ,
"hot dog", "pizza", "donut", "cake" ,
"chair", "sofa", "potted plant", "bed" ,
"dining table", "toilet", "tv", "laptop" ,
"mouse", "remote", "keyboard", "cell phone" ,
"microwave", "oven", "toaster", "sink" ,
"refrigerator", "book", "clock", "vase" ,
"scissors", "teddy bear", "hair drier", "toothbrush" ,
};
#else
char* CLASSES[21] = { "__background__",
Expand Down
29 changes: 29 additions & 0 deletions models/darknet_yolov3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Pytorch darknet to caffe

Modify from [pytorch-caffe-darknet-convert](https://github.com/marvis/pytorch-caffe-darknet-convert),[object_detetction_tools](https://github.com/BingzheWu/object_detetction_tools)

## Modified items :

1. yolov3 output layer
2. when pooling layer stide =1 , size =2 , assign size = 1
3. upsample layer

## Usage :

1. Download weights from original darknet web
2. Unmark custom_class in examples\ssd\ssd_detect.cpp
3. Remake project

```
> python darknet2caffe.py yolov3.cfg yolov3.weights yolov3.prototxt yolov3.caffemodel
> cd $caffe_root
> sh demo_darknet_yolov3.sh
```


## To do list :

1. verify accuracy and compare result
2. retrain

I'm not sure the result was same as darknet now , contribution is welcome
Loading

0 comments on commit cd26ae3

Please sign in to comment.