VisionServer  v2.1.1-1-g21dc5465
FRC vision library
AxonRunner_< derived_t > Class Template Reference

#include <tfmodel.h>

+ Inheritance diagram for AxonRunner_< derived_t >:
+ Collaboration diagram for AxonRunner_< derived_t >:

Public Member Functions

 AxonRunner_ (size_t th=default_threading)
 
 AxonRunner_ (const char *model, Optimization opt=Optimization::DEFAULT, const char *map=default_labels, size_t th=default_threading)
 
 AxonRunner_ (std::initializer_list< std::pair< const char *, Optimization > >, const char *map=default_labels, size_t=default_threading)
 
bool isValidOutput () const
 
size_t getDetections () const
 
bool isValidIdx (size_t idx) const
 
virtual void process (cv::Mat &io_frame) override
 
- Public Member Functions inherited from vs2::VisionServer::BasePipe
const std::string & getName () const
 
const std::shared_ptr< nt::NetworkTable > & getTable () const
 
virtual void init ()
 
virtual void close ()
 
- Public Member Functions inherited from TfModel
 TfModel ()=delete
 
 TfModel (std::initializer_list< std::pair< const char *, Optimization > >, size_t=default_threading)
 
 TfModel (const char *def, const char *edge, size_t th=default_threading)
 
 TfModel (const char *m, size_t t=default_threading)
 
 TfModel (const TfModel &)=delete
 
 operator bool () const
 
bool isValid () const
 
bool isValidBuffer () const
 

Protected Member Functions

float getX1 (size_t idx) const
 
float getY1 (size_t idx) const
 
float getX2 (size_t idx) const
 
float getY2 (size_t idx) const
 
const std::string & getLabel (size_t idx) const
 
uint32_t getConfidence (size_t idx) const
 
- Protected Member Functions inherited from vs2::VPipeline< AxonRunner_< void > >
 VPipeline ()=delete
 
 VPipeline (const VPipeline &)=delete
 
 VPipeline (const char *name)
 
 VPipeline (const std::string &name)
 
 VPipeline (std::string &&name)
 
virtual ~VPipeline ()=default
 
- Protected Member Functions inherited from vs2::VisionServer::BasePipe
 BasePipe (const char *name)
 
 BasePipe (const std::string &name)
 
 BasePipe (std::string &&name)
 
 BasePipe ()=delete
 
void setCamera (const VisionCamera &)
 
void setPipeline (const BasePipe &)
 
void setSource (const cs::VideoSource &)
 
void getFrame (cv::Mat &)
 
const cv::Mat1f & getSrcMatrix () const
 
const cv::Mat1f & getSrcDistort () const
 

Protected Attributes

std::vector< std::string > obj_labels
 
const float * coords
 
const float * labels
 
const float * confidence
 
const float * detections
 
- Protected Attributes inherited from TfModel
std::unique_ptr< tflite::FlatBufferModel > map
 
std::unique_ptr< tflite::Interpreter > model
 
std::shared_ptr< edgetpu::EdgeTpuContext > edgetpu_context
 
tflite::ops::builtin::BuiltinOpResolver resolver
 
cv::Mat input_tensor
 
cv::Size input_size
 

Private Types

typedef struct AxonRunner_< derived_t > This_t
 

Additional Inherited Members

- Public Types inherited from TfModel
enum class  Optimization { DEFAULT , EDGETPU }
 
- Public Types inherited from AxonRunner_B
enum class  OutputTensor { BOX_COORDS = 0 , LABEL_IDX = 1 , CONFIDENCE = 2 , DETECTIONS = 3 }
 
- Static Public Member Functions inherited from vs2::VisionServer::BasePipe
static const std::shared_ptr< nt::NetworkTable > & ntable ()
 
- Static Public Attributes inherited from TfModel
static size_t default_threading {std::thread::hardware_concurrency() / 2}
 
- Static Public Attributes inherited from AxonRunner_B
static const char * default_model = "unoptimized.tflite"
 
static const char * edgetpu_model = "model.tflite"
 
static const char * default_labels = "map.pbtxt"
 

Detailed Description

