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

Python net specification #1733

Closed
wants to merge 121 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
2f869e7
clarify draw_net.py usage: net prototxt, not caffemodel
shelhamer Jan 25, 2015
61c63f6
[docs] ask install + hardware questions on caffe-users
shelhamer Jan 25, 2015
4cc8195
[docs] send API link to class list
shelhamer Jan 29, 2015
1f7c3de
[docs] add check mode hint to CPU-only mode error
shelhamer Jan 29, 2015
8b96472
Brief explanation of SLICE layer's attributes
boechat107 Jan 30, 2015
75d0e16
lint 1f7c3de
shelhamer Jan 30, 2015
e3c895b
Merge pull request #1817 from boechat107/patch-1
shelhamer Jan 30, 2015
1e0d49a
Correct 'epochs' to 'iterations'
Feb 16, 2015
3e9b050
Merge pull request #1879 from bamos/patch-1
sguada Feb 16, 2015
f998127
Merge pull request #1849 from BVLC/next
shelhamer Feb 20, 2015
af01b9c
Updated the path for get_ilsvrc_aux.sh to match what is found in the …
Feb 20, 2015
5ee85b7
Merge pull request #1914 from eerwitt/master
shelhamer Feb 20, 2015
eabbccd
[build] fix dynamic linking of tools
shelhamer Feb 20, 2015
682d9da
Merge pull request #1921 from shelhamer/fix-tool-linking
shelhamer Feb 20, 2015
5a26333
check caffe tool runs in runtest
shelhamer Feb 21, 2015
a1e951d
ignore pycharm files
Feb 22, 2015
fca05c3
set proper CMAKE_INSTALL_RPATH for _caffe.so and tools
Feb 22, 2015
645aa03
fixed bug in install-tree: _caffe.so installed by install(TARGET ...)…
Feb 22, 2015
5e06d16
minor cmake sumamry log fix
Feb 22, 2015
569ae01
cpp_lint.py fails silently with Python3 (which is the default on some…
jsupancic Feb 22, 2015
cb1f4d6
Merge pull request #1939 from Nerei/bugfix/install_rpath_for_pycaffe
shelhamer Feb 22, 2015
845f9ea
APPLE was misspelled. in Line 27
spmallick Feb 24, 2015
486360d
Merge pull request #1948 from spmallick/patch-1
longjon Feb 24, 2015
c091197
Merge pull request #1941 from jsupancic/cpp_lint_python2
longjon Feb 24, 2015
360dbfd
Merge pull request #1926 from shelhamer/test-caffe-tool
longjon Feb 24, 2015
54037d3
Making python3 work with cmake and the new python wrapper
philkr Feb 17, 2015
b915f9d
Merge pull request #1923 from philkr/python3_master
longjon Feb 24, 2015
2cf5089
Decoding the datum before feeding it into the reshaping data layer
philkr Feb 25, 2015
4a3887a
fixed matcaffe printout to specify num of args (now including train/t…
forresti Feb 25, 2015
d2beb8a
Replaced illegal tab in Makefile with spaces.
gustavla Feb 25, 2015
1377e1b
Makefile fix for OS X 10.10
sergeyk Feb 25, 2015
3a1195a
Merge pull request #1961 from sergeyk/master
shelhamer Feb 25, 2015
b9aa166
Merge pull request #1960 from gustavla/makefile_fix
longjon Feb 25, 2015
7651970
Fixing two bugs related to python3 and PROJECT_SOURCE_DIR
philkr Feb 25, 2015
25cdd35
Small fix (visualization) on SLICE layer's documentation
boechat107 Feb 25, 2015
a677076
Merge pull request #1955 from philkr/reshaping_encoded
shelhamer Feb 26, 2015
101055c
Fix siamese ipynb example
tnarihi Feb 26, 2015
4fba3da
Merge pull request #1999 from boechat107/patch-2
longjon Feb 27, 2015
1833566
Added Pillow to requirements.txt
danielhamngren Mar 1, 2015
1434e87
Blobs are ND arrays (for N not necessarily equals 4).
jeffdonahue Nov 26, 2014
5407f82
Add BlobShape message; use for Net input shapes
jeffdonahue Jan 1, 2015
119a1c6
add offset, {data,diff}_at nd blob accessors
jeffdonahue Feb 4, 2015
c4e9ec4
TestBlob: test that legacy BlobProtos are correctly handled by ShapeE…
jeffdonahue Nov 30, 2014
559ff3a
InnerProductLayer weights are 2D; biases are 1D
jeffdonahue Nov 26, 2014
cf9fdda
Fix sparse GaussianFiller for new IPLayer weight axes
jeffdonahue Feb 16, 2015
29581e6
InnerProductLayer can multiply along any axis
jeffdonahue Nov 29, 2014
94179cc
ConvLayer biases are 1D
jeffdonahue Nov 30, 2014
a0fa2a9
LossLayer output is 0D (scalar)
jeffdonahue Nov 26, 2014
d8c6aeb
AccuracyLayer output is 0D (scalar)
jeffdonahue Nov 30, 2014
6b8a765
AccuracyLayer generalized to N instance axes
jeffdonahue Jan 31, 2015
8e96445
Test{Net,Solver} fixes for AccuracyLayer generalization
jeffdonahue Feb 13, 2015
bf73cb1
EltwiseLayer need not assume old 4D dim names
jeffdonahue Nov 26, 2014
1b97c06
FlattenLayer: generalized Blob axes
jeffdonahue Nov 26, 2014
fb9caee
common_layers.hpp: remove unused "Blob col_bob_"
jeffdonahue Nov 26, 2014
704e524
TestConcatLayer: fix style errors
jeffdonahue Nov 26, 2014
d52e9a8
TestConcatLayer: add forward/gradient tests for concatenation along num
jeffdonahue Nov 26, 2014
8afdcd0
ConcatLayer: generalized Blob axes
jeffdonahue Nov 26, 2014
b868916
SliceLayer: generalized Blob axes
jeffdonahue Nov 26, 2014
abec302
SoftmaxLayer: generalized Blob axes
jeffdonahue Feb 15, 2015
60c288b
CuDNNSoftmaxLayer: generalized Blob axes
jeffdonahue Feb 10, 2015
94d93da
SoftmaxLossLayer generalized like SoftmaxLayer
jeffdonahue Jan 31, 2015
e2bc9f9
SplitLayer: change Reshape(n,h,c,w) to ReshapeLike(...)
jeffdonahue Nov 26, 2014
e6468e9
HDF5DataLayer shapes output according to HDF5 shape
jeffdonahue Nov 26, 2014
e56377d
DataLayer outputs 1D labels
jeffdonahue Nov 26, 2014
7c8725b
MemoryDataLayer outputs 1D labels
jeffdonahue Nov 26, 2014
c87a136
ImageDataLayer outputs 1D labels
jeffdonahue Nov 26, 2014
9505001
WindowDataLayer outputs 1D labels
jeffdonahue Nov 26, 2014
fcbb933
EuclideanLossLayer: generalized Blob axes
jeffdonahue Nov 30, 2014
7462c84
DummyDataLayer outputs blobs of arbitrary shape
jeffdonahue Jan 1, 2015
69fc1f6
Add CHECK_EQ(4, ...)s to "vision layers" to enforce that the
jeffdonahue Jan 16, 2015
269dafa
PyBlobs support generalized axes
jeffdonahue Jan 2, 2015
71df6f9
Add option not to reshape to Blob::FromProto; use when loading Blobs
jeffdonahue Jan 31, 2015
aa242aa
[pycaffe] expose Blob.reshape as *args function
longjon Mar 2, 2015
8c79d65
[pytest] use non-4d blobs in test_python_layer
longjon Mar 2, 2015
85bb397
Merge pull request #1970 from jeffdonahue/tensor-blob
shelhamer Mar 4, 2015
136139b
Merge pull request #1966 from philkr/python_fixes
longjon Mar 4, 2015
642619b
Add error checking for image mean
lukeyeager Feb 23, 2015
c0bc17c
Merge pull request #2031 from NVIDIA/image_mean
shelhamer Mar 4, 2015
dec148e
fix comment I forgot about from @shelhamer's review of #1970
jeffdonahue Mar 4, 2015
a3b0fbd
include/caffe/common.hpp: add <climits> for INT_MAX (now in blob.hpp)
jeffdonahue Mar 4, 2015
12e7317
Merge pull request #2035 from jeffdonahue/include-climits
jeffdonahue Mar 4, 2015
ccfa3dc
[pycaffe] check mean channels for transformation
shelhamer Mar 5, 2015
c0219cc
expose Solver::Restore() as public and Solver.restore() in pycaffe
shelhamer Mar 5, 2015
596add7
[pycaffe] add missing import sys
longjon Mar 5, 2015
65d84a5
[docs] include boost-python in OSX pycaffe install
shelhamer Mar 5, 2015
87d3aa3
Adding correct hdf5 path
philkr Mar 5, 2015
5fec3f7
fix #1506
tishibas Mar 6, 2015
4d0103b
Merge pull request #2037 from shelhamer/expose-solver-restore
shelhamer Mar 7, 2015
60f1743
Merge pull request #2010 from danielhamngren/update_python_requirements
shelhamer Mar 7, 2015
3d30510
Making python layer work with cmake
philkr Mar 7, 2015
3164876
Merge pull request #2055 from tishibas/iss1506
shelhamer Mar 7, 2015
0134276
Merge pull request #2056 from philkr/hdf5
shelhamer Mar 7, 2015
a66be31
Merge pull request #2059 from philkr/python_layer_cmake
shelhamer Mar 7, 2015
fb88df3
Merge pull request #1987 from tnarihi/fix-siam-example
shelhamer Mar 7, 2015
256366b
Fix references to plural names in API documentation
cNikolaou Nov 5, 2014
d952ea3
Update leveldb include variable name to match FindLevelDB.cmake
caotto Mar 7, 2015
35518c0
comment grammar in net.cpp
longjon Mar 8, 2015
c3aee35
whitespace in common.hpp
longjon Mar 8, 2015
a0087e4
Load weights from multiple caffemodels.
jyegerlehner Nov 19, 2014
a9bf7b9
Merge pull request #1456 from jyegerlehner/load-weights-from-multiple…
shelhamer Mar 8, 2015
1cd6fcb
extract_features preserves feature shape
jyegerlehner Nov 19, 2014
c942dc1
Merge pull request #1457 from jyegerlehner/preserve-extracted-blob-sh…
shelhamer Mar 8, 2015
fc35930
[pycaffe] no need to squeeze output after #1970
shelhamer Mar 7, 2015
3e4d11b
[pycaffe] make classify.py print input + output file paths
andi4000 Nov 4, 2014
3f68c51
[pycaffe] fix CPU / GPU switch in example scripts
shelhamer Mar 7, 2015
0b39892
[pycaffe] classifier + detector only have one input
shelhamer Mar 7, 2015
5c84795
[pycaffe] align web demo with #1728 and #1902
shelhamer Mar 7, 2015
08b595d
[example] revise filter visualization
shelhamer Mar 7, 2015
e2656e0
[example] revise net surgery + add designer filters
shelhamer Mar 7, 2015
124f6ef
[example] revise hdf5 classification
shelhamer Mar 7, 2015
1173044
[example] warm-start web demo
shelhamer Mar 7, 2015
c99b83c
SoftmaxLossLayer fix: canonicalize input axis
jeffdonahue Mar 9, 2015
9e970c1
Merge pull request #2066 from caotto/leveldb_include_update
jeffdonahue Mar 9, 2015
1535d58
[example] pycaffe classification downloads the model automatically
shelhamer Mar 9, 2015
d9ed0b9
Merge pull request #2058 from shelhamer/py-fixes
shelhamer Mar 9, 2015
7a40f74
Fixup AccuracyLayer like SoftmaxLossLayer in #1970 -- fixes #2063
jeffdonahue Mar 9, 2015
6ea7a66
AccuracyLayer: add ignore_label param
BlGene Feb 22, 2015
2abbaca
AccuracyLayerTest: add tests for ignore_label and spatial axes
jeffdonahue Mar 9, 2015
77ab8f6
Merge pull request #2076 from jeffdonahue/accuracy-layer-fixes
jeffdonahue Mar 9, 2015
66d24bd
[pycaffe] rough-hewn net specification
longjon Jan 15, 2015
cde046a
[examples] caffenet python spec
longjon Mar 10, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
# QtCreator files
*.user

# PyCharm files
.idea

# OSX dir files
.DS_Store

Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ caffe_option(CPU_ONLY "Build Caffe wihtout CUDA support" OFF) # TODO: rename to
caffe_option(USE_CUDNN "Build Caffe with cuDNN libary support" ON IF NOT CPU_ONLY)
caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
caffe_option(BUILD_python "Build Python wrapper" ON)
set(python_version "2" CACHE STRING "Specify which python version to use")
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
caffe_option(BUILD_docs "Build documentation" ON IF UNIX OR APPLE)
caffe_option(BUILD_python_layer "Build the caffe python layer" ON)

# ---[ Dependencies
include(cmake/Dependencies.cmake)

# ---[ Flags
if(UNIX OR APLE)
if(UNIX OR APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")
endif()

Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ ifneq (,$(findstring clang++,$(CXX)))
else ifneq (,$(findstring g++,$(CXX)))
STATIC_LINK_COMMAND := -Wl,--whole-archive $(STATIC_NAME) -Wl,--no-whole-archive
else
$(error Cannot static link with the $(CXX) compiler.)
# The following line must not be indented with a tab, since we are not inside a target
$(error Cannot static link with the $(CXX) compiler)
endif

# Debugging
Expand Down Expand Up @@ -319,7 +320,7 @@ else
# 10.10 has accelerate while 10.9 has veclib
XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep -o 'version: 6')
ifneq (,$(findstring version: 6,$(XCODE_CLT_VER)))
BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
BLAS_INCLUDE ?= /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
LDFLAGS += -framework Accelerate
else
BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
Expand Down Expand Up @@ -450,6 +451,7 @@ $(MAT$(PROJECT)_SO): $(MAT$(PROJECT)_SRC) $(STATIC_NAME)
CXXLIBS="\$$CXXLIBS $(STATIC_LINK_COMMAND) $(LDFLAGS)" -output $@

runtest: $(TEST_ALL_BIN)
$(TOOL_BUILD_DIR)/caffe
$(TEST_ALL_BIN) $(TEST_GPUID) --gtest_shuffle $(TEST_FILTER)

pytest: py
Expand Down Expand Up @@ -537,7 +539,12 @@ $(TOOL_BUILD_DIR)/%: $(TOOL_BUILD_DIR)/%.bin | $(TOOL_BUILD_DIR)
@ $(RM) $@
@ ln -s $(abspath $<) $@

$(TOOL_BINS) $(EXAMPLE_BINS): %.bin : %.o | $(DYNAMIC_NAME)
$(TOOL_BINS): %.bin : %.o | $(DYNAMIC_NAME)
@ echo CXX/LD -o $@
$(Q)$(CXX) $< -o $@ $(LINKFLAGS) -l$(PROJECT) $(LDFLAGS) \
-Wl,-rpath,$(ORIGIN)/../lib

$(EXAMPLE_BINS): %.bin : %.o | $(DYNAMIC_NAME)
@ echo CXX/LD -o $@
$(Q)$(CXX) $< -o $@ $(LINKFLAGS) -l$(PROJECT) $(LDFLAGS) \
-Wl,-rpath,$(ORIGIN)/../../lib
Expand Down
48 changes: 40 additions & 8 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ include(cmake/ProtoBuf.cmake)

# ---[ HDF5
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS})
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})

