Skip to content

Commit

Permalink
Added licence headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Lyudvichenko committed Aug 22, 2015
1 parent fb66acb commit f8715f3
Show file tree
Hide file tree
Showing 55 changed files with 2,385 additions and 397 deletions.
41 changes: 41 additions & 0 deletions modules/dnn/include/opencv2/dnn.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_HPP__
#define __OPENCV_DNN_HPP__

Expand Down
57 changes: 50 additions & 7 deletions modules/dnn/include/opencv2/dnn/blob.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_DNN_BLOB_HPP__
#define __OPENCV_DNN_DNN_BLOB_HPP__
#include <opencv2/core.hpp>
Expand Down Expand Up @@ -44,8 +85,9 @@ namespace dnn
CV_EXPORTS std::ostream &operator<< (std::ostream &stream, const BlobShape &shape);


/** @brief provides convenient methods for continuous n-dimensional array processing, dedicated for convolution neural networks
It's realized as wrapper over \ref cv::Mat and \ref cv::UMat and will support methods for CPU/GPU switching
/** @brief Provides convenient methods for continuous n-dimensional array processing, dedicated for convolution neural networks.
*
* It's realized as wrapper over @ref cv::Mat and @ref cv::UMat and will support methods for CPU/GPU switching.
*/
class CV_EXPORTS Blob
{
Expand Down Expand Up @@ -76,15 +118,15 @@ namespace dnn

/** @brief returns size of corresponding dimension (axis)
@param axis dimension index
Python-like indexing is supported, so \p axis can be negative, i. e. -1 is last dimension.
Python-like indexing is supported, so @p axis can be negative, i. e. -1 is last dimension.
Supposed that size of non-existing dimensions equal to 1, so the method always finished.
*/
int xsize(int axis) const;

/** @brief returns size of corresponding dimension (axis)
@param axis dimension index
Python-like indexing is supported, so \p axis can be negative, i. e. -1 is last dimension.
@note Unlike xsize(), if \p axis points to non-existing dimension then an error will be generated.
Python-like indexing is supported, so @p axis can be negative, i. e. -1 is last dimension.
@note Unlike xsize(), if @p axis points to non-existing dimension then an error will be generated.
*/
int size(int axis) const;

Expand Down Expand Up @@ -123,11 +165,12 @@ namespace dnn
float *ptrf(int n = 0, int cn = 0, int row = 0, int col = 0);
//TODO: add const ptr methods

/** @brief share data with other blob and returns *this
/** @brief Share data with other blob.
@returns *this
*/
Blob &shareFrom(const Blob &blob);
/** @brief adjust blob shape to required (data reallocated if needed)

/** @brief Adjust blob shape to required (data reallocated if needed).
@returns *this
*/
Blob &reshape(const BlobShape &shape);
Expand Down
41 changes: 41 additions & 0 deletions modules/dnn/include/opencv2/dnn/blob.inl.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_DNN_BLOB_INL_HPP__
#define __OPENCV_DNN_DNN_BLOB_INL_HPP__
#include "blob.hpp"
Expand Down
41 changes: 41 additions & 0 deletions modules/dnn/include/opencv2/dnn/dict.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_DNN_DICT_HPP__
#define __OPENCV_DNN_DNN_DICT_HPP__

Expand Down
92 changes: 75 additions & 17 deletions modules/dnn/include/opencv2/dnn/dnn.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_DNN_HPP__
#define __OPENCV_DNN_DNN_HPP__

Expand All @@ -10,48 +51,65 @@ namespace cv
{
namespace dnn
{
/** @brief initialize dnn module and built-in layers
/** @brief Initialize dnn module and built-in layers.
*
* This function automatically called on most of OpenCV builds,
* but you need to call it manually on some specific configurations.
*/
CV_EXPORTS void initModule();

/** @brief
*
*
* */
struct CV_EXPORTS LayerParams : public Dict
{
///list of learned parameters stored as blobs
std::vector<Blob> blobs;
std::vector<Blob> blobs; //!< List of learned parameters stored as blobs.

///optional, name of the layer instance (can be used internal purposes)
String name;
///optional, type name which was used for creating layer by layer factory
String type;
String name; //!< Name of the layer instance (optional, can be used internal purposes).
String type; //!< Type name which was used for creating layer by layer factory (optional).
};

///Interface class allows to build new Layers
/** @brief Interface class allows to build new Layers.
*/
struct CV_EXPORTS Layer
{
///list of learned parameters must be stored here to allow read them using Net::getParam()
///List of learned parameters must be stored here to allow read them by using Net::getParam().
std::vector<Blob> blobs;

//shape of output blobs must be adjusted with respect to shape of input blobs
virtual void allocate(const std::vector<Blob*> &inputs, std::vector<Blob> &outputs) = 0;
/** @brief Allocates internal buffers and output blobs with respect to the shape of inputs.
* @param[in] inputs vector of already allocated input blobs
* @param[out] outputs vector of output blobs, which must be allocated
*
* This method must create each produced blob according to shape of @p input blobs and internal layer params.
* If this method is called first time then @p output vector consists from empty blobs and its size determined by number of output connections.
* This method can be called multiple times if size of any @p input blob was changed.
*/
virtual void allocate(const std::vector<Blob*> &input, std::vector<Blob> &output) = 0;

virtual void forward(std::vector<Blob*> &inputs, std::vector<Blob> &outputs) = 0;

//each input and output can be labeled to easily identify them using "<layer_name>[.output_name]" notation
/** @brief Returns index of input blob into the input array.
* @param inputName label of input blob
*
* Each input and output blob can be labeled to easily identify them using "<layer_name>[.output_name]" notation.
* This method map label of input blob to its index into input vector.
*/
virtual int inputNameToIndex(String inputName);
/** @brief Returns index of output blob in output array.
* @see inputNameToIndex()
*/
virtual int outputNameToIndex(String outputName);

String name; //!< name of the layer instance, can be used for logging or other internal purposes
String type; //!< type name which was used for creating layer by layer factory
String name; //!< Name of the layer instance, can be used for logging or other internal purposes.
String type; //!< Type name which was used for creating layer by layer factory.

Layer();
explicit Layer(const LayerParams &params); //!< intialize only #name, #type and #blobs fields
explicit Layer(const LayerParams &params); //!< Intialize only #name, #type and #blobs fields.
virtual ~Layer();
};

//containers for String and int
typedef DictValue LayerId;
typedef DictValue LayerId; //!< Container for strings and integers.

class CV_EXPORTS Net
{
Expand Down
41 changes: 41 additions & 0 deletions modules/dnn/include/opencv2/dnn/dnn.inl.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef __OPENCV_DNN_DNN_INL_HPP__
#define __OPENCV_DNN_DNN_INL_HPP__

Expand Down
Loading

0 comments on commit f8715f3

Please sign in to comment.