template<class derived_t = void>
class AxonRunner_< derived_t >

Runs an Axon-generated or similar object classification tflite model within a vision pipeline

Definition at line 79 of file tfmodel.h.

Member Typedef Documentation

◆ This_t

template<class derived_t = void>
typedef struct AxonRunner_< derived_t > AxonRunner_< derived_t >::This_t
private

Definition at line 80 of file tfmodel.h.

Constructor & Destructor Documentation

◆ AxonRunner_() [1/3]

template<class derived_t = void>
AxonRunner_< derived_t >::AxonRunner_ ( size_t  th = default_threading)
inline

Definition at line 82 of file tfmodel.h.

◆ AxonRunner_() [2/3]

template<class derived_t = void>
AxonRunner_< derived_t >::AxonRunner_ ( const char *  model,
Optimization  opt = Optimization::DEFAULT,
const char *  map = default_labels,
size_t  th = default_threading 
)
inline

Definition at line 84 of file tfmodel.h.

◆ AxonRunner_() [3/3]

template<class derived_t >
AxonRunner_< derived_t >::AxonRunner_ ( std::initializer_list< std::pair< const char *, Optimization > >  options,
const char *  map = default_labels,
size_t  th = default_threading 
)

tfmodel.inc

Definition at line 207 of file tfmodel.h.

Member Function Documentation

◆ isValidOutput()

template<class derived_t = void>
bool AxonRunner_< derived_t >::isValidOutput ( ) const
inline

Definition at line 88 of file tfmodel.h.

◆ getDetections()

template<class derived_t = void>
size_t AxonRunner_< derived_t >::getDetections ( ) const
inline

Definition at line 90 of file tfmodel.h.

◆ isValidIdx()

template<class derived_t = void>
bool AxonRunner_< derived_t >::isValidIdx ( size_t  idx) const
inline

Definition at line 91 of file tfmodel.h.

◆ process()

template<class derived_t >
void AxonRunner_< derived_t >::process ( cv::Mat &  io_frame)
overridevirtual

Reimplemented from vs2::VPipeline< AxonRunner_< void > >.

Definition at line 220 of file tfmodel.h.

◆ getX1()

template<class derived_t = void>
float AxonRunner_< derived_t >::getX1 ( size_t  idx) const
inlineprotected

Definition at line 96 of file tfmodel.h.

◆ getY1()

template<class derived_t = void>
float AxonRunner_< derived_t >::getY1 ( size_t  idx) const
inlineprotected

Definition at line 97 of file tfmodel.h.

◆ getX2()

template<class derived_t = void>
float AxonRunner_< derived_t >::getX2 ( size_t  idx) const
inlineprotected

Definition at line 98 of file tfmodel.h.

◆ getY2()

template<class derived_t = void>
float AxonRunner_< derived_t >::getY2 ( size_t  idx) const
inlineprotected

Definition at line 99 of file tfmodel.h.

◆ getLabel()

template<class derived_t = void>
const std::string & AxonRunner_< derived_t >::getLabel ( size_t  idx) const
inlineprotected

Definition at line 100 of file tfmodel.h.

◆ getConfidence()

template<class derived_t = void>
uint32_t AxonRunner_< derived_t >::getConfidence ( size_t  idx) const
inlineprotected

Definition at line 101 of file tfmodel.h.

Member Data Documentation

◆ obj_labels

template<class derived_t = void>
std::vector<std::string> AxonRunner_< derived_t >::obj_labels
protected

Definition at line 103 of file tfmodel.h.

◆ coords

template<class derived_t = void>
const float* AxonRunner_< derived_t >::coords
protected

Definition at line 105 of file tfmodel.h.

◆ labels

template<class derived_t = void>
const float * AxonRunner_< derived_t >::labels
protected

Definition at line 106 of file tfmodel.h.

◆ confidence

template<class derived_t = void>
const float * AxonRunner_< derived_t >::confidence
protected

Definition at line 107 of file tfmodel.h.

◆ detections

template<class derived_t = void>
const float * AxonRunner_< derived_t >::detections
protected

Definition at line 108 of file tfmodel.h.


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