mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2026-09-24 23:33:08 +08:00
fix visualization
This commit is contained in:
@@ -52,6 +52,8 @@ public:
|
||||
this->rec_model_dir.assign(config_map_["rec_model_dir"]);
|
||||
|
||||
this->char_list_file.assign(config_map_["char_list_file"]);
|
||||
|
||||
this->visualize = bool(stoi(config_map_["visualize"]));
|
||||
}
|
||||
|
||||
bool use_gpu = false;
|
||||
@@ -76,6 +78,8 @@ public:
|
||||
|
||||
std::string char_list_file;
|
||||
|
||||
bool visualize = true;
|
||||
|
||||
void PrintConfigInfo();
|
||||
|
||||
private:
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
const int &max_side_len = 960,
|
||||
const double &det_db_thresh = 0.3,
|
||||
const double &det_db_box_thresh = 0.5,
|
||||
const double &det_db_unclip_ratio = 2.0) {
|
||||
const double &det_db_unclip_ratio = 2.0,
|
||||
const bool &visualize = true) {
|
||||
LoadModel(model_dir);
|
||||
|
||||
this->use_gpu_ = use_gpu;
|
||||
@@ -55,6 +56,8 @@ public:
|
||||
this->det_db_thresh_ = det_db_thresh;
|
||||
this->det_db_box_thresh_ = det_db_box_thresh;
|
||||
this->det_db_unclip_ratio_ = det_db_unclip_ratio;
|
||||
|
||||
this->visualize_ = visualize;
|
||||
}
|
||||
|
||||
// Load Paddle inference model
|
||||
@@ -77,6 +80,8 @@ private:
|
||||
double det_db_box_thresh_ = 0.5;
|
||||
double det_db_unclip_ratio_ = 2.0;
|
||||
|
||||
bool visualize_ = true;
|
||||
|
||||
std::vector<float> mean_ = {0.485f, 0.456f, 0.406f};
|
||||
std::vector<float> scale_ = {1 / 0.229f, 1 / 0.224f, 1 / 0.225f};
|
||||
bool is_scale_ = true;
|
||||
|
||||
@@ -26,12 +26,20 @@
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
namespace PaddleOCR {
|
||||
|
||||
class Utility {
|
||||
public:
|
||||
static std::vector<std::string> ReadDict(const std::string &path);
|
||||
|
||||
static void
|
||||
VisualizeBboxes(const cv::Mat &srcimg,
|
||||
const std::vector<std::vector<std::vector<int>>> &boxes);
|
||||
|
||||
template <class ForwardIterator>
|
||||
inline static size_t argmax(ForwardIterator first, ForwardIterator last) {
|
||||
return std::distance(first, std::max_element(first, last));
|
||||
|
||||
Reference in New Issue
Block a user