Add json detection creation for codalab check
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes=80);
|
||||
void preprocess(cv::Mat &frame);
|
||||
void postprocess();
|
||||
void postprocess(const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "tkdnn.h"
|
||||
|
||||
//#define OPENCV_CUDACONTRIB //if OPENCV has been compiled with CUDA and contrib.
|
||||
#define OPENCV_CUDACONTRIB //if OPENCV has been compiled with CUDA and contrib.
|
||||
|
||||
#ifdef OPENCV_CUDACONTRIB
|
||||
#include <opencv2/cudawarping.hpp>
|
||||
@@ -55,11 +55,11 @@ class DetectionNN {
|
||||
* boundig boxes.
|
||||
*
|
||||
*/
|
||||
virtual void postprocess() = 0;
|
||||
virtual void postprocess(const bool mAP=false) = 0;
|
||||
|
||||
public:
|
||||
int classes = 0;
|
||||
float confThreshold = 0.3; /*threshold on the confidence of the boxes*/
|
||||
float confThreshold = 0.05; /*threshold on the confidence of the boxes*/
|
||||
|
||||
std::vector<tk::dnn::box> detected; /*bounding boxes in output*/
|
||||
std::vector<double> stats; /*keeps track of inference times (ms)*/
|
||||
@@ -86,7 +86,7 @@ class DetectionNN {
|
||||
* are saved on a csv file, otherwise not.
|
||||
* @param times pointer to the output stream where to write times
|
||||
*/
|
||||
void update(cv::Mat &frame, bool save_times=false, std::ofstream *times=nullptr){
|
||||
void update(cv::Mat &frame, bool save_times=false, std::ofstream *times=nullptr, const bool mAP=false){
|
||||
if(!frame.data)
|
||||
FatalError("No image data feed to detection");
|
||||
|
||||
@@ -116,7 +116,7 @@ class DetectionNN {
|
||||
|
||||
{
|
||||
TIMER_START
|
||||
postprocess();
|
||||
postprocess(mAP);
|
||||
TIMER_STOP
|
||||
if(save_times) *times<<t_ns<<"\n";
|
||||
}
|
||||
|
||||
@@ -535,6 +535,7 @@ struct box {
|
||||
int cl;
|
||||
float x, y, w, h;
|
||||
float prob;
|
||||
std::vector<float> probs;
|
||||
|
||||
void print()
|
||||
{
|
||||
@@ -581,7 +582,7 @@ public:
|
||||
|
||||
dnnType *predictions;
|
||||
|
||||
static const int MAX_DETECTIONS = 2048;
|
||||
static const int MAX_DETECTIONS = 8192;
|
||||
static Yolo::detection *allocateDetections(int nboxes, int classes);
|
||||
static void mergeDetections(Yolo::detection *dets, int ndets, int classes);
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes);
|
||||
void preprocess(cv::Mat &frame);
|
||||
void postprocess();
|
||||
void postprocess(const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes=80);
|
||||
void preprocess(cv::Mat &frame);
|
||||
void postprocess();
|
||||
void postprocess(const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -108,6 +108,9 @@ void computeTPFPFN( std::vector<Frame> &images,const int classes,
|
||||
bool verbose=false, const bool write_on_file=false,
|
||||
std::string net="");
|
||||
|
||||
|
||||
void printJsonCOCOFormat(std::ofstream *out_file, const std::string image_path, std::vector<tk::dnn::box> bbox, const int classes, const int w, const int h);
|
||||
|
||||
}}
|
||||
#endif /*EVALUATION_H*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user