Skip to content

Commit 78bbec6

Browse files
committed
First commit
0 parents  commit 78bbec6

File tree

119 files changed

+10831
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10831
-0
lines changed

.gitignore

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
data/*
2+
3+
# READ THIS BEFORE YOU REFACTOR ME
4+
#
5+
# setup.py uses the list of patterns in this file to decide
6+
# what to delete, but it's not 100% sound. So, for example,
7+
# if you delete aten/build/ because it's redundant with build/,
8+
# aten/build/ will stop being cleaned. So be careful when
9+
# refactoring this file!
10+
11+
## PyTorch
12+
test_rcnn.sh
13+
train_rcnn.sh
14+
.mypy_cache
15+
*.pyc
16+
*/*.pyc
17+
*/*.so*
18+
*/**/__pycache__
19+
*/**/*.dylib*
20+
*/**/*.pyc
21+
*/**/*.pyd
22+
*/**/*.so*
23+
*/**/**/*.pyc
24+
*/**/**/**/*.pyc
25+
*/**/**/**/**/*.pyc
26+
aten/build/
27+
aten/src/ATen/Config.h
28+
aten/src/ATen/cuda/CUDAConfig.h
29+
build/
30+
dist/
31+
docs/src/**/*
32+
test/.coverage
33+
test/cpp/api/mnist
34+
test/data/gpu_tensors.pt
35+
test/data/legacy_modules.t7
36+
test/data/legacy_serialized.pt
37+
test/data/linear.pt
38+
test/htmlcov
39+
third_party/build/
40+
tools/shared/_utils_internal.py
41+
torch.egg-info/
42+
torch/csrc/autograd/generated/*
43+
torch/csrc/cudnn/cuDNN.cpp
44+
torch/csrc/generated
45+
torch/csrc/generic/TensorMethods.cpp
46+
torch/csrc/jit/generated/*
47+
torch/csrc/nn/THCUNN.cpp
48+
torch/csrc/nn/THCUNN.cwrap
49+
torch/csrc/nn/THNN_generic.cpp
50+
torch/csrc/nn/THNN_generic.cwrap
51+
torch/csrc/nn/THNN_generic.h
52+
torch/csrc/nn/THNN.cpp
53+
torch/csrc/nn/THNN.cwrap
54+
torch/lib/*.a*
55+
torch/lib/*.dll*
56+
torch/lib/*.dylib*
57+
torch/lib/*.h
58+
torch/lib/*.lib
59+
torch/lib/*.so*
60+
torch/lib/build
61+
torch/lib/cmake
62+
torch/lib/include
63+
torch/lib/pkgconfig
64+
torch/lib/protoc
65+
torch/lib/tmp_install
66+
torch/lib/torch_shm_manager
67+
torch/version.py
68+
69+
# IPython notebook checkpoints
70+
.ipynb_checkpoints
71+
72+
# Editor temporaries
73+
*.swn
74+
*.swo
75+
*.swp
76+
*.swm
77+
*~
78+
79+
# macOS dir files
80+
.DS_Store
81+
82+
# Symbolic files
83+
tools/shared/cwrap_common.py
84+
85+
# Ninja files
86+
.ninja_deps
87+
.ninja_log
88+
compile_commands.json
89+
*.egg-info/
90+
docs/source/scripts/activation_images/
91+
92+
## General
93+
94+
# Compiled Object files
95+
*.slo
96+
*.lo
97+
*.o
98+
*.cuo
99+
*.obj
100+
101+
# Compiled Dynamic libraries
102+
*.so
103+
*.dylib
104+
*.dll
105+
106+
# Compiled Static libraries
107+
*.lai
108+
*.la
109+
*.a
110+
*.lib
111+
112+
# Compiled protocol buffers
113+
*.pb.h
114+
*.pb.cc
115+
*_pb2.py
116+
117+
# Compiled python
118+
*.pyc
119+
*.pyd
120+
121+
# Compiled MATLAB
122+
*.mex*
123+
124+
# IPython notebook checkpoints
125+
.ipynb_checkpoints
126+
127+
# Editor temporaries
128+
*.swn
129+
*.swo
130+
*.swp
131+
*~
132+
133+
# Sublime Text settings
134+
*.sublime-workspace
135+
*.sublime-project
136+
137+
# Eclipse Project settings
138+
*.*project
139+
.settings
140+
141+
# QtCreator files
142+
*.user
143+
144+
# PyCharm files
145+
.idea
146+
147+
# Visual Studio Code files
148+
.vscode
149+
.vs
150+
151+
# OSX dir files
152+
.DS_Store
153+
154+
## Caffe2
155+
156+
# build, distribute, and bins (+ python proto bindings)
157+
build
158+
build_host_protoc
159+
build_android
160+
build_ios
161+
/build_*
162+
.build_debug/*
163+
.build_release/*
164+
distribute/*
165+
*.testbin
166+
*.bin
167+
cmake_build
168+
.cmake_build
169+
gen
170+
.setuptools-cmake-build
171+
.pytest_cache
172+
aten/build/*
173+
174+
# Bram
175+
plsdontbreak
176+
177+
# Generated documentation
178+
docs/_site
179+
docs/gathered
180+
_site
181+
doxygen
182+
docs/dev
183+
184+
# LevelDB files
185+
*.sst
186+
*.ldb
187+
LOCK
188+
LOG*
189+
CURRENT
190+
MANIFEST-*
191+
192+
# generated version file
193+
caffe2/version.py
194+
195+
# setup.py intermediates
196+
.eggs
197+
caffe2.egg-info
198+
199+
# Atom/Watchman required file
200+
.watchmanconfig
201+
202+
# cython generated files
203+
lib/model/utils/bbox.c
204+
lib/pycocotools/_mask.c

README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Graphical Object Detector in document images
2+
3+
This repository contains end-to-end trainable deep learning based framework to localize graphical objects in the document images called as Graphical Object Detection (GOD).
4+
5+
This repository is built on [jwyang/faster-rcnn.pytorch](https://github.com/jwyang/faster-rcnn.pytorch). This implementation has the following features:
6+
- **It is pure Pytorch code**. Of course, there are some CUDA code.
7+
8+
- **It supports multi-image batch training**.
9+
10+
- **It supports multiple GPUs training**.
11+
12+
The results of GOD on different datasets is listed in the paper.
13+
14+
15+
### Getting Started
16+
Clone the repo:
17+
```
18+
git clone https://github.com/rnjtsh/graphical-object-detector/GOD.git
19+
```
20+
Then, create a folder:
21+
```
22+
cd GOD && mkdir data
23+
```
24+
25+
#### prerequisites
26+
- Python 2.7 or 3.6
27+
- Pytorch 0.4.0
28+
- CUDA 8.0 or higher
29+
30+
31+
#### Compilation
32+
The compilation is done as instructed by [jwyang/faster-rcnn.pytorch](https://github.com/jwyang/faster-rcnn.pytorch/blob/master/README.md#compilation).
33+
34+
35+
#### Dataset
36+
This repository uses the dataset in the same format as PASCAL VOC. But other format of datasets can also be adapted as done by [jwyang/faster-rcnn.pytorch](https://github.com/jwyang/faster-rcnn.pytorch). The dataset should be prepared as per the following tree structure.
37+
```
38+
GODdevkit2019
39+
├── GOD2019
40+
├── JPEGImages
41+
│ ├── GOD001.jpg
42+
│ ├── GOD002.jpg
43+
│ ├── ...
44+
├── ImageSets
45+
│ ├── Main
46+
│ │ ├── train.txt
47+
│ │ ├── val.txt
48+
│ │ ├── test.txt
49+
│ │ ├── ...
50+
└── Annotations
51+
├── GOD001.xml
52+
├── GOD002.xml
53+
├── ...
54+
```
55+
56+
#### Pretrained Models
57+
We used ImageNet pretrained weights (VGG16 and ResNets) from Caffe in our experiments. You can download these two models from:
58+
- [VGG16](https://drive.google.com/open?id=19UphT53C0Ua9JAtICnw84PPTa3sZZ_9k)
59+
- [ResNet50](https://drive.google.com/open?id=1wHSvusQ1CiEMc5Nx5R8adqoHQjIDWXl1), [ResNet101](https://drive.google.com/open?id=1x2fTMqLrn63EMW0VuK4GEa2eQKzvJ_7l), [ResNet152](https://drive.google.com/open?id=1NSCycOb7pU0KzluH326zmyMFUU55JslF)
60+
61+
62+
Download them and put them into the ```data/pretrained_model/```.
63+
64+
**If you want to use pytorch pre-trained models, please remember to transpose images from BGR to RGB, and also use the same data transformer (minus mean and normalize) as used in pretrained model.**

_init_paths.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os.path as osp
2+
import sys
3+
4+
def add_path(path):
5+
if path not in sys.path:
6+
sys.path.insert(0, path)
7+
8+
this_dir = osp.dirname(__file__)
9+
10+
# Add lib to PYTHONPATH
11+
lib_path = osp.join(this_dir, 'lib')
12+
add_path(lib_path)
13+
14+
coco_path = osp.join(this_dir, 'data', 'coco', 'PythonAPI')
15+
add_path(coco_path)

cfgs/res101.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
EXP_DIR: res101
2+
TRAIN:
3+
HAS_RPN: True
4+
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
5+
RPN_POSITIVE_OVERLAP: 0.7
6+
RPN_BATCHSIZE: 256
7+
PROPOSAL_METHOD: gt
8+
BG_THRESH_LO: 0.0
9+
DISPLAY: 20
10+
BATCH_SIZE: 128
11+
WEIGHT_DECAY: 0.0001
12+
DOUBLE_BIAS: False
13+
LEARNING_RATE: 0.001
14+
TEST:
15+
HAS_RPN: True
16+
POOLING_SIZE: 7
17+
POOLING_MODE: align
18+
CROP_RESIZE_WITH_MAX_POOL: False

cfgs/res101_ls.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
EXP_DIR: res101
2+
TRAIN:
3+
HAS_RPN: True
4+
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
5+
RPN_POSITIVE_OVERLAP: 0.7
6+
RPN_BATCHSIZE: 256
7+
PROPOSAL_METHOD: gt
8+
BG_THRESH_LO: 0.0
9+
DISPLAY: 20
10+
BATCH_SIZE: 128
11+
WEIGHT_DECAY: 0.0001
12+
SCALES: [800]
13+
DOUBLE_BIAS: False
14+
LEARNING_RATE: 0.001
15+
TEST:
16+
HAS_RPN: True
17+
SCALES: [800]
18+
MAX_SIZE: 1200
19+
RPN_POST_NMS_TOP_N: 1000
20+
POOLING_SIZE: 7
21+
POOLING_MODE: align
22+
CROP_RESIZE_WITH_MAX_POOL: False

cfgs/res152_ls.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EXP_DIR: res152
2+
TRAIN:
3+
HAS_RPN: True
4+
# IMS_PER_BATCH: 1
5+
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
6+
RPN_POSITIVE_OVERLAP: 0.7
7+
RPN_BATCHSIZE: 256
8+
PROPOSAL_METHOD: gt
9+
BG_THRESH_LO: 0.0
10+
DISPLAY: 20
11+
BATCH_SIZE: 128
12+
WEIGHT_DECAY: 0.0001
13+
DOUBLE_BIAS: False
14+
SNAPSHOT_PREFIX: res152_faster_rcnn
15+
LEARNING_RATE: 0.001
16+
SCALES: [800]
17+
TEST:
18+
HAS_RPN: True
19+
SCALES: [800]
20+
MAX_SIZE: 1200
21+
RPN_POST_NMS_TOP_N: 1000
22+
POOLING_SIZE: 7
23+
POOLING_MODE: align
24+
CROP_RESIZE_WITH_MAX_POOL: False

cfgs/res50.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
EXP_DIR: res50
2+
TRAIN:
3+
HAS_RPN: True
4+
# IMS_PER_BATCH: 1
5+
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
6+
RPN_POSITIVE_OVERLAP: 0.7
7+
RPN_BATCHSIZE: 256
8+
PROPOSAL_METHOD: gt
9+
BG_THRESH_LO: 0.0
10+
DISPLAY: 20
11+
BATCH_SIZE: 256
12+
WEIGHT_DECAY: 0.0001
13+
DOUBLE_BIAS: False
14+
SNAPSHOT_PREFIX: res50_faster_rcnn
15+
TEST:
16+
HAS_RPN: True
17+
POOLING_MODE: crop

cfgs/res50_ls.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
EXP_DIR: res50
2+
TRAIN:
3+
HAS_RPN: True
4+
# IMS_PER_BATCH: 1
5+
BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True
6+
RPN_POSITIVE_OVERLAP: 0.7
7+
RPN_BATCHSIZE: 256
8+
PROPOSAL_METHOD: gt
9+
BG_THRESH_LO: 0.0
10+
DISPLAY: 20
11+
BATCH_SIZE: 256
12+
SCALES: [800]
13+
WEIGHT_DECAY: 0.0001
14+
DOUBLE_BIAS: False
15+
SNAPSHOT_PREFIX: res50_faster_rcnn
16+
TEST:
17+
HAS_RPN: True
18+
SCALES: [800]
19+
MAX_SIZE: 1200
20+
RPN_POST_NMS_TOP_N: 1000
21+
POOLING_MODE: crop

0 commit comments

Comments
 (0)