├── .gitignore
├── LICENSE
├── README.md
├── README.zh_CN.md
├── SungemSDK
├── .gitignore
├── LICENSE
├── README.md
├── README.zh_CN.md
├── include
│ └── hs.h
├── installer
│ ├── 99-hornedsungem.rules
│ ├── Linux
│ │ └── install.sh
│ └── macOS
│ │ └── install.sh
├── lib
│ ├── linux
│ │ ├── aarch64
│ │ │ └── libhs.so
│ │ ├── armv6l
│ │ │ └── libhs.so
│ │ ├── armv7l
│ │ ├── i386
│ │ ├── i586
│ │ ├── i686
│ │ │ └── libhs.so
│ │ └── x86_64
│ │ │ └── libhs.so
│ └── macos
│ │ └── libhs.dylib
└── logo
│ └── logo.png
├── examples
├── apps
│ ├── FaceDetector
│ │ └── FaceDetector.py
│ ├── GetImage
│ │ └── GetImage.py
│ ├── Hello2018
│ │ └── Hello2018.py
│ ├── ImageRecognition
│ │ └── ImageRecognition.py
│ ├── MT_FaceDetector
│ │ └── MT_FaceDetector.py
│ ├── MT_SceneRecorder
│ │ └── MT_SceneRecorder.py
│ ├── ObjectDetector
│ │ └── ObjectDetector.py
│ ├── SceneRecorder
│ │ └── SceneRecorder.py
│ ├── SketchGuess
│ │ ├── SketchGuess.py
│ │ └── game.py
│ ├── TEST_MultiModelity
│ │ └── TEST_MultiModelity.py
│ ├── age_gender
│ │ └── age_gender.py
│ ├── birds
│ │ ├── birds.py
│ │ └── images
│ │ │ ├── Eagles-2_Rebecca.jpg
│ │ │ ├── jas_birds_10.jpg
│ │ │ ├── jas_birds_2.jpg
│ │ │ ├── jas_birds_8.jpg
│ │ │ ├── nps_birds_1.jpg
│ │ │ ├── nps_birds_2.jpg
│ │ │ └── nps_birds_3.jpg
│ ├── image-classifier
│ │ └── image-classifier.py
│ └── street_cam_threaded
│ │ ├── googlenet_processor.py
│ │ ├── street_cam_threaded.py
│ │ ├── tiny_yolo_processor.py
│ │ └── video_processor.py
├── graphs
│ └── README.md
└── misc
│ └── README.md
├── hsapi
├── __init__.py
├── core
│ ├── __init__.py
│ ├── base.py
│ ├── device.py
│ └── graph.py
├── easy
│ ├── __init__.py
│ └── prefab.py
├── high
│ ├── __init__.py
│ ├── net.py
│ └── task.py
└── upgrade
│ └── upgrade.py
├── installer
├── Linux
│ ├── CentOS
│ │ └── install.sh
│ ├── Fedora
│ │ └── install.sh
│ ├── Raspbian
│ │ ├── install-opencv.sh
│ │ └── install.sh
│ └── Ubuntu
│ │ └── install.sh
├── macOS
│ └── install.sh
└── requirements_pip.txt
└── tool
├── Controllers
├── Args.py
├── CaffeEnumController.py
├── CaffeParser.py
├── DataTransforms.py
├── EnumController.py
├── FileIO.py
├── Metrics.py
├── MiscIO.py
├── TensorFlowParser.py
└── TensorFlowPreproc.py
├── Makefile.config
├── Models
├── Blob.py
├── CaffeEnumDeclarations.py
├── EnumDeclarations.py
├── MyriadParam.py
├── Network.py
└── NetworkStage.py
├── README.md
├── Views
├── Graphs.py
├── Summary.py
└── Validate.py
├── caffe
├── .Doxyfile
├── .github
│ └── ISSUE_TEMPLATE.md
├── .gitignore
├── .travis.yml
├── CMakeLists.txt
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── INSTALL.md
├── LICENSE
├── Makefile
├── Makefile.config
├── Makefile.config.example
├── README.md
├── caffe.cloc
├── cmake
│ ├── ConfigGen.cmake
│ ├── Cuda.cmake
│ ├── Dependencies.cmake
│ ├── External
│ │ ├── gflags.cmake
│ │ └── glog.cmake
│ ├── Misc.cmake
│ ├── Modules
│ │ ├── FindAtlas.cmake
│ │ ├── FindGFlags.cmake
│ │ ├── FindGlog.cmake
│ │ ├── FindLAPACK.cmake
│ │ ├── FindLMDB.cmake
│ │ ├── FindLevelDB.cmake
│ │ ├── FindMKL.cmake
│ │ ├── FindMatlabMex.cmake
│ │ ├── FindNumPy.cmake
│ │ ├── FindOpenBLAS.cmake
│ │ ├── FindSnappy.cmake
│ │ └── FindvecLib.cmake
│ ├── ProtoBuf.cmake
│ ├── Summary.cmake
│ ├── Targets.cmake
│ ├── Templates
│ │ ├── CaffeConfig.cmake.in
│ │ ├── CaffeConfigVersion.cmake.in
│ │ └── caffe_config.h.in
│ ├── Utils.cmake
│ └── lint.cmake
├── docs
│ ├── CMakeLists.txt
│ ├── CNAME
│ ├── README.md
│ ├── _config.yml
│ ├── _layouts
│ │ └── default.html
│ ├── development.md
│ ├── images
│ │ ├── GitHub-Mark-64px.png
│ │ └── caffeine-icon.png
│ ├── index.md
│ ├── install_apt.md
│ ├── install_osx.md
│ ├── install_yum.md
│ ├── installation.md
│ ├── model_zoo.md
│ ├── multigpu.md
│ ├── performance_hardware.md
│ ├── stylesheets
│ │ ├── pygment_trac.css
│ │ ├── reset.css
│ │ └── styles.css
│ └── tutorial
│ │ ├── convolution.md
│ │ ├── data.md
│ │ ├── fig
│ │ ├── .gitignore
│ │ └── forward_backward.png
│ │ ├── forward_backward.md
│ │ ├── index.md
│ │ ├── interfaces.md
│ │ ├── layers.md
│ │ ├── loss.md
│ │ ├── net_layer_blob.md
│ │ └── solver.md
├── include
│ └── caffe
│ │ ├── blob.hpp
│ │ ├── caffe.hpp
│ │ ├── common.hpp
│ │ ├── data_reader.hpp
│ │ ├── data_transformer.hpp
│ │ ├── filler.hpp
│ │ ├── internal_thread.hpp
│ │ ├── layer.hpp
│ │ ├── layer_factory.hpp
│ │ ├── layers
│ │ ├── absval_layer.hpp
│ │ ├── accuracy_layer.hpp
│ │ ├── annotated_data_layer.hpp
│ │ ├── argmax_layer.hpp
│ │ ├── base_conv_layer.hpp
│ │ ├── base_data_layer.hpp
│ │ ├── batch_norm_layer.hpp
│ │ ├── batch_reindex_layer.hpp
│ │ ├── bias_layer.hpp
│ │ ├── bnll_layer.hpp
│ │ ├── concat_layer.hpp
│ │ ├── contrastive_loss_layer.hpp
│ │ ├── conv_layer.hpp
│ │ ├── crop_layer.hpp
│ │ ├── cudnn_conv_layer.hpp
│ │ ├── cudnn_lcn_layer.hpp
│ │ ├── cudnn_lrn_layer.hpp
│ │ ├── cudnn_pooling_layer.hpp
│ │ ├── cudnn_relu_layer.hpp
│ │ ├── cudnn_sigmoid_layer.hpp
│ │ ├── cudnn_softmax_layer.hpp
│ │ ├── cudnn_tanh_layer.hpp
│ │ ├── data_layer.hpp
│ │ ├── deconv_layer.hpp
│ │ ├── detection_evaluate_layer.hpp
│ │ ├── detection_output_layer.hpp
│ │ ├── dropout_layer.hpp
│ │ ├── dummy_data_layer.hpp
│ │ ├── eltwise_layer.hpp
│ │ ├── elu_layer.hpp
│ │ ├── embed_layer.hpp
│ │ ├── euclidean_loss_layer.hpp
│ │ ├── exp_layer.hpp
│ │ ├── filter_layer.hpp
│ │ ├── flatten_layer.hpp
│ │ ├── hdf5_data_layer.hpp
│ │ ├── hdf5_output_layer.hpp
│ │ ├── hinge_loss_layer.hpp
│ │ ├── im2col_layer.hpp
│ │ ├── image_data_layer.hpp
│ │ ├── infogain_loss_layer.hpp
│ │ ├── inner_product_layer.hpp
│ │ ├── input_layer.hpp
│ │ ├── log_layer.hpp
│ │ ├── loss_layer.hpp
│ │ ├── lrn_layer.hpp
│ │ ├── lstm_layer.hpp
│ │ ├── memory_data_layer.hpp
│ │ ├── multibox_loss_layer.hpp
│ │ ├── multinomial_logistic_loss_layer.hpp
│ │ ├── mvn_layer.hpp
│ │ ├── neuron_layer.hpp
│ │ ├── normalize_layer.hpp
│ │ ├── parameter_layer.hpp
│ │ ├── permute_layer.hpp
│ │ ├── pooling_layer.hpp
│ │ ├── power_layer.hpp
│ │ ├── prelu_layer.hpp
│ │ ├── prior_box_layer.hpp
│ │ ├── python_layer.hpp
│ │ ├── recurrent_layer.hpp
│ │ ├── reduction_layer.hpp
│ │ ├── relu_layer.hpp
│ │ ├── reshape_layer.hpp
│ │ ├── rnn_layer.hpp
│ │ ├── scale_layer.hpp
│ │ ├── sigmoid_cross_entropy_loss_layer.hpp
│ │ ├── sigmoid_layer.hpp
│ │ ├── silence_layer.hpp
│ │ ├── slice_layer.hpp
│ │ ├── smooth_L1_loss_layer.hpp
│ │ ├── softmax_layer.hpp
│ │ ├── softmax_loss_layer.hpp
│ │ ├── split_layer.hpp
│ │ ├── spp_layer.hpp
│ │ ├── tanh_layer.hpp
│ │ ├── threshold_layer.hpp
│ │ ├── tile_layer.hpp
│ │ ├── video_data_layer.hpp
│ │ └── window_data_layer.hpp
│ │ ├── net.hpp
│ │ ├── parallel.hpp
│ │ ├── sgd_solvers.hpp
│ │ ├── solver.hpp
│ │ ├── solver_factory.hpp
│ │ ├── syncedmem.hpp
│ │ ├── test
│ │ ├── test_caffe_main.hpp
│ │ └── test_gradient_check_util.hpp
│ │ └── util
│ │ ├── bbox_util.hpp
│ │ ├── benchmark.hpp
│ │ ├── blocking_queue.hpp
│ │ ├── cudnn.hpp
│ │ ├── db.hpp
│ │ ├── db_leveldb.hpp
│ │ ├── db_lmdb.hpp
│ │ ├── device_alternate.hpp
│ │ ├── format.hpp
│ │ ├── gpu_util.cuh
│ │ ├── hdf5.hpp
│ │ ├── im2col.hpp
│ │ ├── im_transforms.hpp
│ │ ├── insert_splits.hpp
│ │ ├── io.hpp
│ │ ├── math_functions.hpp
│ │ ├── mkl_alternate.hpp
│ │ ├── rng.hpp
│ │ ├── sampler.hpp
│ │ ├── signal_handler.h
│ │ └── upgrade_proto.hpp
├── matlab
│ ├── +caffe
│ │ ├── +test
│ │ │ ├── test_io.m
│ │ │ ├── test_net.m
│ │ │ └── test_solver.m
│ │ ├── Blob.m
│ │ ├── Layer.m
│ │ ├── Net.m
│ │ ├── Solver.m
│ │ ├── get_net.m
│ │ ├── get_solver.m
│ │ ├── io.m
│ │ ├── private
│ │ │ ├── CHECK.m
│ │ │ ├── CHECK_FILE_EXIST.m
│ │ │ ├── caffe_.cpp
│ │ │ └── is_valid_handle.m
│ │ ├── reset_all.m
│ │ ├── run_tests.m
│ │ ├── set_device.m
│ │ ├── set_mode_cpu.m
│ │ ├── set_mode_gpu.m
│ │ └── version.m
│ ├── CMakeLists.txt
│ ├── demo
│ │ └── classification_demo.m
│ └── hdf5creation
│ │ ├── .gitignore
│ │ ├── demo.m
│ │ └── store2hdf5.m
├── python
│ ├── CMakeLists.txt
│ ├── caffe
│ │ ├── __init__.py
│ │ ├── _caffe.cpp
│ │ ├── classifier.py
│ │ ├── coord_map.py
│ │ ├── detector.py
│ │ ├── draw.py
│ │ ├── imagenet
│ │ │ └── ilsvrc_2012_mean.npy
│ │ ├── io.py
│ │ ├── model_libs.py
│ │ ├── net_spec.py
│ │ ├── pycaffe.py
│ │ └── test
│ │ │ ├── test_coord_map.py
│ │ │ ├── test_io.py
│ │ │ ├── test_layer_type_list.py
│ │ │ ├── test_net.py
│ │ │ ├── test_net_spec.py
│ │ │ ├── test_python_layer.py
│ │ │ ├── test_python_layer_with_param_str.py
│ │ │ └── test_solver.py
│ ├── classify.py
│ ├── detect.py
│ ├── draw_net.py
│ └── requirements.txt
├── scripts
│ ├── Construct_XML_Annotations_from_COCO_JSON.py
│ ├── build_docs.sh
│ ├── convert_inception_v3.py
│ ├── copy_notebook.py
│ ├── cpp_lint.py
│ ├── create_annoset.py
│ ├── deploy_docs.sh
│ ├── download_model_binary.py
│ ├── download_model_from_gist.sh
│ ├── gather_examples.sh
│ ├── travis
│ │ ├── build.sh
│ │ ├── configure-cmake.sh
│ │ ├── configure-make.sh
│ │ ├── configure.sh
│ │ ├── defaults.sh
│ │ ├── install-deps.sh
│ │ ├── install-python-deps.sh
│ │ ├── setup-venv.sh
│ │ └── test.sh
│ └── upload_model_to_gist.sh
├── src
│ ├── caffe
│ │ ├── CMakeLists.txt
│ │ ├── blob.cpp
│ │ ├── common.cpp
│ │ ├── data_reader.cpp
│ │ ├── data_transformer.cpp
│ │ ├── internal_thread.cpp
│ │ ├── layer.cpp
│ │ ├── layer_factory.cpp
│ │ ├── layers
│ │ │ ├── absval_layer.cpp
│ │ │ ├── absval_layer.cu
│ │ │ ├── accuracy_layer.cpp
│ │ │ ├── annotated_data_layer.cpp
│ │ │ ├── argmax_layer.cpp
│ │ │ ├── base_conv_layer.cpp
│ │ │ ├── base_data_layer.cpp
│ │ │ ├── base_data_layer.cu
│ │ │ ├── batch_norm_layer.cpp
│ │ │ ├── batch_norm_layer.cu
│ │ │ ├── batch_reindex_layer.cpp
│ │ │ ├── batch_reindex_layer.cu
│ │ │ ├── bias_layer.cpp
│ │ │ ├── bias_layer.cu
│ │ │ ├── bnll_layer.cpp
│ │ │ ├── bnll_layer.cu
│ │ │ ├── concat_layer.cpp
│ │ │ ├── concat_layer.cu
│ │ │ ├── contrastive_loss_layer.cpp
│ │ │ ├── contrastive_loss_layer.cu
│ │ │ ├── conv_layer.cpp
│ │ │ ├── conv_layer.cu
│ │ │ ├── crop_layer.cpp
│ │ │ ├── crop_layer.cu
│ │ │ ├── cudnn_conv_layer.cpp
│ │ │ ├── cudnn_conv_layer.cu
│ │ │ ├── cudnn_lcn_layer.cpp
│ │ │ ├── cudnn_lcn_layer.cu
│ │ │ ├── cudnn_lrn_layer.cpp
│ │ │ ├── cudnn_lrn_layer.cu
│ │ │ ├── cudnn_pooling_layer.cpp
│ │ │ ├── cudnn_pooling_layer.cu
│ │ │ ├── cudnn_relu_layer.cpp
│ │ │ ├── cudnn_relu_layer.cu
│ │ │ ├── cudnn_sigmoid_layer.cpp
│ │ │ ├── cudnn_sigmoid_layer.cu
│ │ │ ├── cudnn_softmax_layer.cpp
│ │ │ ├── cudnn_softmax_layer.cu
│ │ │ ├── cudnn_tanh_layer.cpp
│ │ │ ├── cudnn_tanh_layer.cu
│ │ │ ├── data_layer.cpp
│ │ │ ├── deconv_layer.cpp
│ │ │ ├── deconv_layer.cu
│ │ │ ├── detection_evaluate_layer.cpp
│ │ │ ├── detection_output_layer.cpp
│ │ │ ├── detection_output_layer.cu
│ │ │ ├── dropout_layer.cpp
│ │ │ ├── dropout_layer.cu
│ │ │ ├── dummy_data_layer.cpp
│ │ │ ├── eltwise_layer.cpp
│ │ │ ├── eltwise_layer.cu
│ │ │ ├── elu_layer.cpp
│ │ │ ├── elu_layer.cu
│ │ │ ├── embed_layer.cpp
│ │ │ ├── embed_layer.cu
│ │ │ ├── euclidean_loss_layer.cpp
│ │ │ ├── euclidean_loss_layer.cu
│ │ │ ├── exp_layer.cpp
│ │ │ ├── exp_layer.cu
│ │ │ ├── filter_layer.cpp
│ │ │ ├── filter_layer.cu
│ │ │ ├── flatten_layer.cpp
│ │ │ ├── hdf5_data_layer.cpp
│ │ │ ├── hdf5_data_layer.cu
│ │ │ ├── hdf5_output_layer.cpp
│ │ │ ├── hdf5_output_layer.cu
│ │ │ ├── hinge_loss_layer.cpp
│ │ │ ├── im2col_layer.cpp
│ │ │ ├── im2col_layer.cu
│ │ │ ├── image_data_layer.cpp
│ │ │ ├── infogain_loss_layer.cpp
│ │ │ ├── inner_product_layer.cpp
│ │ │ ├── inner_product_layer.cu
│ │ │ ├── input_layer.cpp
│ │ │ ├── log_layer.cpp
│ │ │ ├── log_layer.cu
│ │ │ ├── loss_layer.cpp
│ │ │ ├── lrn_layer.cpp
│ │ │ ├── lrn_layer.cu
│ │ │ ├── lstm_layer.cpp
│ │ │ ├── lstm_unit_layer.cpp
│ │ │ ├── lstm_unit_layer.cu
│ │ │ ├── memory_data_layer.cpp
│ │ │ ├── multibox_loss_layer.cpp
│ │ │ ├── multinomial_logistic_loss_layer.cpp
│ │ │ ├── mvn_layer.cpp
│ │ │ ├── mvn_layer.cu
│ │ │ ├── neuron_layer.cpp
│ │ │ ├── normalize_layer.cpp
│ │ │ ├── normalize_layer.cu
│ │ │ ├── parameter_layer.cpp
│ │ │ ├── permute_layer.cpp
│ │ │ ├── permute_layer.cu
│ │ │ ├── pooling_layer.cpp
│ │ │ ├── pooling_layer.cu
│ │ │ ├── power_layer.cpp
│ │ │ ├── power_layer.cu
│ │ │ ├── prelu_layer.cpp
│ │ │ ├── prelu_layer.cu
│ │ │ ├── prior_box_layer.cpp
│ │ │ ├── recurrent_layer.cpp
│ │ │ ├── recurrent_layer.cu
│ │ │ ├── reduction_layer.cpp
│ │ │ ├── reduction_layer.cu
│ │ │ ├── relu_layer.cpp
│ │ │ ├── relu_layer.cu
│ │ │ ├── reshape_layer.cpp
│ │ │ ├── rnn_layer.cpp
│ │ │ ├── scale_layer.cpp
│ │ │ ├── scale_layer.cu
│ │ │ ├── sigmoid_cross_entropy_loss_layer.cpp
│ │ │ ├── sigmoid_cross_entropy_loss_layer.cu
│ │ │ ├── sigmoid_layer.cpp
│ │ │ ├── sigmoid_layer.cu
│ │ │ ├── silence_layer.cpp
│ │ │ ├── silence_layer.cu
│ │ │ ├── slice_layer.cpp
│ │ │ ├── slice_layer.cu
│ │ │ ├── smooth_L1_loss_layer.cpp
│ │ │ ├── smooth_L1_loss_layer.cu
│ │ │ ├── softmax_layer.cpp
│ │ │ ├── softmax_layer.cu
│ │ │ ├── softmax_loss_layer.cpp
│ │ │ ├── softmax_loss_layer.cu
│ │ │ ├── split_layer.cpp
│ │ │ ├── split_layer.cu
│ │ │ ├── spp_layer.cpp
│ │ │ ├── tanh_layer.cpp
│ │ │ ├── tanh_layer.cu
│ │ │ ├── threshold_layer.cpp
│ │ │ ├── threshold_layer.cu
│ │ │ ├── tile_layer.cpp
│ │ │ ├── tile_layer.cu
│ │ │ ├── video_data_layer.cpp
│ │ │ └── window_data_layer.cpp
│ │ ├── net.cpp
│ │ ├── parallel.cpp
│ │ ├── proto
│ │ │ └── caffe.proto
│ │ ├── solver.cpp
│ │ ├── solvers
│ │ │ ├── adadelta_solver.cpp
│ │ │ ├── adadelta_solver.cu
│ │ │ ├── adagrad_solver.cpp
│ │ │ ├── adagrad_solver.cu
│ │ │ ├── adam_solver.cpp
│ │ │ ├── adam_solver.cu
│ │ │ ├── nesterov_solver.cpp
│ │ │ ├── nesterov_solver.cu
│ │ │ ├── rmsprop_solver.cpp
│ │ │ ├── rmsprop_solver.cu
│ │ │ ├── sgd_solver.cpp
│ │ │ └── sgd_solver.cu
│ │ ├── syncedmem.cpp
│ │ ├── test
│ │ │ ├── CMakeLists.txt
│ │ │ ├── test_accuracy_layer.cpp
│ │ │ ├── test_annotated_data_layer.cpp
│ │ │ ├── test_argmax_layer.cpp
│ │ │ ├── test_batch_norm_layer.cpp
│ │ │ ├── test_batch_reindex_layer.cpp
│ │ │ ├── test_bbox_util.cpp
│ │ │ ├── test_benchmark.cpp
│ │ │ ├── test_bias_layer.cpp
│ │ │ ├── test_blob.cpp
│ │ │ ├── test_caffe_main.cpp
│ │ │ ├── test_common.cpp
│ │ │ ├── test_concat_layer.cpp
│ │ │ ├── test_contrastive_loss_layer.cpp
│ │ │ ├── test_convolution_layer.cpp
│ │ │ ├── test_crop_layer.cpp
│ │ │ ├── test_data
│ │ │ │ ├── generate_sample_data.py
│ │ │ │ ├── sample_data.h5
│ │ │ │ ├── sample_data_2_gzip.h5
│ │ │ │ ├── sample_data_list.txt
│ │ │ │ ├── solver_data.h5
│ │ │ │ └── solver_data_list.txt
│ │ │ ├── test_data_layer.cpp
│ │ │ ├── test_data_transformer.cpp
│ │ │ ├── test_db.cpp
│ │ │ ├── test_deconvolution_layer.cpp
│ │ │ ├── test_detection_evaluate_layer.cpp
│ │ │ ├── test_detection_output_layer.cpp
│ │ │ ├── test_dummy_data_layer.cpp
│ │ │ ├── test_eltwise_layer.cpp
│ │ │ ├── test_embed_layer.cpp
│ │ │ ├── test_euclidean_loss_layer.cpp
│ │ │ ├── test_filler.cpp
│ │ │ ├── test_filter_layer.cpp
│ │ │ ├── test_flatten_layer.cpp
│ │ │ ├── test_gradient_based_solver.cpp
│ │ │ ├── test_hdf5_output_layer.cpp
│ │ │ ├── test_hdf5data_layer.cpp
│ │ │ ├── test_hinge_loss_layer.cpp
│ │ │ ├── test_im2col_kernel.cu
│ │ │ ├── test_im2col_layer.cpp
│ │ │ ├── test_im_transforms.cpp
│ │ │ ├── test_image_data_layer.cpp
│ │ │ ├── test_infogain_loss_layer.cpp
│ │ │ ├── test_inner_product_layer.cpp
│ │ │ ├── test_internal_thread.cpp
│ │ │ ├── test_io.cpp
│ │ │ ├── test_layer_factory.cpp
│ │ │ ├── test_lrn_layer.cpp
│ │ │ ├── test_lstm_layer.cpp
│ │ │ ├── test_math_functions.cpp
│ │ │ ├── test_maxpool_dropout_layers.cpp
│ │ │ ├── test_memory_data_layer.cpp
│ │ │ ├── test_multibox_loss_layer.cpp
│ │ │ ├── test_multinomial_logistic_loss_layer.cpp
│ │ │ ├── test_mvn_layer.cpp
│ │ │ ├── test_net.cpp
│ │ │ ├── test_neuron_layer.cpp
│ │ │ ├── test_normalize_layer.cpp
│ │ │ ├── test_permute_layer.cpp
│ │ │ ├── test_platform.cpp
│ │ │ ├── test_pooling_layer.cpp
│ │ │ ├── test_power_layer.cpp
│ │ │ ├── test_prior_box_layer.cpp
│ │ │ ├── test_protobuf.cpp
│ │ │ ├── test_random_number_generator.cpp
│ │ │ ├── test_reduction_layer.cpp
│ │ │ ├── test_reshape_layer.cpp
│ │ │ ├── test_rnn_layer.cpp
│ │ │ ├── test_scale_layer.cpp
│ │ │ ├── test_sigmoid_cross_entropy_loss_layer.cpp
│ │ │ ├── test_slice_layer.cpp
│ │ │ ├── test_smooth_L1_loss_layer.cpp
│ │ │ ├── test_softmax_layer.cpp
│ │ │ ├── test_softmax_with_loss_layer.cpp
│ │ │ ├── test_solver.cpp
│ │ │ ├── test_solver_factory.cpp
│ │ │ ├── test_split_layer.cpp
│ │ │ ├── test_spp_layer.cpp
│ │ │ ├── test_stochastic_pooling.cpp
│ │ │ ├── test_syncedmem.cpp
│ │ │ ├── test_tanh_layer.cpp
│ │ │ ├── test_threshold_layer.cpp
│ │ │ ├── test_tile_layer.cpp
│ │ │ ├── test_upgrade_proto.cpp
│ │ │ └── test_util_blas.cpp
│ │ └── util
│ │ │ ├── bbox_util.cpp
│ │ │ ├── bbox_util.cu
│ │ │ ├── benchmark.cpp
│ │ │ ├── blocking_queue.cpp
│ │ │ ├── cudnn.cpp
│ │ │ ├── db.cpp
│ │ │ ├── db_leveldb.cpp
│ │ │ ├── db_lmdb.cpp
│ │ │ ├── hdf5.cpp
│ │ │ ├── im2col.cpp
│ │ │ ├── im2col.cu
│ │ │ ├── im_transforms.cpp
│ │ │ ├── insert_splits.cpp
│ │ │ ├── io.cpp
│ │ │ ├── math_functions.cpp
│ │ │ ├── math_functions.cu
│ │ │ ├── sampler.cpp
│ │ │ ├── signal_handler.cpp
│ │ │ └── upgrade_proto.cpp
│ └── gtest
│ │ ├── CMakeLists.txt
│ │ ├── gtest-all.cpp
│ │ ├── gtest.h
│ │ └── gtest_main.cc
└── tools
│ ├── CMakeLists.txt
│ ├── caffe.cpp
│ ├── compute_image_mean.cpp
│ ├── convert_annoset.cpp
│ ├── convert_imageset.cpp
│ ├── create_label_map.cpp
│ ├── device_query.cpp
│ ├── extra
│ ├── extract_seconds.py
│ ├── launch_resize_and_crop_images.sh
│ ├── parse_log.py
│ ├── parse_log.sh
│ ├── plot_log.gnuplot.example
│ ├── plot_training_log.py.example
│ ├── resize_and_crop_images.py
│ └── summarize.py
│ ├── extract_features.cpp
│ ├── finetune_net.cpp
│ ├── get_image_size.cpp
│ ├── net_speed_benchmark.cpp
│ ├── test_net.cpp
│ ├── train_net.cpp
│ ├── upgrade_net_proto_binary.cpp
│ ├── upgrade_net_proto_text.cpp
│ └── upgrade_solver_proto_text.cpp
├── example
├── deploy.caffemodel
├── deploy.prototxt
└── tf_wave
│ ├── wave.ckpt.data-00000-of-00001
│ ├── wave.ckpt.index
│ └── wave.ckpt.meta
├── mvNCCheck.py
├── mvNCCompile.py
└── mvNCProfile.py
/README.zh_CN.md:
--------------------------------------------------------------------------------
1 |
7 |
8 | 
9 |
10 | # SungemSDK-Python
11 |
12 | [SungemSDK] | [文档中心][Documentation]
13 |
14 | ## 安装说明
15 |
16 | 通过如下命令获取项目:
17 |
18 | ```bash
19 | git clone https://github.com/HornedSungem/SungemSDK-Python.git
20 | ```
21 |
22 | 进入 `installer` 文件夹,找到和您的操作系统对应的安装脚本,执行安装。
23 |
24 | ```bash
25 | # 以 Ubuntu 为例
26 | cd installer/Linux/Ubuntu
27 | ./install.sh
28 | ```
29 |
30 | ## 开始使用
31 |
32 | 本项目为 `Python` 开发者提供了API和一些示例程序。
33 |
34 | ### 示例程序
35 |
36 | 在运行示例程序之前,需要从 [SungemSDK-GraphModels][] 下载需要的文件,并拷贝至本项目对应的文件夹下。
37 |
38 | ```
39 | SungemSDK-GraphModels/graphs -> examples/graphs
40 | SungemSDK-GraphModels/misc -> examples/misc
41 | ```
42 |
43 | 之后就可以运行示例程序了。
44 |
45 | ```bash
46 | # 以 FaceDetector 为例
47 | cd examples/apps/FaceDetector
48 | python3 FaceDetector.py
49 | ```
50 |
51 | ## 联系我们
52 |
53 | 如果你需要帮助,欢迎在 [GitHub Issues][] 给我们提问,或者通过邮件(support@hornedsungem.org)与我们进行沟通。
54 |
55 | 如有任何建议、模型需求或希望加入我们也欢迎和我们联系。
56 |
57 |
58 | [GitHub Issues]: https://github.com/HornedSungem/SungemSDK-Python/issues
59 | [SungemSDK]: https://github.com/HornedSungem/SungemSDK
60 | [Documentation]: https://hornedsungem.github.io/Docs
61 | [SungemSDK-GraphModels]: https://github.com/HornedSungem/SungemSDK-GraphModels
--------------------------------------------------------------------------------
/SungemSDK/.gitignore:
--------------------------------------------------------------------------------
1 | # ********** Custom gitignore **********
2 |
3 | # ********** macOS.gitignore **********
4 |
5 | # General
6 | .DS_Store
7 | .AppleDouble
8 | .LSOverride
9 |
10 | # Icon must end with two \r
11 | Icon
12 |
13 |
14 | # Thumbnails
15 | ._*
16 |
17 | # Files that might appear in the root of a volume
18 | .DocumentRevisions-V100
19 | .fseventsd
20 | .Spotlight-V100
21 | .TemporaryItems
22 | .Trashes
23 | .VolumeIcon.icns
24 | .com.apple.timemachine.donotpresent
25 |
26 | # Directories potentially created on remote AFP share
27 | .AppleDB
28 | .AppleDesktop
29 | Network Trash Folder
30 | Temporary Items
31 | .apdisk
--------------------------------------------------------------------------------
/SungemSDK/README.md:
--------------------------------------------------------------------------------
1 | > *Senscape Technologies* is authorized by *Horned Sungem Foundation*.
2 |
3 |
4 |
5 |
6 |
7 |
8 | Horned Sungem
9 | Plug and AI
10 |
11 |
12 |
13 | 
14 | [](https://github.com/HornedSungem/SungemSDK/blob/master/LICENSE)
15 |
16 | # SungemSDK
17 |
18 | [Documentation] | [简体中文](README.zh_CN.md)
19 |
20 | ## Installation Guide
21 |
22 | Supported Platforms:
23 |
24 | - Linux
25 | - macOS
26 |
27 | Supported Architecture:
28 |
29 | - i386 / i586 / i686 / x86_64
30 | - armv6l / armv7l / aarch64
31 |
32 | The running environment of `SungemSDK` is configured by running the following commands in your terminal:
33 |
34 | - For Linux:
35 |
36 | ```
37 | cd installer/Linux && ./install.sh
38 | ```
39 |
40 | - For macOS:
41 |
42 | ```
43 | cd installer/macOS && ./install.sh
44 | ```
45 |
46 | ## [Getting Started][Documentation]
47 |
48 | ## Support
49 |
50 | If you need any help, please post us an issue on [GitHub Issues][] or send us an email (support@hornedsungem.org).
51 |
52 | You are welcome to contact us for your suggestions, and model request.
53 |
54 |
55 | [GitHub Issues]: https://github.com/HornedSungem/SungemSDK/issues
56 | [Documentation]: https://hornedsungem.github.io/Docs
--------------------------------------------------------------------------------
/SungemSDK/README.zh_CN.md:
--------------------------------------------------------------------------------
1 | > *触景无限科技(北京)有限公司* 已取得 *角蜂鸟基金会* 授权.
2 |
3 |
4 |
5 |
6 |
7 |
8 | Horned Sungem
9 | Plug and AI
10 |
11 |
12 |
13 | 
14 | [](https://github.com/HornedSungem/SungemSDK/blob/master/LICENSE)
15 |
16 | # SungemSDK
17 |
18 | [文档中心][Documentation]
19 |
20 | ## 安装说明
21 |
22 | 支持的平台:
23 |
24 | - Linux
25 | - macOS
26 |
27 | 支持的架构:
28 |
29 | - i386 / i586 / i686 / x86_64
30 | - armv6l / armv7l / aarch64
31 |
32 | 在终端运行如下命令来配置 `SungemSDK` 的运行环境:
33 |
34 | - Linux:
35 |
36 | ```
37 | cd installer/Linux && ./install.sh
38 | ```
39 |
40 | - macOS:
41 |
42 | ```
43 | cd installer/macOS && ./install.sh
44 | ```
45 |
46 | ## [开始使用][Documentation]
47 |
48 | ## 联系我们
49 |
50 | 如果你需要帮助,欢迎在 [GitHub Issues][] 给我们提问,或者通过邮件(support@hornedsungem.org)与我们进行沟通。
51 |
52 | 如有任何建议、模型需求或希望加入我们也欢迎和我们联系。
53 |
54 |
55 | [GitHub Issues]: https://github.com/HornedSungem/SungemSDK/issues
56 | [Documentation]: https://hornedsungem.github.io/Docs
--------------------------------------------------------------------------------
/SungemSDK/installer/99-hornedsungem.rules:
--------------------------------------------------------------------------------
1 | SUBSYSTEM=="usb", ATTRS{idProduct}=="8868", ATTRS{idVendor}=="1337", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
2 | SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
3 |
--------------------------------------------------------------------------------
/SungemSDK/installer/Linux/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | #----------------------------------------
8 |
9 | script_path=$(cd `dirname $0`; pwd)
10 |
11 | sudo cp $script_path/../99-hornedsungem.rules /etc/udev/rules.d/
12 | sudo chmod a+x /etc/udev/rules.d/99-hornedsungem.rules
13 | sudo udevadm control --reload
14 | sudo udevadm trigger
15 |
16 | #----------------------------------------
17 |
18 | echo "****** INSTALLATION COMPLETE ******"
--------------------------------------------------------------------------------
/SungemSDK/installer/macOS/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | #----------------------------------------
8 |
9 | which -s brew
10 | if [[ $? != 0 ]] ; then
11 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
12 | fi
13 |
14 | #----------------------------------------
15 |
16 | brew update
17 | brew install libusb
18 |
19 | #----------------------------------------
20 |
21 | echo "****** INSTALLATION COMPLETE ******"
22 |
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/aarch64/libhs.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/lib/linux/aarch64/libhs.so
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/armv6l/libhs.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/lib/linux/armv6l/libhs.so
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/armv7l:
--------------------------------------------------------------------------------
1 | armv6l
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/i386:
--------------------------------------------------------------------------------
1 | i686
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/i586:
--------------------------------------------------------------------------------
1 | i686
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/i686/libhs.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/lib/linux/i686/libhs.so
--------------------------------------------------------------------------------
/SungemSDK/lib/linux/x86_64/libhs.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/lib/linux/x86_64/libhs.so
--------------------------------------------------------------------------------
/SungemSDK/lib/macos/libhs.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/lib/macos/libhs.dylib
--------------------------------------------------------------------------------
/SungemSDK/logo/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/SungemSDK/logo/logo.png
--------------------------------------------------------------------------------
/examples/apps/FaceDetector/FaceDetector.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import numpy as np, cv2, sys
8 | sys.path.append('../../../')
9 | from hsapi import FaceDetector
10 |
11 | WEBCAM = False # Set to True if use Webcam
12 | net = FaceDetector(zoom = True, verbose = 2, thresh=0.55)
13 | if WEBCAM: video_capture = cv2.VideoCapture(0)
14 |
15 | try:
16 | while True:
17 | if WEBCAM: _, img = video_capture.read()
18 | else: img = None
19 | result = net.run(img)
20 | img = net.plot(result)
21 | cv2.imshow("Face Detector", img)
22 | cv2.waitKey(1)
23 | finally:
24 | net.quit()
25 |
--------------------------------------------------------------------------------
/examples/apps/GetImage/GetImage.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | # Import libs
8 | import cv2, sys, numpy as np
9 | sys.path.append('../../../')
10 | import hsapi as hs
11 |
12 | device = hs.GetDevice()
13 | device.OpenDevice()
14 |
15 | try:
16 | while(1):
17 | image = device.GetImage(False)
18 | cv2.imshow('image',image)
19 | cv2.waitKey(1)
20 | finally:
21 | device.CloseDevice()
22 |
--------------------------------------------------------------------------------
/examples/apps/Hello2018/Hello2018.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | # Import libs
8 | import cv2, sys, numpy as np
9 | sys.path.append('../../../')
10 | import hsapi as hs
11 |
12 | # Load CNN to device and set scale / mean
13 | net = hs.Mnist()
14 | imgRoot = '../../misc/2018_mnist/%d.jpg'
15 |
16 | print('Hello')
17 | for n in [1,2,3,4]:
18 | imgname = imgRoot % n
19 | img = cv2.imread(imgname)
20 | result = net.run(img)
21 | print(result[1])
22 |
23 | net.quit()
24 |
--------------------------------------------------------------------------------
/examples/apps/MT_FaceDetector/MT_FaceDetector.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import cv2, sys
8 | sys.path.append('../../../')
9 | import hsapi as hs
10 |
11 | net = hs.FaceDetectorPlus(zoom=True, verbose=0, thresh=0.5)
12 | st = hs.SingleTask(net, useWebcam=True)
13 |
14 | try:
15 | while(1):
16 | ret = st.res_queue.get()
17 |
18 | # Get face images for further processing
19 | crops, info = net.crop(ret)
20 | if len(crops) > 0 and ret[2] is True:
21 | # Display first face info/image as example
22 | print(info)
23 | try:
24 | cv2.imshow('A Face', crops[0])
25 | except:
26 | pass
27 |
28 | img = net.plot(ret)
29 | cv2.imshow("Face Detector", img)
30 | cv2.waitKey(25)
31 | except Exception as error:
32 | print(error)
33 | finally:
34 | st.stop()
35 |
--------------------------------------------------------------------------------
/examples/apps/MT_SceneRecorder/MT_SceneRecorder.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import cv2, sys
8 | sys.path.append('../../../')
9 | import hsapi as hs
10 |
11 | net = hs.SceneRecorder(zoom=True, verbose=1, thresh=0.5)
12 | st = hs.SingleTask(net, useWebcam=True)
13 |
14 | try:
15 | while True:
16 | result = st.res_queue.get()
17 | key = cv2.waitKey(30)
18 | if key == 255:
19 | key = -1
20 | if result[2] is True:
21 | prob = net.record(result, key, saveFilename='../../misc/record.dat', numBin = 5)
22 |
23 | if prob is not None:
24 | cv2.putText(result[0], '%d' % (prob.argmax() + 1), (50,50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,255,0), 7)
25 | cv2.putText(result[0], '%d' % (prob.argmax() + 1), (50,50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,255,255), 3)
26 | if key != -1 and chr(key).isdigit():
27 | cv2.putText(result[0], 'Rec: %d' % int(chr(key)), (30,50), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0,0,255), 5)
28 | cv2.rectangle(result[0], (0,0), result[0].shape[1::-1], (0,0,255), 25)
29 | cv2.imshow("Scene Recorder", result[0])
30 | finally:
31 | st.stop()
32 |
33 |
--------------------------------------------------------------------------------
/examples/apps/ObjectDetector/ObjectDetector.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import numpy as np, cv2, sys
8 | sys.path.append('../../../')
9 | from hsapi import ObjectDetector
10 |
11 | WEBCAM = False # Set to True if use Webcam
12 | net = ObjectDetector(zoom = True, verbose = 2)
13 | if WEBCAM: video_capture = cv2.VideoCapture(0)
14 |
15 | try:
16 | while True:
17 | if WEBCAM: _, img = video_capture.read()
18 | else: img = None
19 | result = net.run(img)
20 | img = net.plot(result)
21 | cv2.imshow("20 VOC Object Detector", img)
22 | cv2.waitKey(1)
23 | finally:
24 | net.quit()
25 |
--------------------------------------------------------------------------------
/examples/apps/SceneRecorder/SceneRecorder.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import cv2, sys
8 | sys.path.append('../../../')
9 | from hsapi import SceneRecorder
10 |
11 | WEBCAM = False # Set to True if use Webcam
12 |
13 | net = SceneRecorder(zoom = True, verbose = 2)
14 | if WEBCAM: video_capture = cv2.VideoCapture(0)
15 |
16 | try:
17 | while True:
18 | if WEBCAM: _, img = video_capture.read()
19 | else: img = None
20 |
21 | # Get image descriptor
22 | result = net.run(img)
23 | key = cv2.waitKey(5)
24 | if key == 255:
25 | key = -1
26 | prob = net.record(result, key, saveFilename='../../misc/record.dat', numBin = 5)
27 |
28 | if prob is not None:
29 | cv2.putText(result[0], '%d' % (prob.argmax() + 1), (50,50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,255,0), 7)
30 | cv2.putText(result[0], '%d' % (prob.argmax() + 1), (50,50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,255,255), 3)
31 | if key != -1 and chr(key).isdigit():
32 | cv2.putText(result[0], 'Rec: %d' % int(chr(key)), (30,50), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0,0,255), 5)
33 | cv2.rectangle(result[0], (0,0), result[0].shape[1::-1], (0,0,255), 25)
34 | cv2.imshow("Scene Recorder", result[0])
35 | cv2.waitKey(1)
36 | finally:
37 | net.quit()
38 |
--------------------------------------------------------------------------------
/examples/apps/TEST_MultiModelity/TEST_MultiModelity.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import numpy as np, cv2, sys
8 | sys.path.append('../../../')
9 | import hsapi as hs
10 |
11 |
12 | WEBCAM = False # Set to True if use Webcam
13 | net = hs.FaceDetector(zoom = True, verbose = 2, thresh=0.55)
14 | net2 = hs.ObjectDetector(device=net.device, zoom = True, verbose = 2, thresh=0.55)
15 | if WEBCAM: video_capture = cv2.VideoCapture(0)
16 |
17 | try:
18 | while True:
19 | if WEBCAM: _, img = video_capture.read()
20 | else: img = None
21 | result = net.run(img)
22 | img = result[0]
23 | result2 = net2.run(img)
24 |
25 | img = net.overlay(img, result[1])
26 | img = net2.overlay(img, result2[1])
27 |
28 | cv2.imshow("Face/Obj Detector", img)
29 | cv2.waitKey(1)
30 | finally:
31 | net.quit()
32 |
--------------------------------------------------------------------------------
/examples/apps/age_gender/age_gender.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import numpy, cv2, sys
8 | sys.path.append('../../../')
9 | import hsapi as hs
10 |
11 | WEBCAM = False # Set to True if use Webcam
12 |
13 |
14 | gender_list = ['Male', 'Famale']
15 | age_list = ['0-2','4-6','8-12','15-20','25-32','38-43','48-53','60-100']
16 |
17 |
18 | fc_net = hs.FaceDetector(zoom = True, verbose = 2, thresh=0.55)
19 | age_net = hs.AgeDetector(device=fc_net.device)
20 | genfer_net = hs.GenderDetector(device=fc_net.device)
21 |
22 | if WEBCAM: video_capture = cv2.VideoCapture(0)
23 |
24 | try:
25 | while True:
26 | if WEBCAM: _, img = video_capture.read()
27 | else: img = None
28 | result = fc_net.run(img)
29 | img = fc_net.plot(result)
30 | for i in range(len(result[1])):
31 | image = result[0]
32 | face = image[int(result[1][i][3]):int(result[1][i][5]), int(result[1][i][2]):int(result[1][i][4]), :]
33 | out_age = age_net.run(face)[1]
34 | age_cls = numpy.argmax(out_age)
35 | age_out = age_list[age_cls]
36 | cv2.putText(image, age_out, (int(result[1][i][2]), int(result[1][i][3])), cv2.FONT_HERSHEY_SIMPLEX,1.0, (0, 255, 255), 2)
37 | out_gender = genfer_net.run(face)[1]
38 | gender_cls = numpy.argmax(out_gender)
39 | gender_out = gender_list[gender_cls]
40 | cv2.putText(image, gender_out, (int(result[1][i][2]), int(result[1][i][3]-30)), cv2.FONT_HERSHEY_SIMPLEX, 1.0,(0, 255, 255), 2)
41 | cv2.imshow("Face Detector", img)
42 | cv2.waitKey(1)
43 | finally:
44 | fc_net.quit()
--------------------------------------------------------------------------------
/examples/apps/birds/images/Eagles-2_Rebecca.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/Eagles-2_Rebecca.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/jas_birds_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/jas_birds_10.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/jas_birds_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/jas_birds_2.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/jas_birds_8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/jas_birds_8.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/nps_birds_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/nps_birds_1.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/nps_birds_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/nps_birds_2.jpg
--------------------------------------------------------------------------------
/examples/apps/birds/images/nps_birds_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/examples/apps/birds/images/nps_birds_3.jpg
--------------------------------------------------------------------------------
/examples/graphs/README.md:
--------------------------------------------------------------------------------
1 | Copies the files from [SungemSDK-GraphModels][]/graphs.
2 |
3 | [SungemSDK-GraphModels]: https://github.com/HornedSungem/SungemSDK-GraphModels
--------------------------------------------------------------------------------
/examples/misc/README.md:
--------------------------------------------------------------------------------
1 | Copies the files from [SungemSDK-GraphModels][]/misc.
2 |
3 | [SungemSDK-GraphModels]: https://github.com/HornedSungem/SungemSDK-GraphModels
--------------------------------------------------------------------------------
/hsapi/__init__.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # Copyright(c) 2018 Senscape Corporation.
4 | # License: Apache 2.0
5 |
6 | from .core import *
7 | from .high import *
8 | from .easy import *
--------------------------------------------------------------------------------
/hsapi/core/__init__.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # Copyright(c) 2018 Senscape Corporation.
4 | # License: Apache 2.0
5 |
6 | from .base import *
7 | from .device import *
8 | from .graph import *
--------------------------------------------------------------------------------
/hsapi/easy/__init__.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # Copyright(c) 2018 Senscape Corporation.
4 | # License: Apache 2.0
5 |
6 | from .prefab import *
7 |
--------------------------------------------------------------------------------
/hsapi/high/__init__.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 |
3 | # Copyright(c) 2018 Senscape Corporation.
4 | # License: Apache 2.0
5 |
6 | from .net import *
7 | from .task import *
8 |
--------------------------------------------------------------------------------
/hsapi/upgrade/upgrade.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright(c) 2018 Senscape Corporation.
5 | # License: Apache 2.0
6 |
7 | import sys
8 | import getopt
9 | sys.path.append('..')
10 | import core as hs
11 |
12 |
13 | def _upgrade(file_path):
14 | device_names = hs.EnumerateDevices()
15 | if len(device_names) < 1:
16 | print("Error - No HS devices found.")
17 | hs.BootUpdateApp(file_path)
18 | quit()
19 |
20 | device = hs.Device(device_names[0])
21 | try:
22 | device.OpenDevice()
23 | except:
24 | print("Error - Cound not open HS device.")
25 | quit()
26 |
27 | print("HS Device opened normally.")
28 |
29 | try:
30 | device.UpdateApp(file_path)
31 | except:
32 | print("Error - Cound not upgrade HS device.")
33 | quit()
34 |
35 | print("Device upgrade successful.")
36 |
37 |
38 | if __name__=="__main__":
39 | print("Firmware Upgrade")
40 |
41 | def usage():
42 | print("usage: %s -f " % __file__)
43 |
44 | opts, args = getopt.getopt(sys.argv[1:], "f:", ["file="])
45 | elf_file = None
46 |
47 | for opt, arg in opts:
48 | if opt in ("-f", "--file"):
49 | elf_file = arg
50 |
51 | if elf_file is None:
52 | usage()
53 | sys.exit()
54 |
55 | sys.exit(_upgrade(elf_file))
56 |
--------------------------------------------------------------------------------
/installer/Linux/CentOS/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | script_path=$(cd `dirname $0`; pwd)
8 |
9 | #----------------------------------------
10 |
11 | sudo yum install -y epel-release
12 | sudo yum update -y && sudo yum upgrade -y
13 | sudo yum install -y gcc-c++
14 | sudo yum install -y python34 python34-pip python34-devel
15 |
16 | #----------------------------------------
17 |
18 | if [ "$1" = "tuna" ] ; then
19 | echo "Using TUNA mirror"
20 | INDEX_URL="-i https://pypi.tuna.tsinghua.edu.cn/simple"
21 | fi
22 |
23 | sudo -H python3 -m pip install $INDEX_URL -r $script_path/../../requirements_pip.txt
24 |
25 | #----------------------------------------
26 |
27 | bash $script_path/../../../SungemSDK/installer/Linux/install.sh >/dev/null
28 |
29 | #----------------------------------------
30 |
31 | echo "****** INSTALLATION COMPLETE ******"
32 |
--------------------------------------------------------------------------------
/installer/Linux/Fedora/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | script_path=$(cd `dirname $0`; pwd)
8 |
9 | #----------------------------------------
10 |
11 | sudo dnf update -y && sudo dnf upgrade -y
12 | sudo dnf install -y redhat-rpm-config gcc-c++
13 | sudo dnf install -y python3-pip python3-devel
14 |
15 | #----------------------------------------
16 |
17 | if [ "$1" = "tuna" ] ; then
18 | echo "Using TUNA mirror"
19 | INDEX_URL="-i https://pypi.tuna.tsinghua.edu.cn/simple"
20 | fi
21 |
22 | sudo -H python3 -m pip install $INDEX_URL -r $script_path/../../requirements_pip.txt
23 |
24 | #----------------------------------------
25 |
26 | bash $script_path/../../../SungemSDK/installer/Linux/install.sh >/dev/null
27 |
28 | #----------------------------------------
29 |
30 | echo "****** INSTALLATION COMPLETE ******"
--------------------------------------------------------------------------------
/installer/Linux/Raspbian/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | script_path=$(cd `dirname $0`; pwd)
8 |
9 | #----------------------------------------
10 |
11 | sudo apt update -y && sudo apt upgrade -y
12 | sudo apt install -y build-essential pkg-config
13 | sudo apt install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
14 | sudo apt install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
15 | sudo apt install -y libxvidcore-dev libx264-dev
16 | sudo apt install -y libgtk2.0-dev libgtk-3-dev
17 | sudo apt install -y libatlas-base-dev gfortran
18 | sudo apt install -y libhdf5-dev libqtgui4 libqt4-test
19 | sudo apt install -y python3-pip
20 |
21 | #----------------------------------------
22 |
23 | if [ "$1" = "tuna" ] ; then
24 | echo "Using TUNA mirror"
25 | INDEX_URL="-i https://pypi.tuna.tsinghua.edu.cn/simple"
26 | fi
27 |
28 | sudo -H python3 -m pip install $INDEX_URL -r $script_path/../../requirements_pip.txt
29 |
30 | #----------------------------------------
31 |
32 | bash $script_path/../../../SungemSDK/installer/Linux/install.sh >/dev/null
33 |
34 | #----------------------------------------
35 |
36 | echo "****** INSTALLATION COMPLETE ******"
--------------------------------------------------------------------------------
/installer/Linux/Ubuntu/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | script_path=$(cd `dirname $0`; pwd)
8 |
9 | #----------------------------------------
10 |
11 | sudo apt update -y && sudo apt upgrade -y
12 | sudo apt install -y python3-pip
13 |
14 | #----------------------------------------
15 |
16 | if [[ `lsb_release -rs` == "14.04" ]] ; then
17 | sudo -H python3 -m pip install --upgrade pip
18 | fi
19 |
20 | if [ "$1" = "tuna" ] ; then
21 | echo "Using TUNA mirror"
22 | INDEX_URL="-i https://pypi.tuna.tsinghua.edu.cn/simple"
23 | fi
24 |
25 | sudo -H python3 -m pip install $INDEX_URL -r $script_path/../../requirements_pip.txt
26 |
27 | #----------------------------------------
28 |
29 | bash $script_path/../../../SungemSDK/installer/Linux/install.sh >/dev/null
30 |
31 | #----------------------------------------
32 |
33 | echo "****** INSTALLATION COMPLETE ******"
--------------------------------------------------------------------------------
/installer/macOS/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "****** INSTALLATION START ******"
6 |
7 | script_path=$(cd `dirname $0`; pwd)
8 |
9 | #----------------------------------------
10 |
11 | bash $script_path/../../SungemSDK/installer/macOS/install.sh >/dev/null
12 |
13 | #----------------------------------------
14 |
15 | if [ "$1" = "tuna" ] ; then
16 | echo "Using TUNA mirror"
17 | INDEX_URL="-i https://pypi.tuna.tsinghua.edu.cn/simple"
18 | fi
19 |
20 | pip3 install $INDEX_URL -r $script_path/../requirements_pip.txt
21 |
22 | #----------------------------------------
23 |
24 | echo "****** INSTALLATION COMPLETE ******"
25 |
--------------------------------------------------------------------------------
/installer/requirements_pip.txt:
--------------------------------------------------------------------------------
1 | numpy>=1.13.0
2 | opencv-python
3 | opencv-contrib-python
4 | annoy
--------------------------------------------------------------------------------
/tool/README.md:
--------------------------------------------------------------------------------
1 | Setup:
2 |
3 | 1. Install pip dependencies, graphviz, pyyaml...
4 |
5 | - if graphviz systems path error
6 | - ubuntu: `sudo apt install graphviz`
7 | - macos: `brew install graphviz`
8 |
9 | 2. caffe -> make, make pycaffe (python3, CPU ver)
10 |
11 | - If libboost error
12 | ```bash
13 | cd /usr/lib/x86_64-linux-gnu
14 | sudo ln -s libboost_python-py35.so libboost_python3.so
15 | ```
16 |
17 | Run:
18 |
19 | ```bash
20 | python3 mvNCCompile.py example/deploy.prototxt
21 | python3 mvNCProfile.py example/deploy.prototxt
22 | python3 mvNCCheck.py example/deploy.prototxt
23 | ```
24 |
25 | ---
26 |
27 | For more information please visit [Documentation](https://hornedsungem.github.io/Docs/conversion)
28 |
--------------------------------------------------------------------------------
/tool/caffe/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Please use the [caffe-users list](https://groups.google.com/forum/#!forum/caffe-users) for usage, installation, or modeling questions, or other requests for help.
2 | _Do not post such requests to Issues._ Doing so interferes with the development of Caffe.
3 |
4 | Please read the [guidelines for contributing](https://github.com/BVLC/caffe/blob/master/CONTRIBUTING.md) before submitting this issue.
5 |
6 | ### Issue summary
7 |
8 |
9 | ### Steps to reproduce
10 |
11 | If you are having difficulty building Caffe or training a model, please ask the caffe-users mailing list. If you are reporting a build error that seems to be due to a bug in Caffe, please attach your build configuration (either Makefile.config or CMakeCache.txt) and the output of the make (or cmake) command.
12 |
13 | ### Your system configuration
14 | Operating system:
15 | Compiler:
16 | CUDA version (if applicable):
17 | CUDNN version (if applicable):
18 | BLAS:
19 | Python or MATLAB version (for pycaffe and matcaffe respectively):
20 |
--------------------------------------------------------------------------------
/tool/caffe/.gitignore:
--------------------------------------------------------------------------------
1 | ## General
2 |
3 | # Compiled Object files
4 | *.slo
5 | *.lo
6 | *.o
7 | *.cuo
8 |
9 | # Compiled Dynamic libraries
10 | *.so
11 | *.dylib
12 |
13 | # Compiled Static libraries
14 | *.lai
15 | *.la
16 | *.a
17 |
18 | # Compiled protocol buffers
19 | *.pb.h
20 | *.pb.cc
21 | *_pb2.py
22 |
23 | # Compiled python
24 | *.pyc
25 |
26 | # Compiled MATLAB
27 | *.mex*
28 |
29 | # IPython notebook checkpoints
30 | .ipynb_checkpoints
31 |
32 | # Editor temporaries
33 | *.swp
34 | *~
35 |
36 | # Sublime Text settings
37 | *.sublime-workspace
38 | *.sublime-project
39 |
40 | # Eclipse Project settings
41 | *.*project
42 | .settings
43 |
44 | # QtCreator files
45 | *.user
46 |
47 | # PyCharm files
48 | .idea
49 |
50 | # Visual Studio Code files
51 | .vscode
52 |
53 | # OSX dir files
54 | .DS_Store
55 |
56 | ## Caffe
57 |
58 | # User's build configuration
59 | Makefile.config
60 |
61 | # Data and models are either
62 | # 1. reference, and not casually committed
63 | # 2. custom, and live on their own unless they're deliberated contributed
64 | data/*
65 | models/*
66 | *.caffemodel
67 | *.caffemodel.h5
68 | *.solverstate
69 | *.solverstate.h5
70 | *.binaryproto
71 | *leveldb
72 | *lmdb
73 |
74 | # build, distribute, and bins (+ python proto bindings)
75 | build
76 | .build_debug/*
77 | .build_release/*
78 | distribute/*
79 | *.testbin
80 | *.bin
81 | python/caffe/proto/
82 | cmake_build
83 | .cmake_build
84 |
85 | # Generated documentation
86 | docs/_site
87 | docs/gathered
88 | _site
89 | doxygen
90 | docs/dev
91 |
92 | # LevelDB files
93 | *.sst
94 | *.ldb
95 | LOCK
96 | LOG*
97 | CURRENT
98 | MANIFEST-*
99 |
100 | # temporary directories
101 | jobs
102 | temp
103 | examples/*/*lmdb
104 |
--------------------------------------------------------------------------------
/tool/caffe/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 | # Contributors
2 |
3 | Caffe is developed by a core set of BVLC members and the open-source community.
4 |
5 | We thank all of our [contributors](https://github.com/BVLC/caffe/graphs/contributors)!
6 |
7 | **For the detailed history of contributions** of a given file, try
8 |
9 | git blame file
10 |
11 | to see line-by-line credits and
12 |
13 | git log --follow file
14 |
15 | to see the change log even across renames and rewrites.
16 |
17 | Please refer to the [acknowledgements](http://caffe.berkeleyvision.org/#acknowledgements) on the Caffe site for further details.
18 |
19 | **Copyright** is held by the original contributor according to the versioning history; see LICENSE.
20 |
--------------------------------------------------------------------------------
/tool/caffe/INSTALL.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | See http://caffe.berkeleyvision.org/installation.html for the latest
4 | installation instructions.
5 |
6 | Check the users group in case you need help:
7 | https://groups.google.com/forum/#!forum/caffe-users
8 |
--------------------------------------------------------------------------------
/tool/caffe/caffe.cloc:
--------------------------------------------------------------------------------
1 | Bourne Shell
2 | filter remove_matches ^\s*#
3 | filter remove_inline #.*$
4 | extension sh
5 | script_exe sh
6 | C
7 | filter remove_matches ^\s*//
8 | filter call_regexp_common C
9 | filter remove_inline //.*$
10 | extension c
11 | extension ec
12 | extension pgc
13 | C++
14 | filter remove_matches ^\s*//
15 | filter remove_inline //.*$
16 | filter call_regexp_common C
17 | extension C
18 | extension cc
19 | extension cpp
20 | extension cxx
21 | extension pcc
22 | C/C++ Header
23 | filter remove_matches ^\s*//
24 | filter call_regexp_common C
25 | filter remove_inline //.*$
26 | extension H
27 | extension h
28 | extension hh
29 | extension hpp
30 | CUDA
31 | filter remove_matches ^\s*//
32 | filter remove_inline //.*$
33 | filter call_regexp_common C
34 | extension cu
35 | Python
36 | filter remove_matches ^\s*#
37 | filter docstring_to_C
38 | filter call_regexp_common C
39 | filter remove_inline #.*$
40 | extension py
41 | make
42 | filter remove_matches ^\s*#
43 | filter remove_inline #.*$
44 | extension Gnumakefile
45 | extension Makefile
46 | extension am
47 | extension gnumakefile
48 | extension makefile
49 | filename Gnumakefile
50 | filename Makefile
51 | filename gnumakefile
52 | filename makefile
53 | script_exe make
54 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindAtlas.cmake:
--------------------------------------------------------------------------------
1 | # Find the Atlas (and Lapack) libraries
2 | #
3 | # The following variables are optionally searched for defaults
4 | # Atlas_ROOT_DIR: Base directory where all Atlas components are found
5 | #
6 | # The following are set after configuration is done:
7 | # Atlas_FOUND
8 | # Atlas_INCLUDE_DIRS
9 | # Atlas_LIBRARIES
10 | # Atlas_LIBRARYRARY_DIRS
11 |
12 | set(Atlas_INCLUDE_SEARCH_PATHS
13 | /usr/include/atlas
14 | /usr/include/atlas-base
15 | $ENV{Atlas_ROOT_DIR}
16 | $ENV{Atlas_ROOT_DIR}/include
17 | )
18 |
19 | set(Atlas_LIB_SEARCH_PATHS
20 | /usr/lib/atlas
21 | /usr/lib/atlas-base
22 | $ENV{Atlas_ROOT_DIR}
23 | $ENV{Atlas_ROOT_DIR}/lib
24 | )
25 |
26 | find_path(Atlas_CBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
27 | find_path(Atlas_CLAPACK_INCLUDE_DIR NAMES clapack.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
28 |
29 | find_library(Atlas_CBLAS_LIBRARY NAMES ptcblas_r ptcblas cblas_r cblas PATHS ${Atlas_LIB_SEARCH_PATHS})
30 | find_library(Atlas_BLAS_LIBRARY NAMES atlas_r atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
31 | find_library(Atlas_LAPACK_LIBRARY NAMES lapack alapack_r alapack lapack_atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
32 |
33 | set(LOOKED_FOR
34 | Atlas_CBLAS_INCLUDE_DIR
35 | Atlas_CLAPACK_INCLUDE_DIR
36 |
37 | Atlas_CBLAS_LIBRARY
38 | Atlas_BLAS_LIBRARY
39 | Atlas_LAPACK_LIBRARY
40 | )
41 |
42 | include(FindPackageHandleStandardArgs)
43 | find_package_handle_standard_args(Atlas DEFAULT_MSG ${LOOKED_FOR})
44 |
45 | if(ATLAS_FOUND)
46 | set(Atlas_INCLUDE_DIR ${Atlas_CBLAS_INCLUDE_DIR} ${Atlas_CLAPACK_INCLUDE_DIR})
47 | set(Atlas_LIBRARIES ${Atlas_LAPACK_LIBRARY} ${Atlas_CBLAS_LIBRARY} ${Atlas_BLAS_LIBRARY})
48 | mark_as_advanced(${LOOKED_FOR})
49 |
50 | message(STATUS "Found Atlas (include: ${Atlas_CBLAS_INCLUDE_DIR}, library: ${Atlas_BLAS_LIBRARY})")
51 | endif(ATLAS_FOUND)
52 |
53 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindGFlags.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find GFLAGS
2 | #
3 | # The following variables are optionally searched for defaults
4 | # GFLAGS_ROOT_DIR: Base directory where all GFLAGS components are found
5 | #
6 | # The following are set after configuration is done:
7 | # GFLAGS_FOUND
8 | # GFLAGS_INCLUDE_DIRS
9 | # GFLAGS_LIBRARIES
10 | # GFLAGS_LIBRARYRARY_DIRS
11 |
12 | include(FindPackageHandleStandardArgs)
13 |
14 | set(GFLAGS_ROOT_DIR "" CACHE PATH "Folder contains Gflags")
15 |
16 | # We are testing only a couple of files in the include directories
17 | if(WIN32)
18 | find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
19 | PATHS ${GFLAGS_ROOT_DIR}/src/windows)
20 | else()
21 | find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
22 | PATHS ${GFLAGS_ROOT_DIR})
23 | endif()
24 |
25 | if(MSVC)
26 | find_library(GFLAGS_LIBRARY_RELEASE
27 | NAMES libgflags
28 | PATHS ${GFLAGS_ROOT_DIR}
29 | PATH_SUFFIXES Release)
30 |
31 | find_library(GFLAGS_LIBRARY_DEBUG
32 | NAMES libgflags-debug
33 | PATHS ${GFLAGS_ROOT_DIR}
34 | PATH_SUFFIXES Debug)
35 |
36 | set(GFLAGS_LIBRARY optimized ${GFLAGS_LIBRARY_RELEASE} debug ${GFLAGS_LIBRARY_DEBUG})
37 | else()
38 | find_library(GFLAGS_LIBRARY gflags)
39 | endif()
40 |
41 | find_package_handle_standard_args(GFlags DEFAULT_MSG GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
42 |
43 |
44 | if(GFLAGS_FOUND)
45 | set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
46 | set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY})
47 | message(STATUS "Found gflags (include: ${GFLAGS_INCLUDE_DIR}, library: ${GFLAGS_LIBRARY})")
48 | mark_as_advanced(GFLAGS_LIBRARY_DEBUG GFLAGS_LIBRARY_RELEASE
49 | GFLAGS_LIBRARY GFLAGS_INCLUDE_DIR GFLAGS_ROOT_DIR)
50 | endif()
51 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindGlog.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find Glog
2 | #
3 | # The following variables are optionally searched for defaults
4 | # GLOG_ROOT_DIR: Base directory where all GLOG components are found
5 | #
6 | # The following are set after configuration is done:
7 | # GLOG_FOUND
8 | # GLOG_INCLUDE_DIRS
9 | # GLOG_LIBRARIES
10 | # GLOG_LIBRARYRARY_DIRS
11 |
12 | include(FindPackageHandleStandardArgs)
13 |
14 | set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
15 |
16 | if(WIN32)
17 | find_path(GLOG_INCLUDE_DIR glog/logging.h
18 | PATHS ${GLOG_ROOT_DIR}/src/windows)
19 | else()
20 | find_path(GLOG_INCLUDE_DIR glog/logging.h
21 | PATHS ${GLOG_ROOT_DIR})
22 | endif()
23 |
24 | if(MSVC)
25 | find_library(GLOG_LIBRARY_RELEASE libglog_static
26 | PATHS ${GLOG_ROOT_DIR}
27 | PATH_SUFFIXES Release)
28 |
29 | find_library(GLOG_LIBRARY_DEBUG libglog_static
30 | PATHS ${GLOG_ROOT_DIR}
31 | PATH_SUFFIXES Debug)
32 |
33 | set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
34 | else()
35 | find_library(GLOG_LIBRARY glog
36 | PATHS ${GLOG_ROOT_DIR}
37 | PATH_SUFFIXES lib lib64)
38 | endif()
39 |
40 | find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)
41 |
42 | if(GLOG_FOUND)
43 | set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
44 | set(GLOG_LIBRARIES ${GLOG_LIBRARY})
45 | message(STATUS "Found glog (include: ${GLOG_INCLUDE_DIR}, library: ${GLOG_LIBRARY})")
46 | mark_as_advanced(GLOG_ROOT_DIR GLOG_LIBRARY_RELEASE GLOG_LIBRARY_DEBUG
47 | GLOG_LIBRARY GLOG_INCLUDE_DIR)
48 | endif()
49 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindLMDB.cmake:
--------------------------------------------------------------------------------
1 | # Try to find the LMBD libraries and headers
2 | # LMDB_FOUND - system has LMDB lib
3 | # LMDB_INCLUDE_DIR - the LMDB include directory
4 | # LMDB_LIBRARIES - Libraries needed to use LMDB
5 |
6 | # FindCWD based on FindGMP by:
7 | # Copyright (c) 2006, Laurent Montel,
8 | #
9 | # Redistribution and use is allowed according to the terms of the BSD license.
10 |
11 | # Adapted from FindCWD by:
12 | # Copyright 2013 Conrad Steenberg
13 | # Aug 31, 2013
14 |
15 | find_path(LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include")
16 | find_library(LMDB_LIBRARIES NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" )
17 |
18 | include(FindPackageHandleStandardArgs)
19 | find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARIES)
20 |
21 | if(LMDB_FOUND)
22 | message(STATUS "Found lmdb (include: ${LMDB_INCLUDE_DIR}, library: ${LMDB_LIBRARIES})")
23 | mark_as_advanced(LMDB_INCLUDE_DIR LMDB_LIBRARIES)
24 |
25 | caffe_parse_header(${LMDB_INCLUDE_DIR}/lmdb.h
26 | LMDB_VERSION_LINES MDB_VERSION_MAJOR MDB_VERSION_MINOR MDB_VERSION_PATCH)
27 | set(LMDB_VERSION "${MDB_VERSION_MAJOR}.${MDB_VERSION_MINOR}.${MDB_VERSION_PATCH}")
28 | endif()
29 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindLevelDB.cmake:
--------------------------------------------------------------------------------
1 | # - Find LevelDB
2 | #
3 | # LevelDB_INCLUDES - List of LevelDB includes
4 | # LevelDB_LIBRARIES - List of libraries when using LevelDB.
5 | # LevelDB_FOUND - True if LevelDB found.
6 |
7 | # Look for the header file.
8 | find_path(LevelDB_INCLUDE NAMES leveldb/db.h
9 | PATHS $ENV{LEVELDB_ROOT}/include /opt/local/include /usr/local/include /usr/include
10 | DOC "Path in which the file leveldb/db.h is located." )
11 |
12 | # Look for the library.
13 | find_library(LevelDB_LIBRARY NAMES leveldb
14 | PATHS /usr/lib $ENV{LEVELDB_ROOT}/lib
15 | DOC "Path to leveldb library." )
16 |
17 | include(FindPackageHandleStandardArgs)
18 | find_package_handle_standard_args(LevelDB DEFAULT_MSG LevelDB_INCLUDE LevelDB_LIBRARY)
19 |
20 | if(LEVELDB_FOUND)
21 | message(STATUS "Found LevelDB (include: ${LevelDB_INCLUDE}, library: ${LevelDB_LIBRARY})")
22 | set(LevelDB_INCLUDES ${LevelDB_INCLUDE})
23 | set(LevelDB_LIBRARIES ${LevelDB_LIBRARY})
24 | mark_as_advanced(LevelDB_INCLUDE LevelDB_LIBRARY)
25 |
26 | if(EXISTS "${LevelDB_INCLUDE}/leveldb/db.h")
27 | file(STRINGS "${LevelDB_INCLUDE}/leveldb/db.h" __version_lines
28 | REGEX "static const int k[^V]+Version[ \t]+=[ \t]+[0-9]+;")
29 |
30 | foreach(__line ${__version_lines})
31 | if(__line MATCHES "[^k]+kMajorVersion[ \t]+=[ \t]+([0-9]+);")
32 | set(LEVELDB_VERSION_MAJOR ${CMAKE_MATCH_1})
33 | elseif(__line MATCHES "[^k]+kMinorVersion[ \t]+=[ \t]+([0-9]+);")
34 | set(LEVELDB_VERSION_MINOR ${CMAKE_MATCH_1})
35 | endif()
36 | endforeach()
37 |
38 | if(LEVELDB_VERSION_MAJOR AND LEVELDB_VERSION_MINOR)
39 | set(LEVELDB_VERSION "${LEVELDB_VERSION_MAJOR}.${LEVELDB_VERSION_MINOR}")
40 | endif()
41 |
42 | caffe_clear_vars(__line __version_lines)
43 | endif()
44 | endif()
45 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindOpenBLAS.cmake:
--------------------------------------------------------------------------------
1 |
2 |
3 | SET(Open_BLAS_INCLUDE_SEARCH_PATHS
4 | /usr/include
5 | /usr/include/openblas
6 | /usr/include/openblas-base
7 | /usr/local/include
8 | /usr/local/include/openblas
9 | /usr/local/include/openblas-base
10 | /opt/OpenBLAS/include
11 | $ENV{OpenBLAS_HOME}
12 | $ENV{OpenBLAS_HOME}/include
13 | )
14 |
15 | SET(Open_BLAS_LIB_SEARCH_PATHS
16 | /lib/
17 | /lib/openblas-base
18 | /lib64/
19 | /usr/lib
20 | /usr/lib/openblas-base
21 | /usr/lib64
22 | /usr/local/lib
23 | /usr/local/lib64
24 | /opt/OpenBLAS/lib
25 | $ENV{OpenBLAS}cd
26 | $ENV{OpenBLAS}/lib
27 | $ENV{OpenBLAS_HOME}
28 | $ENV{OpenBLAS_HOME}/lib
29 | )
30 |
31 | FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
32 | FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
33 |
34 | SET(OpenBLAS_FOUND ON)
35 |
36 | # Check include files
37 | IF(NOT OpenBLAS_INCLUDE_DIR)
38 | SET(OpenBLAS_FOUND OFF)
39 | MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
40 | ENDIF()
41 |
42 | # Check libraries
43 | IF(NOT OpenBLAS_LIB)
44 | SET(OpenBLAS_FOUND OFF)
45 | MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
46 | ENDIF()
47 |
48 | IF (OpenBLAS_FOUND)
49 | IF (NOT OpenBLAS_FIND_QUIETLY)
50 | MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
51 | MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
52 | ENDIF (NOT OpenBLAS_FIND_QUIETLY)
53 | ELSE (OpenBLAS_FOUND)
54 | IF (OpenBLAS_FIND_REQUIRED)
55 | MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
56 | ENDIF (OpenBLAS_FIND_REQUIRED)
57 | ENDIF (OpenBLAS_FOUND)
58 |
59 | MARK_AS_ADVANCED(
60 | OpenBLAS_INCLUDE_DIR
61 | OpenBLAS_LIB
62 | OpenBLAS
63 | )
64 |
65 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindSnappy.cmake:
--------------------------------------------------------------------------------
1 | # Find the Snappy libraries
2 | #
3 | # The following variables are optionally searched for defaults
4 | # Snappy_ROOT_DIR: Base directory where all Snappy components are found
5 | #
6 | # The following are set after configuration is done:
7 | # SNAPPY_FOUND
8 | # Snappy_INCLUDE_DIR
9 | # Snappy_LIBRARIES
10 |
11 | find_path(Snappy_INCLUDE_DIR NAMES snappy.h
12 | PATHS ${SNAPPY_ROOT_DIR} ${SNAPPY_ROOT_DIR}/include)
13 |
14 | find_library(Snappy_LIBRARIES NAMES snappy
15 | PATHS ${SNAPPY_ROOT_DIR} ${SNAPPY_ROOT_DIR}/lib)
16 |
17 | include(FindPackageHandleStandardArgs)
18 | find_package_handle_standard_args(Snappy DEFAULT_MSG Snappy_INCLUDE_DIR Snappy_LIBRARIES)
19 |
20 | if(SNAPPY_FOUND)
21 | message(STATUS "Found Snappy (include: ${Snappy_INCLUDE_DIR}, library: ${Snappy_LIBRARIES})")
22 | mark_as_advanced(Snappy_INCLUDE_DIR Snappy_LIBRARIES)
23 |
24 | caffe_parse_header(${Snappy_INCLUDE_DIR}/snappy-stubs-public.h
25 | SNAPPY_VERION_LINES SNAPPY_MAJOR SNAPPY_MINOR SNAPPY_PATCHLEVEL)
26 | set(Snappy_VERSION "${SNAPPY_MAJOR}.${SNAPPY_MINOR}.${SNAPPY_PATCHLEVEL}")
27 | endif()
28 |
29 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Modules/FindvecLib.cmake:
--------------------------------------------------------------------------------
1 | # Find the vecLib libraries as part of Accelerate.framework or as standalon framework
2 | #
3 | # The following are set after configuration is done:
4 | # VECLIB_FOUND
5 | # vecLib_INCLUDE_DIR
6 | # vecLib_LINKER_LIBS
7 |
8 |
9 | if(NOT APPLE)
10 | return()
11 | endif()
12 |
13 | set(__veclib_include_suffix "Frameworks/vecLib.framework/Versions/Current/Headers")
14 |
15 | find_path(vecLib_INCLUDE_DIR vecLib.h
16 | DOC "vecLib include directory"
17 | PATHS /System/Library/Frameworks/Accelerate.framework/Versions/Current/${__veclib_include_suffix}
18 | /System/Library/${__veclib_include_suffix}
19 | /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
20 | NO_DEFAULT_PATH)
21 |
22 | include(FindPackageHandleStandardArgs)
23 | find_package_handle_standard_args(vecLib DEFAULT_MSG vecLib_INCLUDE_DIR)
24 |
25 | if(VECLIB_FOUND)
26 | if(vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")
27 | set(vecLib_LINKER_LIBS -lcblas "-framework vecLib")
28 | message(STATUS "Found standalone vecLib.framework")
29 | else()
30 | set(vecLib_LINKER_LIBS -lcblas "-framework Accelerate")
31 | message(STATUS "Found vecLib as part of Accelerate.framework")
32 | endif()
33 |
34 | mark_as_advanced(vecLib_INCLUDE_DIR)
35 | endif()
36 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Templates/CaffeConfigVersion.cmake.in:
--------------------------------------------------------------------------------
1 | set(PACKAGE_VERSION "@Caffe_VERSION@")
2 |
3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible
4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
6 | else()
7 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9 | set(PACKAGE_VERSION_EXACT TRUE)
10 | endif()
11 | endif()
12 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/Templates/caffe_config.h.in:
--------------------------------------------------------------------------------
1 | /* Sources directory */
2 | #define SOURCE_FOLDER "${PROJECT_SOURCE_DIR}"
3 |
4 | /* Binaries directory */
5 | #define BINARY_FOLDER "${PROJECT_BINARY_DIR}"
6 |
7 | /* NVIDA Cuda */
8 | #cmakedefine HAVE_CUDA
9 |
10 | /* NVIDA cuDNN */
11 | #cmakedefine HAVE_CUDNN
12 | #cmakedefine USE_CUDNN
13 |
14 | /* NVIDA cuDNN */
15 | #cmakedefine CPU_ONLY
16 |
17 | /* Test device */
18 | #define CUDA_TEST_DEVICE ${CUDA_TEST_DEVICE}
19 |
20 | /* Temporary (TODO: remove) */
21 | #if 1
22 | #define CMAKE_SOURCE_DIR SOURCE_FOLDER "/src/"
23 | #define EXAMPLES_SOURCE_DIR BINARY_FOLDER "/examples/"
24 | #define CMAKE_EXT ".gen.cmake"
25 | #else
26 | #define CMAKE_SOURCE_DIR "src/"
27 | #define EXAMPLES_SOURCE_DIR "examples/"
28 | #define CMAKE_EXT ""
29 | #endif
30 |
31 | /* Matlab */
32 | #cmakedefine HAVE_MATLAB
33 |
34 | /* IO libraries */
35 | #cmakedefine USE_OPENCV
36 | #cmakedefine USE_LEVELDB
37 | #cmakedefine USE_LMDB
38 | #cmakedefine ALLOW_LMDB_NOLOCK
39 |
--------------------------------------------------------------------------------
/tool/caffe/cmake/lint.cmake:
--------------------------------------------------------------------------------
1 |
2 | set(CMAKE_SOURCE_DIR ..)
3 | set(LINT_COMMAND ${CMAKE_SOURCE_DIR}/scripts/cpp_lint.py)
4 | set(SRC_FILE_EXTENSIONS h hpp hu c cpp cu cc)
5 | set(EXCLUDE_FILE_EXTENSTIONS pb.h pb.cc)
6 | set(LINT_DIRS include src/caffe examples tools python matlab)
7 |
8 | cmake_policy(SET CMP0009 NEW) # suppress cmake warning
9 |
10 | # find all files of interest
11 | foreach(ext ${SRC_FILE_EXTENSIONS})
12 | foreach(dir ${LINT_DIRS})
13 | file(GLOB_RECURSE FOUND_FILES ${CMAKE_SOURCE_DIR}/${dir}/*.${ext})
14 | set(LINT_SOURCES ${LINT_SOURCES} ${FOUND_FILES})
15 | endforeach()
16 | endforeach()
17 |
18 | # find all files that should be excluded
19 | foreach(ext ${EXCLUDE_FILE_EXTENSTIONS})
20 | file(GLOB_RECURSE FOUND_FILES ${CMAKE_SOURCE_DIR}/*.${ext})
21 | set(EXCLUDED_FILES ${EXCLUDED_FILES} ${FOUND_FILES})
22 | endforeach()
23 |
24 | # exclude generated pb files
25 | list(REMOVE_ITEM LINT_SOURCES ${EXCLUDED_FILES})
26 |
27 | execute_process(
28 | COMMAND ${LINT_COMMAND} ${LINT_SOURCES}
29 | ERROR_VARIABLE LINT_OUTPUT
30 | ERROR_STRIP_TRAILING_WHITESPACE
31 | )
32 |
33 | string(REPLACE "\n" ";" LINT_OUTPUT ${LINT_OUTPUT})
34 |
35 | list(GET LINT_OUTPUT -1 LINT_RESULT)
36 | list(REMOVE_AT LINT_OUTPUT -1)
37 | string(REPLACE " " ";" LINT_RESULT ${LINT_RESULT})
38 | list(GET LINT_RESULT -1 NUM_ERRORS)
39 | if(NUM_ERRORS GREATER 0)
40 | foreach(msg ${LINT_OUTPUT})
41 | string(FIND ${msg} "Done" result)
42 | if(result LESS 0)
43 | message(STATUS ${msg})
44 | endif()
45 | endforeach()
46 | message(FATAL_ERROR "Lint found ${NUM_ERRORS} errors!")
47 | else()
48 | message(STATUS "Lint did not find any errors!")
49 | endif()
50 |
51 |
--------------------------------------------------------------------------------
/tool/caffe/docs/CNAME:
--------------------------------------------------------------------------------
1 | caffe.berkeleyvision.org
2 |
--------------------------------------------------------------------------------
/tool/caffe/docs/README.md:
--------------------------------------------------------------------------------
1 | # Caffe Documentation
2 |
3 | To generate the documentation, run `$CAFFE_ROOT/scripts/build_docs.sh`.
4 |
5 | To push your changes to the documentation to the gh-pages branch of your or the BVLC repo, run `$CAFFE_ROOT/scripts/deploy_docs.sh `.
6 |
--------------------------------------------------------------------------------
/tool/caffe/docs/_config.yml:
--------------------------------------------------------------------------------
1 | defaults:
2 | -
3 | scope:
4 | path: "" # an empty string here means all files in the project
5 | values:
6 | layout: "default"
7 |
8 |
--------------------------------------------------------------------------------
/tool/caffe/docs/images/GitHub-Mark-64px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/tool/caffe/docs/images/GitHub-Mark-64px.png
--------------------------------------------------------------------------------
/tool/caffe/docs/images/caffeine-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/tool/caffe/docs/images/caffeine-icon.png
--------------------------------------------------------------------------------
/tool/caffe/docs/stylesheets/reset.css:
--------------------------------------------------------------------------------
1 | /* MeyerWeb Reset */
2 |
3 | html, body, div, span, applet, object, iframe,
4 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
5 | a, abbr, acronym, address, big, cite, code,
6 | del, dfn, em, img, ins, kbd, q, s, samp,
7 | small, strike, strong, sub, sup, tt, var,
8 | b, u, i, center,
9 | dl, dt, dd, ol, ul, li,
10 | fieldset, form, label, legend,
11 | table, caption, tbody, tfoot, thead, tr, th, td,
12 | article, aside, canvas, details, embed,
13 | figure, figcaption, footer, header, hgroup,
14 | menu, nav, output, ruby, section, summary,
15 | time, mark, audio, video {
16 | margin: 0;
17 | padding: 0;
18 | border: 0;
19 | font: inherit;
20 | vertical-align: baseline;
21 | }
22 |
--------------------------------------------------------------------------------
/tool/caffe/docs/tutorial/convolution.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Convolution
3 | ---
4 | # Caffeinated Convolution
5 |
6 | The Caffe strategy for convolution is to reduce the problem to matrix-matrix multiplication.
7 | This linear algebra computation is highly-tuned in BLAS libraries and efficiently computed on GPU devices.
8 |
9 | For more details read Yangqing's [Convolution in Caffe: a memo](https://github.com/Yangqing/caffe/wiki/Convolution-in-Caffe:-a-memo).
10 |
11 | As it turns out, this same reduction was independently explored in the context of conv. nets by
12 |
13 | > K. Chellapilla, S. Puri, P. Simard, et al. High performance convolutional neural networks for document processing. In Tenth International Workshop on Frontiers in Handwriting Recognition, 2006.
14 |
--------------------------------------------------------------------------------
/tool/caffe/docs/tutorial/fig/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/tool/caffe/docs/tutorial/fig/.gitignore
--------------------------------------------------------------------------------
/tool/caffe/docs/tutorial/fig/forward_backward.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HornedSungem/SungemSDK-Python/5ce5eb7f84654aecf6840de773188f436219559d/tool/caffe/docs/tutorial/fig/forward_backward.png
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/caffe.hpp:
--------------------------------------------------------------------------------
1 | // caffe.hpp is the header file that you need to include in your code. It wraps
2 | // all the internal caffe header files into one for simpler inclusion.
3 |
4 | #ifndef CAFFE_CAFFE_HPP_
5 | #define CAFFE_CAFFE_HPP_
6 |
7 | #include "caffe/blob.hpp"
8 | #include "caffe/common.hpp"
9 | #include "caffe/filler.hpp"
10 | #include "caffe/layer.hpp"
11 | #include "caffe/layer_factory.hpp"
12 | #include "caffe/net.hpp"
13 | #include "caffe/parallel.hpp"
14 | #include "caffe/proto/caffe.pb.h"
15 | #include "caffe/solver.hpp"
16 | #include "caffe/solver_factory.hpp"
17 | #include "caffe/util/benchmark.hpp"
18 | #include "caffe/util/io.hpp"
19 | #include "caffe/util/upgrade_proto.hpp"
20 |
21 | #endif // CAFFE_CAFFE_HPP_
22 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/internal_thread.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_INTERNAL_THREAD_HPP_
2 | #define CAFFE_INTERNAL_THREAD_HPP_
3 |
4 | #include "caffe/common.hpp"
5 |
6 | /**
7 | Forward declare boost::thread instead of including boost/thread.hpp
8 | to avoid a boost/NVCC issues (#1009, #1010) on OSX.
9 | */
10 | namespace boost { class thread; }
11 |
12 | namespace caffe {
13 |
14 | /**
15 | * Virtual class encapsulate boost::thread for use in base class
16 | * The child class will acquire the ability to run a single thread,
17 | * by reimplementing the virtual function InternalThreadEntry.
18 | */
19 | class InternalThread {
20 | public:
21 | InternalThread() : thread_() {}
22 | virtual ~InternalThread();
23 |
24 | /**
25 | * Caffe's thread local state will be initialized using the current
26 | * thread values, e.g. device id, solver index etc. The random seed
27 | * is initialized using caffe_rng_rand.
28 | */
29 | void StartInternalThread();
30 |
31 | /** Will not return until the internal thread has exited. */
32 | void StopInternalThread();
33 |
34 | bool is_started() const;
35 |
36 | protected:
37 | /* Implement this method in your subclass
38 | with the code you want your thread to run. */
39 | virtual void InternalThreadEntry() {}
40 |
41 | /* Should be tested when running loops to exit when requested. */
42 | bool must_stop();
43 |
44 | private:
45 | void entry(int device, Caffe::Brew mode, int rand_seed, int solver_count,
46 | bool root_solver);
47 |
48 | shared_ptr thread_;
49 | };
50 |
51 | } // namespace caffe
52 |
53 | #endif // CAFFE_INTERNAL_THREAD_HPP_
54 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/annotated_data_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_DATA_LAYER_HPP_
2 | #define CAFFE_DATA_LAYER_HPP_
3 |
4 | #include
5 | #include
6 |
7 | #include "caffe/blob.hpp"
8 | #include "caffe/data_reader.hpp"
9 | #include "caffe/data_transformer.hpp"
10 | #include "caffe/internal_thread.hpp"
11 | #include "caffe/layer.hpp"
12 | #include "caffe/layers/base_data_layer.hpp"
13 | #include "caffe/proto/caffe.pb.h"
14 | #include "caffe/util/db.hpp"
15 |
16 | namespace caffe {
17 |
18 | template
19 | class AnnotatedDataLayer : public BasePrefetchingDataLayer {
20 | public:
21 | explicit AnnotatedDataLayer(const LayerParameter& param);
22 | virtual ~AnnotatedDataLayer();
23 | virtual void DataLayerSetUp(const vector*>& bottom,
24 | const vector*>& top);
25 | // AnnotatedDataLayer uses DataReader instead for sharing for parallelism
26 | virtual inline bool ShareInParallel() const { return false; }
27 | virtual inline const char* type() const { return "AnnotatedData"; }
28 | virtual inline int ExactNumBottomBlobs() const { return 0; }
29 | virtual inline int MinTopBlobs() const { return 1; }
30 |
31 | protected:
32 | virtual void load_batch(Batch* batch);
33 |
34 | DataReader reader_;
35 | bool has_anno_type_;
36 | AnnotatedDatum_AnnotationType anno_type_;
37 | vector batch_samplers_;
38 | string label_map_file_;
39 | };
40 |
41 | } // namespace caffe
42 |
43 | #endif // CAFFE_DATA_LAYER_HPP_
44 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_lcn_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_LCN_LAYER_HPP_
2 | #define CAFFE_CUDNN_LCN_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/lrn_layer.hpp"
11 | #include "caffe/layers/power_layer.hpp"
12 |
13 | namespace caffe {
14 |
15 | #ifdef USE_CUDNN
16 | template
17 | class CuDNNLCNLayer : public LRNLayer {
18 | public:
19 | explicit CuDNNLCNLayer(const LayerParameter& param)
20 | : LRNLayer(param), handles_setup_(false), tempDataSize(0),
21 | tempData1(NULL), tempData2(NULL) {}
22 | virtual void LayerSetUp(const vector*>& bottom,
23 | const vector*>& top);
24 | virtual void Reshape(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual ~CuDNNLCNLayer();
27 |
28 | protected:
29 | virtual void Forward_gpu(const vector*>& bottom,
30 | const vector*>& top);
31 | virtual void Backward_gpu(const vector*>& top,
32 | const vector& propagate_down, const vector*>& bottom);
33 |
34 | bool handles_setup_;
35 | cudnnHandle_t handle_;
36 | cudnnLRNDescriptor_t norm_desc_;
37 | cudnnTensorDescriptor_t bottom_desc_, top_desc_;
38 |
39 | int size_, pre_pad_;
40 | Dtype alpha_, beta_, k_;
41 |
42 | size_t tempDataSize;
43 | void *tempData1, *tempData2;
44 | };
45 | #endif
46 |
47 | } // namespace caffe
48 |
49 | #endif // CAFFE_CUDNN_LCN_LAYER_HPP_
50 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_lrn_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_LRN_LAYER_HPP_
2 | #define CAFFE_CUDNN_LRN_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/lrn_layer.hpp"
11 |
12 | namespace caffe {
13 |
14 | #ifdef USE_CUDNN
15 | template
16 | class CuDNNLRNLayer : public LRNLayer {
17 | public:
18 | explicit CuDNNLRNLayer(const LayerParameter& param)
19 | : LRNLayer(param), handles_setup_(false) {}
20 | virtual void LayerSetUp(const vector*>& bottom,
21 | const vector*>& top);
22 | virtual void Reshape(const vector*>& bottom,
23 | const vector*>& top);
24 | virtual ~CuDNNLRNLayer();
25 |
26 | protected:
27 | virtual void Forward_gpu(const vector*>& bottom,
28 | const vector*>& top);
29 | virtual void Backward_gpu(const vector*>& top,
30 | const vector& propagate_down, const vector*>& bottom);
31 |
32 | bool handles_setup_;
33 | cudnnHandle_t handle_;
34 | cudnnLRNDescriptor_t norm_desc_;
35 | cudnnTensorDescriptor_t bottom_desc_, top_desc_;
36 |
37 | int size_;
38 | Dtype alpha_, beta_, k_;
39 | };
40 | #endif
41 |
42 | } // namespace caffe
43 |
44 | #endif // CAFFE_CUDNN_LRN_LAYER_HPP_
45 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_pooling_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_POOLING_LAYER_HPP_
2 | #define CAFFE_CUDNN_POOLING_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/pooling_layer.hpp"
11 |
12 | namespace caffe {
13 |
14 | #ifdef USE_CUDNN
15 | /*
16 | * @brief cuDNN implementation of PoolingLayer.
17 | * Fallback to PoolingLayer for CPU mode.
18 | */
19 | template
20 | class CuDNNPoolingLayer : public PoolingLayer {
21 | public:
22 | explicit CuDNNPoolingLayer(const LayerParameter& param)
23 | : PoolingLayer(param), handles_setup_(false) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 | virtual ~CuDNNPoolingLayer();
29 | // Currently, cuDNN does not support the extra top blob.
30 | virtual inline int MinTopBlobs() const { return -1; }
31 | virtual inline int ExactNumTopBlobs() const { return 1; }
32 |
33 | protected:
34 | virtual void Forward_gpu(const vector*>& bottom,
35 | const vector*>& top);
36 | virtual void Backward_gpu(const vector*>& top,
37 | const vector& propagate_down, const vector*>& bottom);
38 |
39 | bool handles_setup_;
40 | cudnnHandle_t handle_;
41 | cudnnTensorDescriptor_t bottom_desc_, top_desc_;
42 | cudnnPoolingDescriptor_t pooling_desc_;
43 | cudnnPoolingMode_t mode_;
44 | };
45 | #endif
46 |
47 | } // namespace caffe
48 |
49 | #endif // CAFFE_CUDNN_POOLING_LAYER_HPP_
50 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_relu_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_RELU_LAYER_HPP_
2 | #define CAFFE_CUDNN_RELU_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/neuron_layer.hpp"
11 | #include "caffe/layers/relu_layer.hpp"
12 |
13 | namespace caffe {
14 |
15 | #ifdef USE_CUDNN
16 | /**
17 | * @brief CuDNN acceleration of ReLULayer.
18 | */
19 | template
20 | class CuDNNReLULayer : public ReLULayer {
21 | public:
22 | explicit CuDNNReLULayer(const LayerParameter& param)
23 | : ReLULayer(param), handles_setup_(false) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 | virtual ~CuDNNReLULayer();
29 |
30 | protected:
31 | virtual void Forward_gpu(const vector*>& bottom,
32 | const vector*>& top);
33 | virtual void Backward_gpu(const vector*>& top,
34 | const vector& propagate_down, const vector*>& bottom);
35 |
36 | bool handles_setup_;
37 | cudnnHandle_t handle_;
38 | cudnnTensorDescriptor_t bottom_desc_;
39 | cudnnTensorDescriptor_t top_desc_;
40 | cudnnActivationDescriptor_t activ_desc_;
41 | };
42 | #endif
43 |
44 | } // namespace caffe
45 |
46 | #endif // CAFFE_CUDNN_RELU_LAYER_HPP_
47 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_sigmoid_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_SIGMOID_LAYER_HPP_
2 | #define CAFFE_CUDNN_SIGMOID_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/neuron_layer.hpp"
11 | #include "caffe/layers/sigmoid_layer.hpp"
12 |
13 | namespace caffe {
14 |
15 | #ifdef USE_CUDNN
16 | /**
17 | * @brief CuDNN acceleration of SigmoidLayer.
18 | */
19 | template
20 | class CuDNNSigmoidLayer : public SigmoidLayer {
21 | public:
22 | explicit CuDNNSigmoidLayer(const LayerParameter& param)
23 | : SigmoidLayer(param), handles_setup_(false) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 | virtual ~CuDNNSigmoidLayer();
29 |
30 | protected:
31 | virtual void Forward_gpu(const vector*>& bottom,
32 | const vector*>& top);
33 | virtual void Backward_gpu(const vector*>& top,
34 | const vector& propagate_down, const vector*>& bottom);
35 |
36 | bool handles_setup_;
37 | cudnnHandle_t handle_;
38 | cudnnTensorDescriptor_t bottom_desc_;
39 | cudnnTensorDescriptor_t top_desc_;
40 | cudnnActivationDescriptor_t activ_desc_;
41 | };
42 | #endif
43 |
44 | } // namespace caffe
45 |
46 | #endif // CAFFE_CUDNN_SIGMOID_LAYER_HPP_
47 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_softmax_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_SOFTMAX_LAYER_HPP_
2 | #define CAFFE_CUDNN_SOFTMAX_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/softmax_layer.hpp"
11 |
12 | namespace caffe {
13 |
14 | #ifdef USE_CUDNN
15 | /**
16 | * @brief cuDNN implementation of SoftmaxLayer.
17 | * Fallback to SoftmaxLayer for CPU mode.
18 | */
19 | template
20 | class CuDNNSoftmaxLayer : public SoftmaxLayer {
21 | public:
22 | explicit CuDNNSoftmaxLayer(const LayerParameter& param)
23 | : SoftmaxLayer(param), handles_setup_(false) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 | virtual ~CuDNNSoftmaxLayer();
29 |
30 | protected:
31 | virtual void Forward_gpu(const vector*>& bottom,
32 | const vector*>& top);
33 | virtual void Backward_gpu(const vector*>& top,
34 | const vector& propagate_down, const vector*>& bottom);
35 |
36 | bool handles_setup_;
37 | cudnnHandle_t handle_;
38 | cudnnTensorDescriptor_t bottom_desc_;
39 | cudnnTensorDescriptor_t top_desc_;
40 | };
41 | #endif
42 |
43 | } // namespace caffe
44 |
45 | #endif // CAFFE_CUDNN_SOFTMAX_LAYER_HPP_
46 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/cudnn_tanh_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_CUDNN_TANH_LAYER_HPP_
2 | #define CAFFE_CUDNN_TANH_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | #include "caffe/layers/neuron_layer.hpp"
11 | #include "caffe/layers/tanh_layer.hpp"
12 |
13 | namespace caffe {
14 |
15 | #ifdef USE_CUDNN
16 | /**
17 | * @brief CuDNN acceleration of TanHLayer.
18 | */
19 | template
20 | class CuDNNTanHLayer : public TanHLayer {
21 | public:
22 | explicit CuDNNTanHLayer(const LayerParameter& param)
23 | : TanHLayer(param), handles_setup_(false) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 | virtual ~CuDNNTanHLayer();
29 |
30 | protected:
31 | virtual void Forward_gpu(const vector*>& bottom,
32 | const vector*>& top);
33 | virtual void Backward_gpu(const vector*>& top,
34 | const vector& propagate_down, const vector*>& bottom);
35 |
36 | bool handles_setup_;
37 | cudnnHandle_t handle_;
38 | cudnnTensorDescriptor_t bottom_desc_;
39 | cudnnTensorDescriptor_t top_desc_;
40 | cudnnActivationDescriptor_t activ_desc_;
41 | };
42 | #endif
43 |
44 | } // namespace caffe
45 |
46 | #endif // CAFFE_CUDNN_TANH_LAYER_HPP_
47 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/data_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_DATA_LAYER_HPP_
2 | #define CAFFE_DATA_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/data_reader.hpp"
8 | #include "caffe/data_transformer.hpp"
9 | #include "caffe/internal_thread.hpp"
10 | #include "caffe/layer.hpp"
11 | #include "caffe/layers/base_data_layer.hpp"
12 | #include "caffe/proto/caffe.pb.h"
13 | #include "caffe/util/db.hpp"
14 |
15 | namespace caffe {
16 |
17 | template
18 | class DataLayer : public BasePrefetchingDataLayer {
19 | public:
20 | explicit DataLayer(const LayerParameter& param);
21 | virtual ~DataLayer();
22 | virtual void DataLayerSetUp(const vector*>& bottom,
23 | const vector*>& top);
24 | // DataLayer uses DataReader instead for sharing for parallelism
25 | virtual inline bool ShareInParallel() const { return false; }
26 | virtual inline const char* type() const { return "Data"; }
27 | virtual inline int ExactNumBottomBlobs() const { return 0; }
28 | virtual inline int MinTopBlobs() const { return 1; }
29 | virtual inline int MaxTopBlobs() const { return 2; }
30 |
31 | protected:
32 | virtual void load_batch(Batch* batch);
33 |
34 | DataReader reader_;
35 | };
36 |
37 | } // namespace caffe
38 |
39 | #endif // CAFFE_DATA_LAYER_HPP_
40 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/dummy_data_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_DUMMY_DATA_LAYER_HPP_
2 | #define CAFFE_DUMMY_DATA_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/filler.hpp"
8 | #include "caffe/layer.hpp"
9 | #include "caffe/proto/caffe.pb.h"
10 |
11 | namespace caffe {
12 |
13 | /**
14 | * @brief Provides data to the Net generated by a Filler.
15 | *
16 | * TODO(dox): thorough documentation for Forward and proto params.
17 | */
18 | template
19 | class DummyDataLayer : public Layer {
20 | public:
21 | explicit DummyDataLayer(const LayerParameter& param)
22 | : Layer(param) {}
23 | virtual void LayerSetUp(const vector*>& bottom,
24 | const vector*>& top);
25 | // Data layers should be shared by multiple solvers in parallel
26 | virtual inline bool ShareInParallel() const { return true; }
27 | // Data layers have no bottoms, so reshaping is trivial.
28 | virtual void Reshape(const vector*>& bottom,
29 | const vector*>& top) {}
30 |
31 | virtual inline const char* type() const { return "DummyData"; }
32 | virtual inline int ExactNumBottomBlobs() const { return 0; }
33 | virtual inline int MinTopBlobs() const { return 1; }
34 |
35 | protected:
36 | virtual void Forward_cpu(const vector*>& bottom,
37 | const vector*>& top);
38 | virtual void Backward_cpu(const vector*>& top,
39 | const vector& propagate_down, const vector*>& bottom) {}
40 | virtual void Backward_gpu(const vector*>& top,
41 | const vector& propagate_down, const vector*>& bottom) {}
42 |
43 | vector > > fillers_;
44 | vector refill_;
45 | };
46 |
47 | } // namespace caffe
48 |
49 | #endif // CAFFE_DUMMY_DATA_LAYER_HPP_
50 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/eltwise_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_ELTWISE_LAYER_HPP_
2 | #define CAFFE_ELTWISE_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief Compute elementwise operations, such as product and sum,
14 | * along multiple input Blobs.
15 | *
16 | * TODO(dox): thorough documentation for Forward, Backward, and proto params.
17 | */
18 | template
19 | class EltwiseLayer : public Layer {
20 | public:
21 | explicit EltwiseLayer(const LayerParameter& param)
22 | : Layer(param) {}
23 | virtual void LayerSetUp(const vector*>& bottom,
24 | const vector*>& top);
25 | virtual void Reshape(const vector*>& bottom,
26 | const vector*>& top);
27 |
28 | virtual inline const char* type() const { return "Eltwise"; }
29 | virtual inline int MinBottomBlobs() const { return 2; }
30 | virtual inline int ExactNumTopBlobs() const { return 1; }
31 |
32 | protected:
33 | virtual void Forward_cpu(const vector*>& bottom,
34 | const vector*>& top);
35 | virtual void Forward_gpu(const vector*>& bottom,
36 | const vector*>& top);
37 | virtual void Backward_cpu(const vector*>& top,
38 | const vector& propagate_down, const vector*>& bottom);
39 | virtual void Backward_gpu(const vector*>& top,
40 | const vector& propagate_down, const vector*>& bottom);
41 |
42 | EltwiseParameter_EltwiseOp op_;
43 | vector coeffs_;
44 | Blob max_idx_;
45 |
46 | bool stable_prod_grad_;
47 | };
48 |
49 | } // namespace caffe
50 |
51 | #endif // CAFFE_ELTWISE_LAYER_HPP_
52 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/embed_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_EMBED_LAYER_HPP_
2 | #define CAFFE_EMBED_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief A layer for learning "embeddings" of one-hot vector input.
14 | * Equivalent to an InnerProductLayer with one-hot vectors as input, but
15 | * for efficiency the input is the "hot" index of each column itself.
16 | *
17 | * TODO(dox): thorough documentation for Forward, Backward, and proto params.
18 | */
19 | template
20 | class EmbedLayer : public Layer {
21 | public:
22 | explicit EmbedLayer(const LayerParameter& param)
23 | : Layer(param) {}
24 | virtual void LayerSetUp(const vector*>& bottom,
25 | const vector*>& top);
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top);
28 |
29 | virtual inline const char* type() const { return "Embed"; }
30 | virtual inline int ExactNumBottomBlobs() const { return 1; }
31 | virtual inline int ExactNumTopBlobs() const { return 1; }
32 |
33 | protected:
34 | virtual void Forward_cpu(const vector*>& bottom,
35 | const vector*>& top);
36 | virtual void Forward_gpu(const vector*>& bottom,
37 | const vector*>& top);
38 | virtual void Backward_cpu(const vector*>& top,
39 | const vector& propagate_down, const vector*>& bottom);
40 | virtual void Backward_gpu(const vector*>& top,
41 | const vector& propagate_down, const vector*>& bottom);
42 |
43 | int M_;
44 | int K_;
45 | int N_;
46 | bool bias_term_;
47 | Blob bias_multiplier_;
48 | };
49 |
50 | } // namespace caffe
51 |
52 | #endif // CAFFE_EMBED_LAYER_HPP_
53 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/image_data_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_IMAGE_DATA_LAYER_HPP_
2 | #define CAFFE_IMAGE_DATA_LAYER_HPP_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "caffe/blob.hpp"
9 | #include "caffe/data_transformer.hpp"
10 | #include "caffe/internal_thread.hpp"
11 | #include "caffe/layer.hpp"
12 | #include "caffe/layers/base_data_layer.hpp"
13 | #include "caffe/proto/caffe.pb.h"
14 |
15 | namespace caffe {
16 |
17 | /**
18 | * @brief Provides data to the Net from image files.
19 | *
20 | * TODO(dox): thorough documentation for Forward and proto params.
21 | */
22 | template
23 | class ImageDataLayer : public BasePrefetchingDataLayer {
24 | public:
25 | explicit ImageDataLayer(const LayerParameter& param)
26 | : BasePrefetchingDataLayer(param) {}
27 | virtual ~ImageDataLayer();
28 | virtual void DataLayerSetUp(const vector*>& bottom,
29 | const vector*>& top);
30 |
31 | virtual inline const char* type() const { return "ImageData"; }
32 | virtual inline int ExactNumBottomBlobs() const { return 0; }
33 | virtual inline int ExactNumTopBlobs() const { return 2; }
34 |
35 | protected:
36 | shared_ptr prefetch_rng_;
37 | virtual void ShuffleImages();
38 | virtual void load_batch(Batch* batch);
39 |
40 | vector > lines_;
41 | int lines_id_;
42 | };
43 |
44 |
45 | } // namespace caffe
46 |
47 | #endif // CAFFE_IMAGE_DATA_LAYER_HPP_
48 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/input_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_INPUT_LAYER_HPP_
2 | #define CAFFE_INPUT_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief Provides data to the Net by assigning tops directly.
14 | *
15 | * This data layer is a container that merely holds the data assigned to it;
16 | * forward, backward, and reshape are all no-ops.
17 | */
18 | template
19 | class InputLayer : public Layer {
20 | public:
21 | explicit InputLayer(const LayerParameter& param)
22 | : Layer(param) {}
23 | virtual void LayerSetUp(const vector*>& bottom,
24 | const vector*>& top);
25 | // Data layers should be shared by multiple solvers in parallel
26 | virtual inline bool ShareInParallel() const { return true; }
27 | // Data layers have no bottoms, so reshaping is trivial.
28 | virtual void Reshape(const vector*>& bottom,
29 | const vector*>& top) {}
30 |
31 | virtual inline const char* type() const { return "Input"; }
32 | virtual inline int ExactNumBottomBlobs() const { return 0; }
33 | virtual inline int MinTopBlobs() const { return 1; }
34 |
35 | protected:
36 | virtual void Forward_cpu(const vector*>& bottom,
37 | const vector*>& top) {}
38 | virtual void Backward_cpu(const vector*>& top,
39 | const vector& propagate_down, const vector*>& bottom) {}
40 | };
41 |
42 | } // namespace caffe
43 |
44 | #endif // CAFFE_INPUT_LAYER_HPP_
45 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/mvn_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_MVN_LAYER_HPP_
2 | #define CAFFE_MVN_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief Normalizes the input to have 0-mean and/or unit (1) variance.
14 | *
15 | * TODO(dox): thorough documentation for Forward, Backward, and proto params.
16 | */
17 | template
18 | class MVNLayer : public Layer {
19 | public:
20 | explicit MVNLayer(const LayerParameter& param)
21 | : Layer(param) {}
22 | virtual void Reshape(const vector*>& bottom,
23 | const vector*>& top);
24 |
25 | virtual inline const char* type() const { return "MVN"; }
26 | virtual inline int ExactNumBottomBlobs() const { return 1; }
27 | virtual inline int ExactNumTopBlobs() const { return 1; }
28 |
29 | protected:
30 | virtual void Forward_cpu(const vector*>& bottom,
31 | const vector*>& top);
32 | virtual void Forward_gpu(const vector*>& bottom,
33 | const vector*>& top);
34 | virtual void Backward_cpu(const vector*>& top,
35 | const vector& propagate_down, const vector*>& bottom);
36 | virtual void Backward_gpu(const vector*>& top,
37 | const vector& propagate_down, const vector*>& bottom);
38 |
39 | Blob mean_, variance_, temp_;
40 |
41 | /// sum_multiplier is used to carry out sum using BLAS
42 | Blob sum_multiplier_;
43 | Dtype eps_;
44 | };
45 |
46 | } // namespace caffe
47 |
48 | #endif // CAFFE_MVN_LAYER_HPP_
49 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/neuron_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_NEURON_LAYER_HPP_
2 | #define CAFFE_NEURON_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief An interface for layers that take one blob as input (@f$ x @f$)
14 | * and produce one equally-sized blob as output (@f$ y @f$), where
15 | * each element of the output depends only on the corresponding input
16 | * element.
17 | */
18 | template
19 | class NeuronLayer : public Layer {
20 | public:
21 | explicit NeuronLayer(const LayerParameter& param)
22 | : Layer(param) {}
23 | virtual void Reshape(const vector*>& bottom,
24 | const vector*>& top);
25 |
26 | virtual inline int ExactNumBottomBlobs() const { return 1; }
27 | virtual inline int ExactNumTopBlobs() const { return 1; }
28 | };
29 |
30 | } // namespace caffe
31 |
32 | #endif // CAFFE_NEURON_LAYER_HPP_
33 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/normalize_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_NORMALIZE_LAYER_HPP_
2 | #define CAFFE_NORMALIZE_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/blob.hpp"
7 | #include "caffe/layer.hpp"
8 | #include "caffe/proto/caffe.pb.h"
9 |
10 | namespace caffe {
11 |
12 | /**
13 | * @brief Normalizes the input to have L_p norm of 1 with scale learnable.
14 | *
15 | * TODO(weiliu89): thorough documentation for Forward, Backward, and proto params.
16 | */
17 | template
18 | class NormalizeLayer : public Layer {
19 | public:
20 | explicit NormalizeLayer(const LayerParameter& param)
21 | : Layer(param) {}
22 | virtual void LayerSetUp(const vector*>& bottom,
23 | const vector*>& top);
24 | virtual void Reshape(const vector*>& bottom,
25 | const vector*>& top);
26 |
27 | virtual inline const char* type() const { return "Normalize"; }
28 | virtual inline int ExactNumBottomBlobs() const { return 1; }
29 | virtual inline int ExactNumTopBlobs() const { return 1; }
30 |
31 | protected:
32 | virtual void Forward_cpu(const vector*>& bottom,
33 | const vector*>& top);
34 | virtual void Forward_gpu(const vector*>& bottom,
35 | const vector*>& top);
36 | virtual void Backward_cpu(const vector*>& top,
37 | const vector& propagate_down, const vector*>& bottom);
38 | virtual void Backward_gpu(const vector*>& top,
39 | const vector& propagate_down, const vector*>& bottom);
40 |
41 | Blob norm_;
42 | Blob sum_channel_multiplier_, sum_spatial_multiplier_;
43 | Blob buffer_, buffer_channel_, buffer_spatial_;
44 | bool across_spatial_;
45 | bool channel_shared_;
46 | Dtype eps_;
47 | };
48 |
49 | } // namespace caffe
50 |
51 | #endif // CAFFE_MVN_LAYER_HPP_
52 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/parameter_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_PARAMETER_LAYER_HPP_
2 | #define CAFFE_PARAMETER_LAYER_HPP_
3 |
4 | #include
5 |
6 | #include "caffe/layer.hpp"
7 |
8 | namespace caffe {
9 |
10 | template
11 | class ParameterLayer : public Layer {
12 | public:
13 | explicit ParameterLayer(const LayerParameter& param)
14 | : Layer(param) {}
15 | virtual void LayerSetUp(const vector*>& bottom,
16 | const vector*>& top) {
17 | if (this->blobs_.size() > 0) {
18 | LOG(INFO) << "Skipping parameter initialization";
19 | } else {
20 | this->blobs_.resize(1);
21 | this->blobs_[0].reset(new Blob());
22 | this->blobs_[0]->Reshape(this->layer_param_.parameter_param().shape());
23 | }
24 | top[0]->Reshape(this->layer_param_.parameter_param().shape());
25 | }
26 | virtual void Reshape(const vector*>& bottom,
27 | const vector*>& top) { }
28 | virtual inline const char* type() const { return "Parameter"; }
29 | virtual inline int ExactNumBottomBlobs() const { return 0; }
30 | virtual inline int ExactNumTopBlobs() const { return 1; }
31 |
32 | protected:
33 | virtual void Forward_cpu(const vector*>& bottom,
34 | const vector*>& top) {
35 | top[0]->ShareData(*(this->blobs_[0]));
36 | top[0]->ShareDiff(*(this->blobs_[0]));
37 | }
38 | virtual void Backward_cpu(const vector*>& top,
39 | const vector& propagate_down, const vector*>& bottom)
40 | { }
41 | };
42 |
43 | } // namespace caffe
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/tool/caffe/include/caffe/layers/rnn_layer.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CAFFE_RNN_LAYER_HPP_
2 | #define CAFFE_RNN_LAYER_HPP_
3 |
4 | #include
5 | #include