JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
ObjectRecognitionCIFAR Class Reference

Object recognition CNN for CIFAR-10 dataset. More...

#include <jevoisbase/Components/ObjectRecognition/ObjectRecognitionCIFAR.H>

Inheritance diagram for ObjectRecognitionCIFAR:
Collaboration diagram for ObjectRecognitionCIFAR:

Public Member Functions

 ObjectRecognitionCIFAR (std::string const &instance)
 Constructor, loads the given CNN, its sizes must match our (fixed) internal network structure.
 
virtual ~ObjectRecognitionCIFAR ()
 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 &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor, 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 &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor, 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
 

Detailed Description

Object recognition CNN for CIFAR-10 dataset.

Definition at line 25 of file ObjectRecognitionCIFAR.H.

Constructor & Destructor Documentation

◆ ObjectRecognitionCIFAR()

ObjectRecognitionCIFAR::ObjectRecognitionCIFAR ( 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 23 of file ObjectRecognitionCIFAR.C.

◆ ~ObjectRecognitionCIFAR()

ObjectRecognitionCIFAR::~ObjectRecognitionCIFAR ( )
virtual

Destructor.

Definition at line 28 of file ObjectRecognitionCIFAR.C.

Member Function Documentation

◆ category()

std::string const & ObjectRecognitionCIFAR::category ( size_t  idx) const
overridevirtual

Return the name of a given category (0-based index in the vector of results)

Implements ObjectRecognitionBase.

Definition at line 108 of file ObjectRecognitionCIFAR.C.

References LFATAL.

◆ define()

void ObjectRecognitionCIFAR::define ( )
overridevirtual

Define the network structure.

< number of feature maps for upper layer

< number of feature maps for lower layer

< number of hidden units in fully-connected layer

Implements ObjectRecognitionBase.

Definition at line 34 of file ObjectRecognitionCIFAR.C.

◆ train()

void ObjectRecognitionCIFAR::train ( std::string const &  path)
overridevirtual

Train the network.

Implements ObjectRecognitionBase.

Definition at line 60 of file ObjectRecognitionCIFAR.C.

References LINFO, and ObjectRecognition< tiny_dnn::sequential >::net.


The documentation for this class was generated from the following files: