28#include <tiny-dnn/tiny_dnn/config.h>
29#include <tiny-dnn/tiny_dnn/util/aligned_allocator.h>
30#include <tiny-dnn/tiny_dnn/util/util.h>
31#include <opencv2/core/core.hpp>
91 typedef std::vector<tiny_dnn::float_t, tiny_dnn::aligned_allocator<tiny_dnn::float_t, 64> >
vec_t;
104 virtual tiny_dnn::index3d<size_t>
insize()
const = 0;
108 virtual void train(std::string
const & path) = 0;
114 virtual std::string
const &
category(
size_t idx)
const = 0;
122template <
typename NetType>
133 virtual tiny_dnn::index3d<size_t>
insize()
const override;
136 vec_t process(cv::Mat
const & img,
bool normalize =
true)
override;
Abstract base class for an object recognition component.
virtual std::string const & category(size_t idx) const =0
Return the name of a given category (0-based index in the vector of results)
virtual ~ObjectRecognitionBase()
Virtual destructor for safe inheritance.
std::vector< tiny_dnn::float_t, tiny_dnn::aligned_allocator< tiny_dnn::float_t, 64 > > vec_t
Type used by tiny-dnn for the results:
virtual tiny_dnn::index3d< size_t > insize() const =0
Get the input size for the current network, useful to prepare inputs to process()
virtual vec_t process(cv::Mat const &img, bool normalize=true)=0
Process an image, results are confidence for each category.
virtual void define()=0
Define the network structure.
virtual void train(std::string const &path)=0
Train the network.
Wrapper around a neural network implemented by with the tiny-dnn framework by Taiga Nomi.
virtual tiny_dnn::index3d< size_t > insize() const override
Get the input size for the current network, useful to prepare inputs to process()
vec_t process(cv::Mat const &img, bool normalize=true) override
Process an image, results are confidence for each category.
tiny_dnn::network< NetType > * net
virtual ~ObjectRecognition()
Destructor.
virtual void postInit() override
Initialize the network, required before one starts using it.