Skip to content

Commit 4106a7c

Browse files
committed
Readme
1 parent 9254cd9 commit 4106a7c

File tree

4 files changed

+95
-8
lines changed

4 files changed

+95
-8
lines changed

CNTK/FasterRCNN/bin/download_runfile.bat

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
::Train file
22
powershell "(New-Object System.Net.WebClient).DownloadFile('https://www.dropbox.com/s/p726xk5pjvzxvly/FasterRCNN_Train_SE.exe?dl=1','FasterRCNN_Train_SE.exe')"
33

4-
5-
::Detect file. See also https://github.com/springkim/FasterRCNN_SpringEdition
6-
powershell "(New-Object System.Net.WebClient).DownloadFile('https://www.dropbox.com/s/oon50vg9rfiv1lw/FasterRCNN_Detect_SE.exe?dl=1','FasterRCNN_Detect_SE.exe')"
7-
84
::Download requirement dlls
95
powershell "(New-Object System.Net.WebClient).DownloadFile('https://www.dropbox.com/s/tj0c19eoz17yzgo/FasterRCNN_SE_dll.zip?dl=1','FasterRCNN_SE_dll.zip')"
106

FasterRCNN_SE_Detection_Example/FasterRCNN_SE.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class FasterRCNN {
4343
m_shmem = ::CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr,PAGE_READWRITE, 0, m_size, m_key_shmem.c_str());
4444
m_buffer = (char*)::MapViewOfFile(m_shmem, FILE_MAP_ALL_ACCESS, 0, 0, m_size);
4545
m_buffer[0] = 0;
46-
std::string exec = "python \"C:/Users/spring/Documents/SourceTree/FasterRCNN_SpringEdition/CNTK/FasterRCNN/src/FasterRCNN_Detect_SE.py\"";
47-
//std::string exec = "FasterRCNN_Detect_SE.exe";
46+
//std::string exec = "python \"C:/Users/spring/Documents/SourceTree/FasterRCNN_SpringEdition/CNTK/FasterRCNN/src/FasterRCNN_Detect_SE.py\"";
47+
std::string exec = "FasterRCNN_Detect_SE.exe";
4848
std::ostringstream oss;
4949
oss << exec << " " << m_key_shmem << " " << m_key_mutex << " " << m_size << " " << "\"" << model_path << "\"";
5050
UINT ret=WinExec(oss.str().c_str(), SW_SHOW);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
::Detect file. See also https://github.com/springkim/FasterRCNN_SpringEdition
22
powershell "(New-Object System.Net.WebClient).DownloadFile('https://www.dropbox.com/s/oon50vg9rfiv1lw/FasterRCNN_Detect_SE.exe?dl=1','FasterRCNN_Detect_SE.exe')"
33

4+
::Download requirement dlls
5+
powershell "(New-Object System.Net.WebClient).DownloadFile('https://www.dropbox.com/s/tj0c19eoz17yzgo/FasterRCNN_SE_dll.zip?dl=1','FasterRCNN_SE_dll.zip')"
6+
7+
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('FasterRCNN_SE_dll.zip', '.'); }"
8+
9+
IF EXIST "FasterRCNN_SE_dll.zip" (
10+
DEL "FasterRCNN_SE_dll.zip"
11+
)

README.md

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,88 @@
1-
# FasterRCNN_SpringEdition
2-
Easy FasterRCNN C++ library.
1+
# FasterRCNN_SpringEdition <img src="https://i.imgur.com/oYejfWp.png" title="Windows8" width="48">
2+
3+
###### FasterRCNN C++ library. (Train,Detect both)
4+
* All dependencies are included.
5+
* Can Train FasterRCNN as double click.
6+
* Need only 1 header file, To detect by FasterRCNN.
7+
8+
<img src="https://i.imgur.com/ElCyyzT.png" title="Windows8" width="48"><img src="https://i.imgur.com/O5bye0l.png" width="48">
39

410
## Setup for train
11+
#### 1. Download model and files.
12+
There is a **download_model.bat** in [CNTK/FasterRCNN/](https://github.com/springkim/FasterRCNN_SpringEdition/tree/master/CNTK/FasterRCNN).
13+
This file can download **VGG16_ImageNet_Caffe.model** . because our **FasterRCNN** use **VGG16** instead of **Alexnet**.
14+
15+
And move to [CNTK/FasterRCNN/bin](https://github.com/springkim/FasterRCNN_SpringEdition/tree/master/CNTK/FasterRCNN/bin) and run **download_runfile.bat**.
16+
This file download **FasterRCNN_Train_SE.exe** and dependency dlls.
17+
18+
**FasterRCNN_train_SE.exe** needs 1 integer argument. This argument is epoch for train.
19+
The example run script is in [CNTK/FasterRCNN/](https://github.com/springkim/FasterRCNN_SpringEdition/tree/master/CNTK/FasterRCNN)**train.bat**.
20+
21+
#### 2. Train our own data format and location.
22+
23+
Actually, **FasterRCNN_Train_SE.exe** read only two files. first one is `../train_img_file.txt`, Second one is `../train_roi_file.txt`. That's why i made **FasterRCNN_Train_SE.exe** in **bin** folder.
24+
25+
This format follows the [Microsoft/CNTK](https://github.com/Microsoft/CNTK) format.
26+
27+
`train_img_file.txt` follows the format below.
28+
```
29+
0 <image-path> 0
30+
1 <image-path> 0
31+
2 <image-path> 0
32+
```
33+
First column is number of image. Second column is image path. Last column must be zero.
34+
You can see [CNTK/FasterRCNN/train_img_file.txt](https://github.com/springkim/FasterRCNN_SpringEdition/blob/master/CNTK/FasterRCNN/train_img_file.txt) for understand.
35+
`train_roi_file.txt` follows the format below.
36+
```
37+
0 |roiAndLabel <x1 y1 x2 y2 class>
38+
1 |roiAndLabel <x1 y1 x2 y2 class> <x1 y1 x2 y2 class>
39+
```
40+
First column is number of image~~(stupid format)~~, Second column must be `|roiAndLabel` ,Third column is coordinate of object. You can write multiple coordinate of object in same line.
41+
42+
Finally, It looks like below.
43+
```
44+
┌ bin
45+
│ ├ FasterRCNN_Train_SE.exe
46+
│ └ <Requirement dlls>
47+
├ img
48+
│ └ <images that wrote in train_img_file.txt>
49+
├ train_img_file.txt
50+
├ train_roi_file.txt
51+
└ train.bat
52+
```
53+
Now you can run **train.bat** for trainning.
54+
55+
model file will generate at the same location.
56+
57+
## Setup for detect
58+
#### 1. Download pre-trained model and files.
59+
Run both **download_detect_exe.bat** and **download_pretrained_model.bat** in the [FasterRCNN_SE_Detection_Example](https://github.com/springkim/FasterRCNN_SpringEdition/tree/master/FasterRCNN_SE_Detection_Example).
60+
61+
#### 2. Run.
62+
63+
And open **FasterRCNN_SE_Detection_Example.sln** as [Visual Studio 2015](https://www.visualstudio.com/ko/downloads/?rr=https%3A%2F%2Fwww.google.co.kr%2F).~~(Maybe it works on VS2013 and VS2017 too)~~
64+
65+
We needs only 1 header file**(FasterRCNN_SE.h)** for detect. Of course your exe file needs **FasterRCNN_Detect_SE.exe** and requirement dlls(22 files).
66+
67+
Model loading time is about 20~30s.
68+
69+
## Technical issue.
70+
The [CNTK](https://github.com/Microsoft/CNTK) is python wrapper. They support C++ interface. But it works only in CPU to detection.
71+
72+
[CPU version detection](https://github.com/springkim/FasterRCNN_SpringEdition/blob/master/dev/CNTK-
73+
eval-CPU-only.cpp)
74+
75+
I have to run this code on C++ without Python dependencies.
76+
77+
So, I used IPC with python executable file. I used [pyinstaller](http://www.pyinstaller.org/) for make exe file.
78+
79+
Finally, It does not support GPU SLI.
80+
81+
I tested it on (Windows10,GTX1080) and (windows10,TITAN X).
82+
83+
84+
85+
86+
87+
588

0 commit comments

Comments
 (0)