# ---[ LMDB
Expand All @@ -35,7 +35,7 @@ list(APPEND Caffe_LINKER_LIBS ${LMDB_LIBRARIES})

# ---[ LevelDB
find_package(LevelDB REQUIRED)
include_directories(SYSTEM ${LEVELDB_INCLUDE})
include_directories(SYSTEM ${LevelDB_INCLUDE})
list(APPEND Caffe_LINKER_LIBS ${LevelDB_LIBRARIES})

# ---[ Snappy
Expand Down Expand Up @@ -92,14 +92,46 @@ endif()

# ---[ Python
if(BUILD_python)
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
find_package(NumPy 1.7.1)
find_package(Boost 1.46 COMPONENTS python)

if(NOT "${python_version}" VERSION_LESS "3.0.0")
# use python3
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
find_package(NumPy 1.7.1)
# Find the matching boost python implementation
set(version ${PYTHONLIBS_VERSION_STRING})

STRING( REPLACE "." "" boost_py_version ${version} )
find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})

while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )
STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
if("${has_more_version}" STREQUAL "")
break()
endif()

STRING( REPLACE "." "" boost_py_version ${version} )
find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
endwhile()
if(NOT Boost_PYTHON_FOUND)
find_package(Boost 1.46 COMPONENTS python)
endif()
else()
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
find_package(NumPy 1.7.1)
find_package(Boost 1.46 COMPONENTS python)
endif()
if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
set(HAVE_PYTHON TRUE)
if(BUILD_python_layer)
add_definitions(-DWITH_PYTHON_LAYER)
include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
endif()
endif()
endif()

