Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssd #6876

Open
wants to merge 302 commits into
base: master
Choose a base branch
from
Open

Ssd #6876

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
302 commits
Select commit Hold shift + click to select a range
900dee1
add NormalizeLayer from fcn branch
weiliu89 Feb 3, 2016
2946892
fix bugs introduced to test_detection_output_layer since 96c5cad
weiliu89 Feb 3, 2016
c4ee418
add tool get_image_size
weiliu89 Feb 4, 2016
b5419e3
add SaveOutputParameter in DetectionOutputLayer
weiliu89 Feb 4, 2016
0809908
add norm layer in model_libs
weiliu89 Feb 4, 2016
009a43e
add ResNet-152
weiliu89 Feb 5, 2016
a24f832
add num_classes in DetectionEvaluateLayer
weiliu89 Feb 5, 2016
da5867d
fix bug in TestDetection
weiliu89 Feb 5, 2016
542f1fb
decompose OutputBBox to ClipBBox and ScaleBBox
weiliu89 Feb 5, 2016
eee44d4
always clip bboxes before output
weiliu89 Feb 5, 2016
89380f1
set lr_mult to 0 instead of using fix_scale in NormalizeLayer to not …
weiliu89 Feb 5, 2016
e3a9f05
fix lint errors
weiliu89 Feb 5, 2016
2426d4e
add difficult property for bbox annotation
weiliu89 Feb 6, 2016
5f0643d
add MaxIntegral ap_version to match VOC2012/ILSVRC AP
weiliu89 Feb 6, 2016
70cd366
add SmoothL1LossLayer from Ross Girshick's Fast R-CNN
weiliu89 Feb 7, 2016
f98e96e
fix a bug when background_label_id = -1
weiliu89 Feb 8, 2016
32ae638
add name_size_file in DetectionEvaluationLayer
weiliu89 Feb 8, 2016
3afdc26
add do_neg_mining in MultiBoxLossLayer
weiliu89 Feb 9, 2016
6a53f1f
conditionally use batchnorm in CreateMultiBoxHead
weiliu89 Feb 9, 2016
8abbbd3
output all overlaps during matching step
weiliu89 Feb 9, 2016
25c247c
add dilation for reduced VGGNet
weiliu89 Feb 9, 2016
3342f99
change type of size from int to float
weiliu89 Feb 9, 2016
40d11b1
use default setting for use_global_stats in bn layer
weiliu89 Feb 9, 2016
c576c2c
reset output directory after a full iteration through test set
weiliu89 Feb 9, 2016
4bb7e52
make python scripts better
weiliu89 Feb 9, 2016
f29761c
enable options to resume from most recent snapshot and remove old sna…
weiliu89 Feb 9, 2016
48ad4cc
do negative mining based on scores instead of overlap
weiliu89 Feb 11, 2016
94d8696
change ssd_pascal.py to use new negative mining strategy
weiliu89 Feb 11, 2016
edf364f
Merge branch 'master' into ssd
weiliu89 Feb 11, 2016
16adf76
remove very small bboxes during NMS step
weiliu89 Feb 14, 2016
c2a8dc8
add neg_overlap for selecting hard negatives
weiliu89 Feb 14, 2016
3b7f1a7
add variance and make max_size optional
weiliu89 Feb 14, 2016
a336f3e
add code_type
weiliu89 Feb 15, 2016
ab85368
clean scripts and update README.md
weiliu89 Feb 15, 2016
5da4dfb
generate test_name_size.txt file
weiliu89 Feb 15, 2016
ba9e3f7
add support when evaluating on partial test data
weiliu89 Feb 16, 2016
689e1e9
add more descriptions to variables in the python script
weiliu89 Feb 16, 2016
bd6b8c0
copy script to job_dir and add need_fc and allow max_size = [] in mod…
weiliu89 Feb 17, 2016
a729366
add sampler and related functions
Feb 19, 2016
3a5f1c3
fix lint error and test error for data_transformer and annotated_data…
weiliu89 Feb 20, 2016
4e2173c
add keep_top_k in DetectionOutputLayer
weiliu89 Feb 21, 2016
f97648a
ignore background class when selecting max score during negative mining
Feb 22, 2016
014ba71
fix bug when testing GetMaxConfidenceScore
weiliu89 Feb 22, 2016
1b8ba26
ignore compute AP if there is no detection for a class. this could ha…
weiliu89 Feb 22, 2016
246ea86
handle sampling failure properly
weiliu89 Feb 22, 2016
86f9e78
add logistic conf loss type
weiliu89 Feb 24, 2016
06cb2f4
add more normalization to MultiBoxLoss
weiliu89 Feb 25, 2016
1a87a80
change from adagrad to sgd
weiliu89 Feb 25, 2016
984e302
merge master
weiliu89 Feb 29, 2016
db38768
fix evaluating on difficult gt behavior
weiliu89 Mar 1, 2016
146110e
add Blob<bool>
weiliu89 Mar 1, 2016
2a1dd02
add gpu version DetectionOutputLayer
weiliu89 Mar 1, 2016
7d3bec7
merge master and fix conflict
weiliu89 Mar 1, 2016
d2ffca7
make variance repeated in PriorBoxLayer
weiliu89 Mar 4, 2016
31a9640
enable different choice of encoding the prior variance
weiliu89 Mar 4, 2016
519a320
add map_object_to_agnostic to enable learning object proposal
weiliu89 Mar 6, 2016
b04c249
enhance model_libs
weiliu89 Mar 8, 2016
2e42d22
divide num_matches for valid normalization mode
weiliu89 Mar 9, 2016
c14b17c
keep label when crop datum
weiliu89 Mar 9, 2016
28cc72b
not use aspect ratio by default
weiliu89 Mar 9, 2016
e2c39e2
add support to read json file for ms coco
weiliu89 Mar 9, 2016
f323d68
improve sampler logic
weiliu89 Mar 13, 2016
3ed9cb9
further improve sampler logic
weiliu89 Mar 13, 2016
3dd74cd
speed up nms and generate output for COCO
weiliu89 Mar 20, 2016
b5ddd78
update training/testing script
weiliu89 Mar 20, 2016
6666779
update README.md
weiliu89 Mar 21, 2016
7c0447a
update license
weiliu89 Mar 27, 2016
251ed5a
add webcam demo
Mar 29, 2016
1724c0f
fix opencv version issue
weiliu89 Mar 29, 2016
bfc96de
change gpu to 0 in score_ssd_pascal.py
weiliu89 Mar 31, 2016
b989720
add name_id_file in get_image_size
weiliu89 Mar 31, 2016
6308c34
fix small bug in ComputeAP when there is no ground truth for a label
weiliu89 Mar 31, 2016
64ae3a8
add support to output ilsvrc detection format
weiliu89 Mar 31, 2016
49dd242
fix a bug in PriorBoxLayer
weiliu89 Apr 4, 2016
d76371c
add label map for coco
weiliu89 Apr 6, 2016
b04ada2
add inception v3
weiliu89 Apr 6, 2016
cf455be
fix a small redundancy in VideoDataLayer
Apr 7, 2016
f87f9ac
rebase master
weiliu89 Apr 9, 2016
047ae0e
add support for preparing data for MSCOCO
weiliu89 Apr 15, 2016
e2441be
add ipynb example on how to use SSD to detect objects from an image
weiliu89 Apr 23, 2016
261c958
rebase master
weiliu89 May 1, 2016
ca00126
fix const warning
weiliu89 May 9, 2016
02f6446
add visualization in detection_output_layer.cpp
weiliu89 May 9, 2016
bb2f0e1
add models trained on VOC0712/MSCOCO/ILSVRC15
weiliu89 May 10, 2016
29e525e
add ILSVRC15 SSD500 model
weiliu89 May 16, 2016
c3cc3df
add multiple scales for PriorBoxLayer
weiliu89 Jun 3, 2016
30b9f81
Merge branch 'ssd' of http://bvisionserver1.cs.unc.edu/wliu/caffe int…
weiliu89 Jun 3, 2016
084b630
add ignore_cross_boundary_bbox option
weiliu89 Jun 5, 2016
59d48f2
add CORNER_SIZE code_type
weiliu89 Jun 6, 2016
175c785
remove contact, create an issue if you have problems
weiliu89 Jun 6, 2016
f750a87
add support for preparing data for ILSVRC2016
weiliu89 Jun 7, 2016
372f36c
fix cmake error (thanks to @xmfbit)
weiliu89 Jun 8, 2016
e74e9c7
fix cmake error (thanks @xmfbit)
weiliu89 Jun 8, 2016
032b10b
add OHEM method
weiliu89 Jun 14, 2016
621130a
refactor MineHardExample function and add use_prior_for_nms option
weiliu89 Jun 15, 2016
9795b66
fix a small bug in IsEligibleMining
weiliu89 Jun 17, 2016
14a5dd8
add ResNet101Boday and fix several ConvBNLayer param
weiliu89 Jun 20, 2016
768ce93
merge master and speed up nms
weiliu89 Jun 22, 2016
c35c2db
change default value
weiliu89 Jun 24, 2016
dec7fc4
fix InferBlobSize when using FIT_SMALL_SIZE resize mode
weiliu89 Jun 24, 2016
708a6ca
add options to provide img_size and step in PriorBoxLayer
weiliu89 Jun 25, 2016
c505f62
fix a bug in matchExt and add width/height in EncodeCVMatToDatum
weiliu89 Jun 25, 2016
15a536c
fix a bug in UpdateBBoxByResizePolicy
weiliu89 Jun 25, 2016
90b53e4
check size in a batch is same for all images
weiliu89 Jun 25, 2016
de8abb3
fix bbox transformation for FIT_LARGE_SIZE_AND_PAD
weiliu89 Jun 25, 2016
5a2081b
fix bug in PriorBoxLayer
weiliu89 Jun 26, 2016
a08764b
add steps in CreateMultiBoxHead
weiliu89 Jun 26, 2016
a8261b1
keep difficult in ClipBBox
weiliu89 Jun 26, 2016
806c062
unify DetectionOutputLayer cpp and cu
weiliu89 Jun 26, 2016
a911621
add resize parameter in detection output/evaluate layer
weiliu89 Jun 27, 2016
97efe78
add use_global_stats as an option in ResNet
weiliu89 Jun 28, 2016
a53756a
add fix scale for FIT_SMALL_SIZE resize option
weiliu89 Jun 28, 2016
59eda4e
make it easy to update parameters for BN
weiliu89 Jul 1, 2016
e542de3
add img height/width
weiliu89 Jul 1, 2016
a258899
update script, SSD300 reaches 73.7 on VOC07 test
weiliu89 Jul 2, 2016
8865043
add color distortion options
weiliu89 Jul 4, 2016
8905994
fix a few minor issues
weiliu89 Jul 5, 2016
89eace1
merge master and fix conflict
weiliu89 Jul 5, 2016
64306a8
with cudnn v5 and slightly faster nms, SSD300 reaches 72 FPS on Titan X
weiliu89 Jul 5, 2016
7cdb4ff
show FPS in visualization
weiliu89 Jul 5, 2016
2125bbd
display fps in webcam demo
Jul 6, 2016
b05c992
add anno_type in AnnotatedDataParameter
weiliu89 Jul 6, 2016
d535f94
fix lint error
weiliu89 Jul 6, 2016
fe1abed
fix lint error
weiliu89 Jul 6, 2016
ed3fe9f
add cpp demo code to evaluate a model
weiliu89 Jul 7, 2016
13d6c8b
add cpp demo code to evaluate a model
weiliu89 Jul 7, 2016
f1589ab
clear property tree after a test epoch
weiliu89 Jul 7, 2016
fc3f70a
clear property tree after a test epoch
weiliu89 Jul 7, 2016
43e6e5c
fix ComputeAP when ignoring evaluating difficult gt bbox
weiliu89 Jul 8, 2016
fe5b600
remove comment
weiliu89 Jul 8, 2016
75e8379
fix ComputeAP when ignoring evaluating difficult gt bbox
weiliu89 Jul 8, 2016
579d93f
add skip_frame and video file option in VideoDataLayer
weiliu89 Jul 9, 2016
35a25d1
change webcam demo a bit
Jul 9, 2016
63c2ccf
remove redundant lines
Jul 9, 2016
23b8066
fix CPU_ONLY bug
weiliu89 Jul 9, 2016
61a91f1
fix time issue
weiliu89 Jul 9, 2016
0361aa5
fix time issue
weiliu89 Jul 9, 2016
a459441
fix CPU_ONLY bug
weiliu89 Jul 9, 2016
00baef8
add color distortion in training, mAP is 74.3*
weiliu89 Jul 9, 2016
0453050
fix a bug in ReadImageToDatum
weiliu89 Jul 9, 2016
20870fe
fix a few issues in io.cpp
weiliu89 Jul 9, 2016
b71bb3b
add an option to read plain txt annotation in format of [label xmin y…
weiliu89 Jul 10, 2016
af6520b
add an option to read plain txt annotation in format of [label xmin y…
weiliu89 Jul 10, 2016
494b4f5
update ssd ipynb
weiliu89 Jul 10, 2016
d65c428
update ipynb
weiliu89 Jul 12, 2016
b7b3929
fix ResNet152Body
weiliu89 Jul 12, 2016
1427713
add demo for processing video file
weiliu89 Jul 13, 2016
f68cf47
fix small issues
weiliu89 Jul 13, 2016
ca8c158
use default gpu 0 in video demo
weiliu89 Jul 13, 2016
0f29da0
add video demo
weiliu89 Jul 13, 2016
9c4a480
handle no detection results properly
weiliu89 Jul 13, 2016
bcca761
add ILSVRC2016 data script
weiliu89 Jul 14, 2016
728d1dc
add inception v3 convert/test script
weiliu89 Jul 14, 2016
347a979
add script to convert coco model to voc model
weiliu89 Jul 14, 2016
b202b5f
fix FIT_SMALL_SIZE ground truth transformation
weiliu89 Jul 14, 2016
aca69fa
fix make warnings
weiliu89 Jul 14, 2016
6d29d5e
fix TestUpdateBBoxByResizePolicy
weiliu89 Jul 14, 2016
9832c80
add dilation in ResNet
weiliu89 Jul 15, 2016
f25d43f
fix anno_type issues
weiliu89 Jul 15, 2016
8705293
change prior size in scripts
weiliu89 Jul 17, 2016
f66f88b
enable video as input in ssd_detect.cpp
Jul 20, 2016
e0c65bc
missing propagate down
Jul 21, 2016
3de8a1b
add scripts for coco
weiliu89 Jul 23, 2016
af01c20
Merge pull request #62 from nickjmeyer/ssd
weiliu89 Jul 27, 2016
0c16cf6
fix bug when there is no detection
weiliu89 Jul 27, 2016
4db802b
add support to read video in ssd_detect.cpp
weiliu89 Jul 27, 2016
23ce695
speed up MultiBoxLossLayer forward step
Aug 1, 2016
ef9c8d8
add script to train with original ratio images
weiliu89 Aug 1, 2016
26fe193
add script to plot detection results
Aug 4, 2016
07dcaa0
fix a few typo
Aug 5, 2016
cce9191
add python script to test speed and update lr in existing script
Aug 5, 2016
f37b29a
add python script for training SSD500 on VOC0712
weiliu89 Aug 8, 2016
0b3406b
add script to train with ResNet101 on VOC0712, mAP is about 73.0
weiliu89 Aug 10, 2016
d7df4b6
fix typo
handong1587 Aug 13, 2016
88a044f
Merge pull request #109 from handong1587/ssd
weiliu89 Aug 13, 2016
c6cf9f2
fix travis
weiliu89 Aug 13, 2016
ffa396f
remove hungarian library
weiliu89 Aug 13, 2016
03539ad
fix VideoDataLayer error when USE_OPENCV=0
weiliu89 Aug 13, 2016
2a6c8b8
fix ssd_detect error when USE_OPENCV=0
weiliu89 Aug 13, 2016
d9e3609
fix test_multibox_loss_layer error when USE_LMDB=0
weiliu89 Aug 13, 2016
5dec847
typo
voidrank Aug 18, 2016
7812885
Merge pull request #124 from voidrank/patch-1
weiliu89 Aug 18, 2016
071d497
Add utility functions to save/load floats onto HDF5
Aug 19, 2016
0e9ebab
Add "plateau" LR policy for SGD solver
Aug 19, 2016
7d57157
Suppress logs from 'plateau' LR policy
Aug 26, 2016
c4dd423
update LICENSE
weiliu89 Sep 7, 2016
e4cde71
fix a bug when there is no match in a batch
weiliu89 Sep 8, 2016
11842a7
fix travis error
weiliu89 Sep 8, 2016
c6a070a
Merge branch 'master' into ssd
weiliu89 Sep 8, 2016
8cd3970
add Travis build status and update link to authors
weiliu89 Sep 8, 2016
e3fdaa1
fix a bug where there is no match in a batch
weiliu89 Sep 8, 2016
cb40904
Merge branch 'master' into ssd
weiliu89 Sep 8, 2016
44e139d
add plateau learning rate
weiliu89 Sep 9, 2016
24a5d73
change Makefile.config.example
wliu-nuro Sep 12, 2016
cd53c56
add option to expand the image
wliu-nuro Sep 12, 2016
0b985f1
Merge branch 'ssd' of https://bvisionserver1.cs.unc.edu/wliu/caffe in…
weiliu89 Sep 12, 2016
9c26fd7
add option to save display results to video file
weiliu89 Sep 13, 2016
5886d94
update training script to include padding during training
weiliu89 Sep 16, 2016
62732b5
Fix a loop condition in TransformInv func
quadjr Oct 8, 2016
a521cd8
Merge pull request #213 from quadjr/ssd
weiliu89 Oct 11, 2016
2a2bedf
add option to set prior center offset
weiliu89 Oct 12, 2016
38a2029
Merge branch 'master' into ssd
weiliu89 Oct 12, 2016
88bf230
add option to dilate conv4_3
weiliu89 Oct 12, 2016
eb8b028
add option to set the offset of prior centers
weiliu89 Oct 12, 2016
6fdc0d9
a little change on SatisfySampleConstraint
BestSonny Oct 17, 2016
7887b43
Merge pull request #233 from BestSonny/ssd
weiliu89 Oct 19, 2016
897bbd6
fix a bug when there is no detections in an image
weiliu89 Oct 21, 2016
febd5a5
futher speed up detection output gpu version
weiliu89 Oct 23, 2016
3629ba4
slightly increase training iterations
weiliu89 Oct 23, 2016
49a54f4
Merge branch 'master' into ssd
weiliu89 Oct 23, 2016
3b38398
fix lint error
weiliu89 Oct 23, 2016
f487dc1
Merge branch 'master' into ssd
weiliu89 Nov 24, 2016
b788af6
Merge branch 'master' into ssd
weiliu89 Nov 24, 2016
991c49f
update code
weiliu89 Nov 25, 2016
bae3bf5
fix CPU_ONLY build error
weiliu89 Nov 25, 2016
1295ee4
change Makefile.config.example
weiliu89 Nov 25, 2016
896acc2
fix opencv build issue
weiliu89 Nov 26, 2016
5365d0d
fix test build
weiliu89 Nov 26, 2016
2c4e4c2
make scripts consistent
weiliu89 Dec 1, 2016
bd55327
move plot_detections.py to examples/ssd
weiliu89 Dec 1, 2016
8763926
add example script to train ILSVRC model
weiliu89 Dec 1, 2016
feeb5b5
change to warning when boost create_directory
weiliu89 Dec 1, 2016
30f04dd
optimize inference speed
weiliu89 Dec 1, 2016
dbf3836
update README with new models
weiliu89 Dec 1, 2016
951419d
minor update
weiliu89 Dec 1, 2016
b004e4b
include results on multiple datasets and update bibtex
weiliu89 Dec 3, 2016
2abf2c0
a small fix for ssd.ipynb
weiliu89 Dec 5, 2016
8a65ae3
add options to display per class AP
weiliu89 Dec 5, 2016
77c1c51
change CUDA_ARCH to default ones
weiliu89 Dec 8, 2016
85aad23
add ZFNet example
weiliu89 Jan 12, 2017
3d7035d
add size information
weiliu89 Jan 16, 2017
f8ef5a8
Update README.md
raingo Jan 16, 2017
34753f3
Merge pull request #393 from raingo/patch-1
weiliu89 Jan 17, 2017
29abcd7
added compute capabilities for latest GPUs
fedor-chervinskii Jan 18, 2017
524a5f7
cmake modification for higher compute capabilities
fedor-chervinskii Jan 18, 2017
efdc164
Merge pull request #397 from fedor-chervinskii/ssd
weiliu89 Jan 19, 2017
fd0ba25
minor test fix
weiliu89 Feb 9, 2017
06de4fc
use mining_type
taras-sereda Feb 14, 2017
a915461
Merge pull request #444 from taras-sereda/ssd
weiliu89 Feb 14, 2017
81e512e
fixed python3.6 dateutil requirement
dizcza Mar 13, 2017
e2d50cc
update model links
weiliu89 Mar 20, 2017
7e02cfd
Merge pull request #492 from dizcza/ssd
weiliu89 May 3, 2017
6feb7d9
fix bug in bbox sampling
amoussawi Apr 20, 2017
96175b2
Merge pull request #547 from amoussawi/fix-sampling-bug
weiliu89 May 3, 2017
bfac759
Add support for cuDNN v6
thundo May 6, 2017
9d6e815
Merge pull request #573 from thundo/ssd
weiliu89 May 9, 2017
2d9ce45
add relu6 for mobilenet ssd
Jun 28, 2017
7626b20
add some code to adjust convolution from tensorflow
Jun 29, 2017
6032544
add relu6 and tf_pad
chuanqi305 May 1, 2018
1702ede
delete debug info
chuanqi305 May 27, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ LOCK
LOG*
CURRENT
MANIFEST-*

# temporary directories
jobs
temp
examples/*/*lmdb
6 changes: 6 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
COPYRIGHT

All new contributions compared to the original branch:
Copyright (c) 2015, 2016 Wei Liu (UNC Chapel Hill), Dragomir Anguelov (Zoox),
Dumitru Erhan (Google), Christian Szegedy (Google), Scott Reed (UMich Ann Arbor),
Cheng-Yang Fu (UNC Chapel Hill), Alexander C. Berg (UNC Chapel Hill).
All rights reserved.

All contributions by the University of California:
Copyright (c) 2014, 2015, The Regents of the University of California (Regents)
All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ifneq ($(CPU_ONLY), 1)
LIBRARIES := cudart cublas curand
endif

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
LIBRARIES += glog gflags protobuf boost_system boost_filesystem boost_regex m hdf5_hl hdf5

# handle IO dependencies
USE_LEVELDB ?= 1
Expand All @@ -195,7 +195,7 @@ ifeq ($(USE_OPENCV), 1)
LIBRARIES += opencv_core opencv_highgui opencv_imgproc

ifeq ($(OPENCV_VERSION), 3)
LIBRARIES += opencv_imgcodecs
LIBRARIES += opencv_imgcodecs opencv_videoio
endif

endif
Expand Down Expand Up @@ -404,7 +404,7 @@ LIBRARY_DIRS += $(LIB_BUILD_DIR)
CXXFLAGS += -MMD -MP

# Complete build flags.
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir))
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
# mex may invoke an older gcc that is too liberal with -Wuninitalized
Expand Down
22 changes: 12 additions & 10 deletions Makefile.config.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ CUDA_DIR := /usr/local/cuda
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
# For CUDA < 6.0, comment the lines after *_35 for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_50,code=compute_50
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_61,code=sm_61

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# BLAS := atlas
BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
Expand All @@ -65,10 +67,10 @@ PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# ANACONDA_HOME := $(HOME)/anaconda2
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python2.7 \
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
$(ANACONDA_HOME)/include/python2.7 \
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

# Uncomment to use Python 3 (default is Python 2)
# PYTHON_LIBRARIES := boost_python3 python3.5m
Expand Down
152 changes: 129 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,143 @@
# Caffe
# SSD: Single Shot MultiBox Detector

[![Build Status](https://travis-ci.org/BVLC/caffe.svg?branch=master)](https://travis-ci.org/BVLC/caffe)
[![Build Status](https://travis-ci.org/weiliu89/caffe.svg?branch=ssd)](https://travis-ci.org/weiliu89/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 the Berkeley Vision and Learning Center ([BVLC](http://bvlc.eecs.berkeley.edu)) and community contributors.
By [Wei Liu](http://www.cs.unc.edu/~wliu/), [Dragomir Anguelov](https://www.linkedin.com/in/dragomiranguelov), [Dumitru Erhan](http://research.google.com/pubs/DumitruErhan.html), [Christian Szegedy](http://research.google.com/pubs/ChristianSzegedy.html), [Scott Reed](http://www-personal.umich.edu/~reedscot/), [Cheng-Yang Fu](http://www.cs.unc.edu/~cyfu/), [Alexander C. Berg](http://acberg.com).

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

- [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/)
- [BVLC 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)
SSD is an unified framework for object detection with a single network. You can use the code to train/evaluate a network for object detection task. For more details, please refer to our [arXiv paper](http://arxiv.org/abs/1512.02325) and our [slide](http://www.cs.unc.edu/~wliu/papers/ssd_eccv2016_slide.pdf).

and step-by-step examples.
<p align="center">
<img src="http://www.cs.unc.edu/~wliu/papers/ssd.png" alt="SSD Framework" width="600px">
</p>

[![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)
| System | VOC2007 test *mAP* | **FPS** (Titan X) | Number of Boxes | Input resolution
|:-------|:-----:|:-------:|:-------:|:-------:|
| [Faster R-CNN (VGG16)](https://github.com/ShaoqingRen/faster_rcnn) | 73.2 | 7 | ~6000 | ~1000 x 600 |
| [YOLO (customized)](http://pjreddie.com/darknet/yolo/) | 63.4 | 45 | 98 | 448 x 448 |
| SSD300* (VGG16) | 77.2 | 46 | 8732 | 300 x 300 |
| SSD512* (VGG16) | **79.8** | 19 | 24564 | 512 x 512 |

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!
<p align="left">
<img src="http://www.cs.unc.edu/~wliu/papers/ssd_results.png" alt="SSD results on multiple datasets" width="800px">
</p>

## License and Citation
_Note: SSD300* and SSD512* are the latest models. Current code should reproduce these results._

Caffe is released under the [BSD 2-Clause license](https://github.com/BVLC/caffe/blob/master/LICENSE).
The BVLC reference models are released for unrestricted use.
### Citing SSD

Please cite Caffe in your publications if it helps your research:
Please cite SSD in your publications if it helps your research:

@article{jia2014caffe,
Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
Journal = {arXiv preprint arXiv:1408.5093},
Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
Year = {2014}
@inproceedings{liu2016ssd,
title = {{SSD}: Single Shot MultiBox Detector},
author = {Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.},
booktitle = {ECCV},
year = {2016}
}

### Contents
1. [Installation](#installation)
2. [Preparation](#preparation)
3. [Train/Eval](#traineval)
4. [Models](#models)

### Installation
1. Get the code. We will call the directory that you cloned Caffe into `$CAFFE_ROOT`
```Shell
git clone https://github.com/weiliu89/caffe.git
cd caffe
git checkout ssd
```

2. Build the code. Please follow [Caffe instruction](http://caffe.berkeleyvision.org/installation.html) to install all necessary packages and build it.
```Shell
# Modify Makefile.config according to your Caffe installation.
cp Makefile.config.example Makefile.config
make -j8
# Make sure to include $CAFFE_ROOT/python to your PYTHONPATH.
make py
make test -j8
# (Optional)
make runtest -j8
```

### Preparation
1. Download [fully convolutional reduced (atrous) VGGNet](https://gist.github.com/weiliu89/2ed6e13bfd5b57cf81d6). By default, we assume the model is stored in `$CAFFE_ROOT/models/VGGNet/`

2. Download VOC2007 and VOC2012 dataset. By default, we assume the data is stored in `$HOME/data/`
```Shell
# Download the data.
cd $HOME/data
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
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
# Extract the data.
tar -xvf VOCtrainval_11-May-2012.tar
tar -xvf VOCtrainval_06-Nov-2007.tar
tar -xvf VOCtest_06-Nov-2007.tar
```

3. Create the LMDB file.
```Shell
cd $CAFFE_ROOT
# Create the trainval.txt, test.txt, and test_name_size.txt in data/VOC0712/
./data/VOC0712/create_list.sh
# You can modify the parameters in create_data.sh if needed.
# It will create lmdb files for trainval and test with encoded original image:
# - $HOME/data/VOCdevkit/VOC0712/lmdb/VOC0712_trainval_lmdb
# - $HOME/data/VOCdevkit/VOC0712/lmdb/VOC0712_test_lmdb
# and make soft links at examples/VOC0712/
./data/VOC0712/create_data.sh
```

### Train/Eval
1. Train your model and evaluate the model on the fly.
```Shell
# It will create model definition files and save snapshot models in:
# - $CAFFE_ROOT/models/VGGNet/VOC0712/SSD_300x300/
# and job file, log file, and the python script in:
# - $CAFFE_ROOT/jobs/VGGNet/VOC0712/SSD_300x300/
# and save temporary evaluation results in:
# - $HOME/data/VOCdevkit/results/VOC2007/SSD_300x300/
# It should reach 77.* mAP at 120k iterations.
python examples/ssd/ssd_pascal.py
```
If you don't have time to train your model, you can download a pre-trained model at [here](https://drive.google.com/open?id=0BzKzrI_SkD1_WVVTSmQxU0dVRzA).

2. Evaluate the most recent snapshot.
```Shell
# If you would like to test a model you trained, you can do:
python examples/ssd/score_ssd_pascal.py
```

3. Test your model using a webcam. Note: press <kbd>esc</kbd> to stop.
```Shell
# If you would like to attach a webcam to a model you trained, you can do:
python examples/ssd/ssd_pascal_webcam.py
```
[Here](https://drive.google.com/file/d/0BzKzrI_SkD1_R09NcjM1eElLcWc/view) is a demo video of running a SSD500 model trained on [MSCOCO](http://mscoco.org) dataset.

4. Check out [`examples/ssd_detect.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd_detect.ipynb) or [`examples/ssd/ssd_detect.cpp`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd/ssd_detect.cpp) on how to detect objects using a SSD model. Check out [`examples/ssd/plot_detections.py`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd/plot_detections.py) on how to plot detection results output by ssd_detect.cpp.

5. To train on other dataset, please refer to data/OTHERDATASET for more details. We currently add support for COCO and ILSVRC2016. We recommend using [`examples/ssd.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/ssd_detect.ipynb) to check whether the new dataset is prepared correctly.

### Models
We have provided the latest models that are trained from different datasets. To help reproduce the results in [Table 6](https://arxiv.org/pdf/1512.02325v4.pdf), most models contain a pretrained `.caffemodel` file, many `.prototxt` files, and python scripts.

1. PASCAL VOC models:
* 07+12: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_WVVTSmQxU0dVRzA), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_ZDIxVHBEcUNBb2s)
* 07++12: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_WnR2T1BGVWlCZHM), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_MjFjNTlnempHNWs)
* COCO<sup>[1]</sup>: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_NDlVeFJDc2tIU1k), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_TW4wTC14aDdCTDQ)
* 07+12+COCO: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_UFpoU01yLS1SaG8), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_X3ZXQUUtM0xNeEk)
* 07++12+COCO: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_TkFPTEQ1Z091SUE), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_NVVNdWdYNEh1WTA)

2. COCO models:
* trainval35k: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_dUY1Ml9GRTFpUWc), [SSD512*](https://drive.google.com/open?id=0BzKzrI_SkD1_dlJpZHJzOXd3MTg)

3. ILSVRC models:
* trainval1: [SSD300*](https://drive.google.com/open?id=0BzKzrI_SkD1_a2NKQ2d1d043VXM), [SSD500](https://drive.google.com/open?id=0BzKzrI_SkD1_X2ZCLVgwLTgzaTQ)

<sup>[1]</sup>We use [`examples/convert_model.ipynb`](https://github.com/weiliu89/caffe/blob/ssd/examples/convert_model.ipynb) to extract a VOC model from a pretrained COCO model.
2 changes: 1 addition & 1 deletion cmake/Cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif()

# Known NVIDIA GPU achitectures Caffe can be compiled for.
# This list will be used for CUDA_ARCH_NAME = All option
set(Caffe_known_gpu_archs "20 21(20) 30 35 50")
set(Caffe_known_gpu_archs "20 21(20) 30 35 50 52 61")

################################################################################################
# A function for automatic detection of GPUs installed (if autodetection is enabled)
Expand Down
4 changes: 2 additions & 2 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(Caffe_LINKER_LIBS "")

# ---[ Boost
find_package(Boost 1.46 REQUIRED COMPONENTS system thread filesystem)
find_package(Boost 1.46 REQUIRED COMPONENTS system thread filesystem regex)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${Boost_LIBRARIES})

Expand Down Expand Up @@ -69,7 +69,7 @@ endif()

# ---[ OpenCV
if(USE_OPENCV)
find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs)
find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs videoio)
if(NOT OpenCV_FOUND) # if not OpenCV 3.x, then imgcodecs are not found
find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
endif()
Expand Down
29 changes: 29 additions & 0 deletions data/ILSVRC2016/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Preparation
#### ILSVRC2016
We encourage you to register [ILSVRC2016](http://image-net.org/challenges/LSVRC/2016) and download the DET dataset. By default, we assume the data is stored in `$HOME/data/ILSVRC` and will call it `$ILSVRC_ROOT`.

#### ILSVRC2015
If you choose to use ILSVRC2015 DET dataset, here are a few noticeable steps before running the following scripts:

1. There are a few problematic images. You can download the fixed ones [here](http://www.cs.unc.edu/~wliu/projects/SSD/ILSVRC2015_DET_fix.tar.gz).

2. You should download the [val1/val2 split](http://www.cs.unc.edu/~wliu/projects/SSD/ILSVRC2015_DET_val1_val2.tar.gz), courtesy of [Ross Girshick](http://people.eecs.berkeley.edu/~rbg), and put it in `$ILSVRC_ROOT/ImageSets/DET`.

### Remove an invalid file
Find the invalid image file `Data/DET/val/ILSVRC2013_val_00004542.JPEG`, and remove it.

### Create the LMDB file.
After you have downloaded the dataset, we can create the lmdb files.

```Shell
cd $CAFFE_ROOT
# Create the trainval1.txt, val2.txt, val2_name_size.txt, test.txt and test_name_size.txt in data/ILSVRC2016/
python data/ILSVRC2016/create_list.py
# You can modify the parameters in create_data.sh if needed.
# It will create lmdb files for trainval1, val2 and test with encoded original image:
# - $HOME/data/ILSVRC/lmdb/DET/ILSVRC2016_trainval1_lmdb
# - $HOME/data/ILSVRC/lmdb/DET/ILSVRC2016_val2_lmdb
# - $HOME/data/ILSVRC/lmdb/DET/ILSVRC2016_test_lmdb
# and make soft links at examples/ILSVRC2016/
./data/ILSVRC2016/create_data.sh
```
30 changes: 30 additions & 0 deletions data/ILSVRC2016/create_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cur_dir=$(cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
root_dir=$cur_dir/../..

cd $root_dir

redo=false
data_root_dir="$HOME/data/ILSVRC"
dataset_name="ILSVRC2016"
mapfile="$root_dir/data/$dataset_name/labelmap_ilsvrc_det.prototxt"
db="lmdb"
min_dim=0
max_dim=0
width=0
height=0

extra_cmd="--encode-type=jpg --encoded"
if $redo
then
extra_cmd="$extra_cmd --redo"
fi

for dataset in test
do
python $root_dir/scripts/create_annoset.py --anno-type="classification" --label-map-file=$mapfile --min-dim=$min_dim --max-dim=$max_dim --resize-width=$width --resize-height=$height --check-label $extra_cmd $data_root_dir $root_dir/data/$dataset_name/$dataset".txt" $data_root_dir/$db/DET/$dataset_name"_"$dataset"_"$db examples/$dataset_name 2>&1 | tee $root_dir/data/$dataset_name/$dataset.log
done

for dataset in val2 trainval1
do
python $root_dir/scripts/create_annoset.py --anno-type="detection" --label-map-file=$mapfile --min-dim=$min_dim --max-dim=$max_dim --resize-width=$width --resize-height=$height --check-label $extra_cmd $data_root_dir $root_dir/data/$dataset_name/$dataset".txt" $data_root_dir/$db/DET/$dataset_name"_"$dataset"_"$db examples/$dataset_name 2>&1 | tee $root_dir/data/$dataset_name/$dataset.log
done