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

A class that represents a Darknet/YOLO configuration file. More...

#include "darknet_cfg.hpp"

Collaboration diagram for Darknet::CfgFile:

Classes

struct  CommonParms
 

Public Member Functions

 CfgFile ()
 Consructor.
 
 CfgFile (const std::filesystem::path &fn)
 Consructor. This automatically calls read().
 
 ~CfgFile ()
 Destructor.
 
CfgFileclear ()
 Reset the config file to be empty.
 
Darknet::Networkcreate_network (const int batch=1, int time_steps=1)
 Create and populate the Darknet Darknet::Network object net from the configuration that was parsed.
 
std::string debug () const
 Iterate over the content to record some debug information about the configuration.
 
bool empty () const
 Determine if a .cfg file has been parsed.
 
CfgFileread ()
 Read the specified configuration file.
 
CfgFileread (const std::filesystem::path &fn)
 Read the given configuration file and parses the individual sections and lines.
 

Public Attributes

std::filesystem::path filename
 The configuration file.
 
Darknet::Network net
 This will remain uninitialized until Darknet::CfgFile::create_network() is called.
 
CfgSection network_section
 The [net] or [network] is not a "real" section, nor is it a layer.
 
CfgSections sections
 This is where we'll store every section except for the [net] one.
 
size_t total_lines
 The total number of lines that was parsed from the .cfg file, including comments and blank lines.
 
CommonParms parms
 

Private Member Functions

CfgFileparse_net_section ()
 
Darknet::Layer parse_convolutional_section (const size_t section_idx)
 
Darknet::Layer parse_route_section (const size_t section_idx)
 
Darknet::Layer parse_maxpool_section (const size_t section_idx)
 
Darknet::Layer parse_yolo_section (const size_t section_idx)
 
Darknet::Layer parse_upsample_section (const size_t section_idx)
 
Darknet::Layer parse_shortcut_section (const size_t section_idx)
 
Darknet::Layer parse_connected_section (const size_t section_idx)
 
Darknet::Layer parse_crnn_section (const size_t section_idx)
 
Darknet::Layer parse_rnn_section (const size_t section_idx)
 
Darknet::Layer parse_local_avgpool_section (const size_t section_idx)
 
Darknet::Layer parse_lstm_section (const size_t section_idx)
 
Darknet::Layer parse_reorg_section (const size_t section_idx)
 
Darknet::Layer parse_avgpool_section (const size_t section_idx)
 
Darknet::Layer parse_cost_section (const size_t section_idx)
 
Darknet::Layer parse_region_section (const size_t section_idx)
 
Darknet::Layer parse_gaussian_yolo_section (const size_t section_idx)
 
Darknet::Layer parse_contrastive_section (const size_t section_idx)
 
Darknet::Layer parse_softmax_section (const size_t section_idx)
 
Darknet::Layer parse_scale_channels_section (const size_t section_idx)
 
Darknet::Layer parse_sam_section (const size_t section_idx)
 
Darknet::Layer parse_dropout_section (const size_t section_idx)
 

Detailed Description

A class that represents a Darknet/YOLO configuration file.

Contains various sections, which in turn has lines representing all of the options for each given section. Typical use is to call read() followed by create_network().

Constructor & Destructor Documentation

◆ CfgFile() [1/2]

Darknet::CfgFile::CfgFile ( )

Consructor.

◆ CfgFile() [2/2]

Darknet::CfgFile::CfgFile ( const std::filesystem::path &  fn)

Consructor. This automatically calls read().

Here is the call graph for this function:

◆ ~CfgFile()

Darknet::CfgFile::~CfgFile ( )

Destructor.

Member Function Documentation

◆ clear()

Darknet::CfgFile & Darknet::CfgFile::clear ( )

Reset the config file to be empty.

Note
This does not call free_network().
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_network()

Darknet::Network & Darknet::CfgFile::create_network ( const int  batch = 1,
int  time_steps = 1 
)

Create and populate the Darknet Darknet::Network object net from the configuration that was parsed.

Note
The read() method must be called prior to create_network().
Warning
The CfgFile destructor does not call free_network()! This means the caller of CfgFile::create_network() assumes ownership of the nework that is created. Callers must remember to call free_network() once they are done with the neural network created by this method.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug()

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

