JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Object recognition CNN for ILAB-10 dataset. More...
#include <jevoisbase/Components/ObjectRecognition/ObjectRecognitionILAB.H>
Public Member Functions | |
ObjectRecognitionILAB (std::string const &instance) | |
Constructor, loads the given CNN, its sizes must match our (fixed) internal network structure. | |
virtual | ~ObjectRecognitionILAB () |
Destructor. | |
virtual void | define () override |
Define the network structure. | |
virtual void | train (std::string const &path) override |
Train the network. | |
virtual std::string const & | category (size_t idx) const override |
Return the name of a given category (0-based index in the vector of results) | |
Public Member Functions inherited from ObjectRecognition< tiny_dnn::sequential > | |
ObjectRecognition (std::string const &instance) | |
Constructor allocates the (empty) network. | |
virtual | ~ObjectRecognition () |
Destructor. | |
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. | |
Public Member Functions inherited from ObjectRecognitionBase | |
ObjectRecognitionBase (std::string const &instance) | |
Constructor. | |
virtual | ~ObjectRecognitionBase () |
Virtual destructor for safe inheritance. | |
Public Member Functions inherited from jevois::Component | |
Component (std::string const &instance) | |
virtual | ~Component () |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
Public Member Functions inherited from jevois::ParameterRegistry | |
virtual | ~ParameterRegistry () |
Additional Inherited Members | |
Public Types inherited from ObjectRecognitionBase | |
typedef 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: | |
Protected Member Functions inherited from ObjectRecognition< tiny_dnn::sequential > | |
virtual void | postInit () override |
Initialize the network, required before one starts using it. | |
Protected Member Functions inherited from jevois::Component | |
virtual void | preInit () |
virtual void | preUninit () |
virtual void | postUninit () |
virtual void | preInit () |
virtual void | preUninit () |
virtual void | postUninit () |
Protected Member Functions inherited from jevois::ParameterRegistry | |
void | addParameter (ParameterBase *const param) |
void | removeParameter (ParameterBase *const param) |
void | callbackInitCall () |
Protected Attributes inherited from ObjectRecognition< tiny_dnn::sequential > | |
tiny_dnn::network< tiny_dnn::sequential > * | net |
Object recognition CNN for ILAB-10 dataset.
Definition at line 25 of file ObjectRecognitionILAB.H.
ObjectRecognitionILAB::ObjectRecognitionILAB | ( | std::string const & | instance | ) |
Constructor, loads the given CNN, its sizes must match our (fixed) internal network structure.
All network data is assumed to be in the module's path plus "tiny-dnn/<instance>". In there, we will look for weights.tnn, and if not found, we will train the network using data in that path and then save weights.tnn.
Definition at line 34 of file ObjectRecognitionILAB.C.
|
virtual |
Destructor.
Definition at line 39 of file ObjectRecognitionILAB.C.
|
overridevirtual |
Return the name of a given category (0-based index in the vector of results)
Implements ObjectRecognitionBase.
Definition at line 231 of file ObjectRecognitionILAB.C.
References LFATAL.
|
overridevirtual |
Define the network structure.
< number of feature maps for upper layer
< number of hidden units in fully-connected layer
Implements ObjectRecognitionBase.
Definition at line 45 of file ObjectRecognitionILAB.C.
|
overridevirtual |
Train the network.
Implements ObjectRecognitionBase.
Definition at line 170 of file ObjectRecognitionILAB.C.
References LINFO, and ObjectRecognition< tiny_dnn::sequential >::net.