mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 12:49:35 +08:00
Avoid unnecessary conversions from std::string to char pointer
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
061e386125
commit
4a6efcd9b7
@ -76,7 +76,7 @@ FILE *OpenBoxFile(const char *fname) {
|
||||
bool ReadAllBoxes(int target_page, bool skip_blanks, const char *filename, std::vector<TBOX> *boxes,
|
||||
std::vector<std::string> *texts, std::vector<std::string> *box_texts,
|
||||
std::vector<int> *pages) {
|
||||
std::ifstream input(BoxFileName(filename).c_str(), std::ios::in | std::ios::binary);
|
||||
std::ifstream input(BoxFileName(filename), std::ios::in | std::ios::binary);
|
||||
if (input.fail()) {
|
||||
tprintf("Cannot read box data from '%s'.\n", BoxFileName(filename).c_str());
|
||||
tprintf("Does it exists?\n");
|
||||
|
@ -92,7 +92,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Check write permissions.
|
||||
std::string test_file = FLAGS_model_output.c_str();
|
||||
std::string test_file = FLAGS_model_output;
|
||||
test_file += "_wtest";
|
||||
FILE *f = fopen(test_file.c_str(), "wb");
|
||||
if (f != nullptr) {
|
||||
@ -107,10 +107,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Setup the trainer.
|
||||
std::string checkpoint_file = FLAGS_model_output.c_str();
|
||||
std::string checkpoint_file = FLAGS_model_output;
|
||||
checkpoint_file += "_checkpoint";
|
||||
std::string checkpoint_bak = checkpoint_file + ".bak";
|
||||
tesseract::LSTMTrainer trainer(FLAGS_model_output.c_str(), checkpoint_file.c_str(),
|
||||
tesseract::LSTMTrainer trainer(FLAGS_model_output, checkpoint_file,
|
||||
FLAGS_debug_interval,
|
||||
static_cast<int64_t>(FLAGS_max_image_MB) * 1048576);
|
||||
if (!trainer.InitCharSet(FLAGS_traineddata.c_str())) {
|
||||
|
@ -80,7 +80,7 @@ LSTMTrainer::LSTMTrainer()
|
||||
debug_interval_ = 0;
|
||||
}
|
||||
|
||||
LSTMTrainer::LSTMTrainer(const char *model_base, const char *checkpoint_name,
|
||||
LSTMTrainer::LSTMTrainer(const std::string &model_base, const std::string &checkpoint_name,
|
||||
int debug_interval, int64_t max_memory)
|
||||
: randomly_rotate_(false),
|
||||
training_data_(max_memory),
|
||||
|
@ -84,7 +84,8 @@ using TestCallback = std::function<std::string(int, const double *,
|
||||
class TESS_UNICHARSET_TRAINING_API LSTMTrainer : public LSTMRecognizer {
|
||||
public:
|
||||
LSTMTrainer();
|
||||
LSTMTrainer(const char *model_base, const char *checkpoint_name,
|
||||
LSTMTrainer(const std::string &model_base,
|
||||
const std::string &checkpoint_name,
|
||||
int debug_interval, int64_t max_memory);
|
||||
virtual ~LSTMTrainer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user