Iterate over the content to record some debug information about the configuration.

◆ empty()

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

Determine if a .cfg file has been parsed.

◆ parse_avgpool_section()

Darknet::Layer Darknet::CfgFile::parse_avgpool_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_connected_section()

Darknet::Layer Darknet::CfgFile::parse_connected_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_contrastive_section()

Darknet::Layer Darknet::CfgFile::parse_contrastive_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_convolutional_section()

Darknet::Layer Darknet::CfgFile::parse_convolutional_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_cost_section()

Darknet::Layer Darknet::CfgFile::parse_cost_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_crnn_section()

Darknet::Layer Darknet::CfgFile::parse_crnn_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_dropout_section()

Darknet::Layer Darknet::CfgFile::parse_dropout_section ( const size_t  section_idx)
private

<

Todo:
why read in a float and then store it in an int?
Here is the call graph for this function:

◆ parse_gaussian_yolo_section()

Darknet::Layer Darknet::CfgFile::parse_gaussian_yolo_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_local_avgpool_section()

Darknet::Layer Darknet::CfgFile::parse_local_avgpool_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_lstm_section()

Darknet::Layer Darknet::CfgFile::parse_lstm_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_maxpool_section()

Darknet::Layer Darknet::CfgFile::parse_maxpool_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_net_section()

Darknet::CfgFile & Darknet::CfgFile::parse_net_section ( )
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_region_section()

Darknet::Layer Darknet::CfgFile::parse_region_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_reorg_section()

Darknet::Layer Darknet::CfgFile::parse_reorg_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_rnn_section()

Darknet::Layer Darknet::CfgFile::parse_rnn_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_route_section()

Darknet::Layer Darknet::CfgFile::parse_route_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_sam_section()

Darknet::Layer Darknet::CfgFile::parse_sam_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_scale_channels_section()

Darknet::Layer Darknet::CfgFile::parse_scale_channels_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_shortcut_section()

Darknet::Layer Darknet::CfgFile::parse_shortcut_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_softmax_section()

Darknet::Layer Darknet::CfgFile::parse_softmax_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_upsample_section()

Darknet::Layer Darknet::CfgFile::parse_upsample_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ parse_yolo_section()

Darknet::Layer Darknet::CfgFile::parse_yolo_section ( const size_t  section_idx)
private

Methods to parse different types of sections in .cfg files. These are called from Darknet::CfgFile::read() and are not meant to be called directly.

Here is the call graph for this function:

◆ read() [1/2]

Darknet::CfgFile & Darknet::CfgFile::read ( )

Read the specified configuration file.

If you use the constructor where a filename is specified, then you don't need to manually call read(). The constructor will automatically call this method for you.

Note
Remember to call create_network() after read() has finished.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read() [2/2]

Darknet::CfgFile & Darknet::CfgFile::read ( const std::filesystem::path &  fn)

Read the given configuration file and parses the individual sections and lines.

Forgets about any configuration file specified in the constructor (if any).

Note
Remember to call create_network() after read() has finished.

Member Data Documentation

◆ filename

std::filesystem::path Darknet::CfgFile::filename

The configuration file.

◆ net

Darknet::Network Darknet::CfgFile::net

This will remain uninitialized until Darknet::CfgFile::create_network() is called.

Note
You must call free_network() once finished with the network! This network is not freed by the Darknet::CfgFile destructor.
See also
Darknet::CfgFile::create_network()
free_network()

◆ network_section

CfgSection Darknet::CfgFile::network_section

The [net] or [network] is not a "real" section, nor is it a layer.

This object is only populated after Darknet::CfgFile::read() has been called.

See also
sections

◆ parms

CommonParms Darknet::CfgFile::parms

◆ sections

CfgSections Darknet::CfgFile::sections

This is where we'll store every section except for the [net] one.

This is only populated after Darknet::CfgFile::read() has been called.

See also
network_section

◆ total_lines

size_t Darknet::CfgFile::total_lines

The total number of lines that was parsed from the .cfg file, including comments and blank lines.

This also acts as a line counter while the .cfg file is being parsed by Darknet::CfgFile::read().


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