Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
10,592 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
if(NOT HAVE_PYTHON) | ||
message(STATUS "Python interface is disabled or not all required dependencies found. Building without it...") | ||
return() | ||
endif() | ||
|
||
include_directories(${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) | ||
file(GLOB_RECURSE python_srcs ${PROJECT_SOURCE_DIR}/python/*.cpp) | ||
|
||
add_library(pycaffe SHARED ${python_srcs}) | ||
target_link_libraries(pycaffe ${Caffe_LINK} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) | ||
set_target_properties(pycaffe PROPERTIES PREFIX "" OUTPUT_NAME "_caffe") | ||
caffe_default_properties(pycaffe) | ||
|
||
if(UNIX OR APPLE) | ||
set(__linkname "${PROJECT_SOURCE_DIR}/python/caffe/_caffe.so") | ||
add_custom_command(TARGET pycaffe POST_BUILD | ||
COMMAND ln -sf $<TARGET_LINKER_FILE:pycaffe> "${__linkname}" | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/python/caffe/proto | ||
COMMAND touch ${PROJECT_SOURCE_DIR}/python/caffe/proto/__init__.py | ||
COMMAND cp ${proto_gen_folder}/*.py ${PROJECT_SOURCE_DIR}/python/caffe/proto/ | ||
COMMENT "Creating symlink ${__linkname} -> ${PROJECT_BINARY_DIR}/lib/_caffe${Caffe_POSTFIX}.so") | ||
endif() | ||
|
||
# ---[ Install | ||
file(GLOB files1 *.py requirements.txt) | ||
install(FILES ${files1} DESTINATION python) | ||
|
||
file(GLOB files2 caffe/*.py) | ||
install(FILES ${files2} DESTINATION python/caffe) | ||
install(TARGETS pycaffe DESTINATION python/caffe) | ||
install(DIRECTORY caffe/imagenet caffe/proto caffe/test DESTINATION python/caffe) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver | ||
from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list | ||
from ._caffe import __version__ | ||
from .proto.caffe_pb2 import TRAIN, TEST | ||
from .classifier import Classifier | ||
from .detector import Detector | ||
from . import io | ||
from .net_spec import layers, params, NetSpec, to_proto |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.