Expand Down
5 changes: 5 additions & 0 deletions cmake/Misc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOLEAN "Use link paths for shared library rpath")
set(CMAKE_MACOSX_RPATH TRUE)

list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib __is_systtem_dir)
if(${__is_systtem_dir} STREQUAL -1)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
endif()

# ---[ Funny target
if(UNIX OR APPLE)
add_custom_target(symlink_to_build COMMAND "ln" "-sf" "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/build"
Expand Down
6 changes: 4 additions & 2 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,19 @@ function(caffe_print_configuration_summary)
caffe_status(" C++ compiler : ${CMAKE_CXX_COMPILER}")
caffe_status(" Release CXX flags : ${__flags_rel}")
caffe_status(" Debug CXX flags : ${__flags_deb}")
caffe_status(" BUILD_SHARED_LIBS : ${BUILD_SHARED_LIBS}")
caffe_status(" Build type : ${CMAKE_BUILD_TYPE}")
caffe_status("")
caffe_status(" BUILD_SHARED_LIBS : ${BUILD_SHARED_LIBS}")
caffe_status(" BUILD_python : ${BUILD_python}")
caffe_status(" BUILD_matlab : ${BUILD_matlab}")
caffe_status(" BUILD_docs : ${BUILD_docs}")
caffe_status(" CPU_ONLY : ${CPU_ONLY}")
caffe_status("")
caffe_status("Dependencies:")
caffe_status(" BLAS : " APPLE THEN "Yes (vecLib)" ELSE "Yes (${BLAS})")
caffe_status(" Boost : Yes (ver. ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION})")
caffe_status(" glog : Yes")
caffe_status(" gflags : Yes")
caffe_status(" gflags : Yes")
caffe_status(" protobuf : " PROTOBUF_FOUND THEN "Yes (ver. ${PROTOBUF_VERSION})" ELSE "No" )
caffe_status(" lmdb : " LMDB_FOUND THEN "Yes (ver. ${LMDB_VERSION})" ELSE "No")
caffe_status(" Snappy : " SNAPPY_FOUND THEN "Yes (ver. ${Snappy_VERSION})" ELSE "No" )
Expand Down
2 changes: 1 addition & 1 deletion docs/install_osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If using Anaconda Python, HDF5 is bundled and the `hdf5` formula can be skipped.

# with Python pycaffe needs dependencies built from source
brew install --build-from-source --with-python --fresh -vd protobuf
brew install --build-from-source --fresh -vd boost
brew install --build-from-source --fresh -vd boost boost-python
# without Python the usual installation suffices
brew install protobuf boost

Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Caffe has several dependencies.

Pycaffe and Matcaffe interfaces have their own natural needs.

* For Python Caffe: `Python 2.7`, `numpy (>= 1.7)`, boost-provided `boost.python`
* For Python Caffe: `Python 2.7` or `Python 3.3+`, `numpy (>= 1.7)`, boost-provided `boost.python`
* For MATLAB Caffe: MATLAB with the `mex` compiler.

**cuDNN Caffe**: for fastest operation Caffe is accelerated by drop-in integration of [NVIDIA cuDNN](https://developer.nvidia.com/cudnn). To speed up your Caffe models, install cuDNN then uncomment the `USE_CUDNN := 1` flag in `Makefile.config` when installing Caffe. Acceleration is automatic. For now cuDNN v1 is integrated but see [PR #1731](https://github.com/BVLC/caffe/pull/1731) for v2.
Expand Down Expand Up @@ -69,7 +69,7 @@ but we suggest first installing the [Anaconda](https://store.continuum.io/cshop/

To import the `caffe` Python module after completing the installation, add the module directory to your `$PYTHONPATH` by `export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH` or the like. You should not import the module in the `caffe/python/caffe` directory!

*Caffe's Python interface works with Python 2.7. Python 3 or earlier Pythons are your own adventure.*
*Caffe's Python interface works with Python 2.7. Python 3.3+ should work out of the box without protobuf support. For protobuf support please install protobuf 3.0 alpha (https://developers.google.com/protocol-buffers/). Earlier Pythons are your own adventure.*

#### MATLAB

Expand Down
28 changes: 14 additions & 14 deletions docs/tutorial/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,20 @@ The `SLICE` layer is a utility layer that slices an input layer to multiple outp

* Sample

layers {
name: "slicer_label"
type: SLICE
bottom: "label"
## Example of label with a shape N x 3 x 1 x 1
top: "label1"
top: "label2"
top: "label3"
slice_param {
slice_dim: 1
slice_point: 1
slice_point: 2
}
}
layers {
name: "slicer_label"
type: SLICE
bottom: "label"
## Example of label with a shape N x 3 x 1 x 1
top: "label1"
top: "label2"
top: "label3"
slice_param {
slice_dim: 1
slice_point: 1
slice_point: 2
}
}

`slice_dim` indicates the target dimension and can assume only two values: 0 for num or 1 for channel; `slice_point` indicates indexes in the selected dimension (the number of indexes must be equal to the number of top blobs minus one).

Expand Down
13 changes: 9 additions & 4 deletions examples/classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"example_name": "ImageNet classification",
"include_in_docs": true,
"priority": 1,
"signature": "sha256:918b797b1b7d78125c8f1e3c84756b0679120cbe1071ce7fee7aeafef0fbae55"
"signature": "sha256:a2b12abaa1eb252f436d59833c08ab97948c8a7a0513197f31afad0a0690e318"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand All @@ -18,9 +18,9 @@
"Classifying ImageNet: the instant Caffe way\n",
"===========================================\n",
"\n",
"Caffe provides a general Python interface for models with `caffe.Net` in `python/caffe/pycaffe.py`, but to make off-the-shelf classification easy we provide a `caffe.Classifier` class and `classify.py` script. Both Python and MATLAB wrappers are provided. However, the Python wrapper has more features so we will describe it here. For MATLAB, refer to `matlab/caffe/matcaffe_demo.m`.\n",
"Caffe has a Python interface, pycaffe, with a `caffe.Net` interface for models. There are both Python and MATLAB interfaces. While this example uses the off-the-shelf Python `caffe.Classifier` interface there is also a MATLAB example at `matlab/caffe/matcaffe_demo.m`.\n",
"\n",
"Before we begin, you must compile Caffe and install the python wrapper by setting your `PYTHONPATH`. If you haven't yet done so, please refer to the [installation instructions](installation.html). This example uses our pre-trained CaffeNet model, an ILSVRC12 image classifier. You can download it by running `./scripts/download_model_binary.py models/bvlc_reference_caffenet`.\n",
"Before we begin, you must compile Caffe. You should add the Caffe module to your `PYTHONPATH` although this example includes it automatically. If you haven't yet done so, please refer to the [installation instructions](http://caffe.berkeleyvision.org/installation.html). This example uses our pre-trained CaffeNet model, an ILSVRC12 image classifier. You can download it by running `./scripts/download_model_binary.py models/bvlc_reference_caffenet` or let the first step of this example download it for you.\n",
"\n",
"Ready? Let's start."
]
Expand All @@ -44,7 +44,12 @@
"# and the image you would like to classify.\n",
"MODEL_FILE = '../models/bvlc_reference_caffenet/deploy.prototxt'\n",
"PRETRAINED = '../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'\n",
"IMAGE_FILE = 'images/cat.jpg'"
"IMAGE_FILE = 'images/cat.jpg'\n",
"\n",
"import os\n",
"if not os.path.isfile(PRETRAINED):\n",
" print(\"Downloading pre-trained CaffeNet model...\")\n",
" !../scripts/download_model_binary.py ../models/bvlc_reference_caffenet"
],
"language": "python",
"metadata": {},
Expand Down
Loading