41 "dataroot, datacfg, cfgfile, weightfile, and namefile for the chosen network.",
42 Net::Tiny, Net_Values, ParamCateg);
46 "If empty, use the module's path.",
47 JEVOIS_SHARE_PATH
"/darknet/single", ParamCateg);
52 "cfg/imagenet1k.data", ParamCateg);
57 "cfg/tiny.cfg", ParamCateg);
62 "weights/tiny.weights", ParamCateg);
67 "config file (if relative, relative to dataroot)",
97 public jevois::Parameter<dknet::netw, dknet::dataroot, dknet::datacfg, dknet::cfgfile,
98 dknet::weightfile, dknet::namefile, dknet::top, dknet::thresh, dknet::threads>
104 Darknet(std::string
const & instance,
bool show_detail_params =
false);
121 float predict(cv::Mat
const & cvimg, std::vector<jevois::ObjReco> & results);
128 float predict(image & im, std::vector<jevois::ObjReco> & results);
147 void onParamChange(dknet::netw
const & param, dknet::Net
const & newval)
override;
148 void onParamChange(dknet::dataroot
const & param, std::string
const & newval)
override;
149 void onParamChange(dknet::datacfg
const & param, std::string
const & newval)
override;
150 void onParamChange(dknet::cfgfile
const & param, std::string
const & newval)
override;
151 void onParamChange(dknet::weightfile
const & param, std::string
const & newval)
override;
152 void onParamChange(dknet::namefile
const & param, std::string
const & newval)
override;
Identify an object using Darknet deep neural network.
void postInit() override
Initialize, configure and load the network in a thread.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(datacfg, std::string, "Data configuration file (if relative, relative to " "dataroot)", "cfg/imagenet1k.data", ParamCateg)
Parameter.
float predict(cv::Mat const &cvimg, std::vector< jevois::ObjReco > &results)
Processing function, results are stored internally in the underlying Darknet network object.
std::future< void > itsReadyFut
void onParamChange(dknet::netw const ¶m, dknet::Net const &newval) override
void getInDims(int &w, int &h, int &c)
Get input width, height, channels.
JEVOIS_DECLARE_PARAMETER(threads, int, "Number of parallel computation threads", 6, jevois::Range< int >(1, 1024), ParamCateg)
Parameter.
bool const itsShowDetailParams
JEVOIS_DECLARE_PARAMETER(top, unsigned int, "Max number of top-scoring predictions that score above thresh to return", 5, ParamCateg)
Parameter.
std::atomic< bool > itsNeedReload
virtual ~Darknet()
Virtual destructor for safe inheritance.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(weightfile, std::string, "Network weights file (if relative, relative to " "dataroot)", "weights/tiny.weights", ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(namefile, std::string, "Category names file, or empty to fetch it from the " "network " "config file (if relative, relative to dataroot)", "", ParamCateg)
Parameter.
std::atomic< bool > itsReady
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cfgfile, std::string, "Network configuration file (if relative, relative to " "dataroot)", "cfg/tiny.cfg", ParamCateg)
Parameter.
JEVOIS_DEFINE_ENUM_CLASS(Net,(Reference)(Tiny))
Enum.
void postUninit() override
Un-initialize and free resources.
JEVOIS_DECLARE_PARAMETER(thresh, float, "Threshold (in percent confidence) above which predictions will be reported", 20.0F, jevois::Range< float >(0.0F, 100.0F), ParamCateg)
Parameter.
void resizeInDims(int w, int h)
Resize the network's input image dims.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(netw, Net, "Network to load. This meta-parameter sets parameters " "dataroot, datacfg, cfgfile, weightfile, and namefile for the chosen network.", Net::Tiny, Net_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(dataroot, std::string, "Root path for data, config, and weight files. " "If empty, use the module's path.", JEVOIS_SHARE_PATH "/darknet/single", ParamCateg)
Parameter.