Darknet/YOLO v3.0-177-gfa2353b
Object Detection Framework
 
Loading...
Searching...
No Matches
Darknet::CfgSection Class Referencefinal

A class that represents a specific section in a configuration file. More...

#include "darknet_cfg.hpp"

Collaboration diagram for Darknet::CfgSection:

Public Member Functions

 CfgSection ()
 Consructor.
 
 CfgSection (const std::string &l, const size_t ln)
 Consructor.
 
 ~CfgSection ()
 Destructor.
 
CfgSectionclear ()
 Reset the section to be empty.
 
std::string debug () const
 Iterate over the section and create a debug text message for every line.
 
bool empty () const
 Determine if a section is empty.
 
float find_float (const std::string &key, const float default_value)
 Find a float config item in lines. If the key does not exist, then the given default value is returned.
 
VFloat find_float_array (const std::string &key)
 Find an array of float values in lines. If the key does not exist, then an empty std::vector is returned.
 
int find_int (const std::string &key)
 Find an int config item in lines. The given key must exist.
 
int find_int (const std::string &key, const int default_value)
 Find an int config item in lines. If the key does not exist, then the given default value is returned.
 
VInt find_int_array (const std::string &key)
 Find an array of int values in lines. If the key does not exist, then an empty std::vector is returned.
 
std::string find_str (const std::string &key, const std::string &default_value="")
 Find a text config item in lines. If the key does not exist, then the given default value is returned.
 
const CfgSectionfind_unused_lines () const
 Verify that there are no "unused" lines in this section.
 

Public Attributes

size_t line_number
 Line number where this section starts.
 
CfgLines lines
 All of the non-empty lines within a section.
 
std::string name
 The name of the section (so we don't have to keep looking up the type).
 
ELayerType type
 The layer type for this section (e.g., [convolutional] or [yolo]).
 

Detailed Description

A class that represents a specific section in a configuration file.

The start of each section has a [name] delimiter which gives the section a name. For example, Darknet/YOLO config files start with either [net] or [network].

Note
Other than [net] or [network], the section names are not unique. For example, a .cfg file may have multiple [conv] or [yolo] sections.

Constructor & Destructor Documentation

◆ CfgSection() [1/2]

Darknet::CfgSection::CfgSection ( )

Consructor.

◆ CfgSection() [2/2]

Darknet::CfgSection::CfgSection ( const std::string &  l,
const size_t  ln 
)

Consructor.

◆ ~CfgSection()

Darknet::CfgSection::~CfgSection ( )

Destructor.

Member Function Documentation

◆ clear()

Darknet::CfgSection & Darknet::CfgSection::clear ( )

Reset the section to be empty.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug()

std::string Darknet::CfgSection::debug ( ) const

Iterate over the section and create a debug text message for every line.

Here is the call graph for this function:

◆ empty()

bool Darknet::CfgSection::empty ( ) const
inline

Determine if a section is empty.

◆ find_float()

float Darknet::CfgSection::find_float ( const std::string &  key,
const float  default_value 
)

Find a float config item in lines. If the key does not exist, then the given default value is returned.

Here is the call graph for this function:

◆ find_float_array()

Darknet::VFloat Darknet::CfgSection::find_float_array ( const std::string &  key)

Find an array of float values in lines. If the key does not exist, then an empty std::vector is returned.

◆ find_int() [1/2]

int Darknet::CfgSection::find_int ( const std::string &  key)

Find an int config item in lines. The given key must exist.

Here is the call graph for this function:

◆ find_int() [2/2]

int Darknet::CfgSection::find_int ( const std::string &  key,
const int  default_value 
)

Find an int config item in lines. If the key does not exist, then the given default value is returned.

Here is the call graph for this function:

◆ find_int_array()

Darknet::VInt Darknet::CfgSection::find_int_array ( const std::string &  key)

Find an array of int values in lines. If the key does not exist, then an empty std::vector is returned.

◆ find_str()

std::string Darknet::CfgSection::find_str ( const std::string &  key,
const std::string &  default_value = "" 
)

Find a text config item in lines. If the key does not exist, then the given default value is returned.

◆ find_unused_lines()

const Darknet::CfgSection & Darknet::CfgSection::find_unused_lines ( ) const

Verify that there are no "unused" lines in this section.

Here is the call graph for this function:

Member Data Documentation

◆ line_number

size_t Darknet::CfgSection::line_number

Line number where this section starts.

◆ lines

CfgLines Darknet::CfgSection::lines

All of the non-empty lines within a section.

◆ name

std::string Darknet::CfgSection::name

The name of the section (so we don't have to keep looking up the type).

◆ type

ELayerType Darknet::CfgSection::type

The layer type for this section (e.g., [convolutional] or [yolo]).


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