mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 15:39:04 +08:00
Merge pull request #1746 from stweil/fix
Fix some warnings from clang compiler
This commit is contained in:
commit
cf6c79d842
@ -1,8 +1,6 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* File: polyblk.cpp (Formerly poly_block.c)
|
* File: polyblk.cpp (Formerly poly_block.c)
|
||||||
* Description: Polygonal blocks
|
* Description: Polygonal blocks
|
||||||
* Author: Sheelagh Lloyd?
|
|
||||||
* Created:
|
|
||||||
*
|
*
|
||||||
* (C) Copyright 1993, Hewlett-Packard Ltd.
|
* (C) Copyright 1993, Hewlett-Packard Ltd.
|
||||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -45,14 +43,14 @@ POLY_BLOCK::POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize from box coordinates.
|
// Initialize from box coordinates.
|
||||||
POLY_BLOCK::POLY_BLOCK(const TBOX& box, PolyBlockType t) {
|
POLY_BLOCK::POLY_BLOCK(const TBOX& tbox, PolyBlockType t) {
|
||||||
vertices.clear();
|
vertices.clear();
|
||||||
ICOORDELT_IT v = &vertices;
|
ICOORDELT_IT v = &vertices;
|
||||||
v.move_to_first();
|
v.move_to_first();
|
||||||
v.add_to_end(new ICOORDELT(box.left(), box.top()));
|
v.add_to_end(new ICOORDELT(tbox.left(), tbox.top()));
|
||||||
v.add_to_end(new ICOORDELT(box.left(), box.bottom()));
|
v.add_to_end(new ICOORDELT(tbox.left(), tbox.bottom()));
|
||||||
v.add_to_end(new ICOORDELT(box.right(), box.bottom()));
|
v.add_to_end(new ICOORDELT(tbox.right(), tbox.bottom()));
|
||||||
v.add_to_end(new ICOORDELT(box.right(), box.top()));
|
v.add_to_end(new ICOORDELT(tbox.right(), tbox.top()));
|
||||||
compute_bb();
|
compute_bb();
|
||||||
type = t;
|
type = t;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class DLLSYM POLY_BLOCK {
|
|||||||
public:
|
public:
|
||||||
POLY_BLOCK() = default;
|
POLY_BLOCK() = default;
|
||||||
// Initialize from box coordinates.
|
// Initialize from box coordinates.
|
||||||
POLY_BLOCK(const TBOX& box, PolyBlockType type);
|
POLY_BLOCK(const TBOX& tbox, PolyBlockType type);
|
||||||
POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType type);
|
POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType type);
|
||||||
~POLY_BLOCK () = default;
|
~POLY_BLOCK () = default;
|
||||||
|
|
||||||
|
@ -408,6 +408,7 @@ void LSTMRecognizer::DebugActivationRange(const NetworkIO& outputs,
|
|||||||
// Helper returns true if the null_char is the winner at t, and it beats the
|
// Helper returns true if the null_char is the winner at t, and it beats the
|
||||||
// null_threshold, or the next choice is space, in which case we will use the
|
// null_threshold, or the next choice is space, in which case we will use the
|
||||||
// null anyway.
|
// null anyway.
|
||||||
|
#if 0 // TODO: unused, remove if still unused after 2020.
|
||||||
static bool NullIsBest(const NetworkIO& output, float null_thr,
|
static bool NullIsBest(const NetworkIO& output, float null_thr,
|
||||||
int null_char, int t) {
|
int null_char, int t) {
|
||||||
if (output.f(t)[null_char] >= null_thr) return true;
|
if (output.f(t)[null_char] >= null_thr) return true;
|
||||||
@ -415,6 +416,7 @@ static bool NullIsBest(const NetworkIO& output, float null_thr,
|
|||||||
return false;
|
return false;
|
||||||
return output.f(t)[null_char] > output.f(t)[UNICHAR_SPACE];
|
return output.f(t)[null_char] > output.f(t)[UNICHAR_SPACE];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Converts the network output to a sequence of labels. Outputs labels, scores
|
// Converts the network output to a sequence of labels. Outputs labels, scores
|
||||||
// and start xcoords of each char, and each null_char_, with an additional
|
// and start xcoords of each char, and each null_char_, with an additional
|
||||||
|
@ -244,7 +244,6 @@ Network* Network::CreateFromFile(TFile* fp) {
|
|||||||
network = new TFNetwork(stub.name_);
|
network = new TFNetwork(stub.name_);
|
||||||
#else
|
#else
|
||||||
tprintf("TensorFlow not compiled in! -DINCLUDE_TENSORFLOW\n");
|
tprintf("TensorFlow not compiled in! -DINCLUDE_TENSORFLOW\n");
|
||||||
return nullptr;
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
// All variants of FullyConnected.
|
// All variants of FullyConnected.
|
||||||
@ -259,15 +258,16 @@ Network* Network::CreateFromFile(TFile* fp) {
|
|||||||
network = new FullyConnected(stub.name_, stub.ni_, stub.no_, stub.type_);
|
network = new FullyConnected(stub.name_, stub.ni_, stub.no_, stub.type_);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
network->training_ = stub.training_;
|
if (network) {
|
||||||
network->needs_to_backprop_ = stub.needs_to_backprop_;
|
network->training_ = stub.training_;
|
||||||
network->network_flags_ = stub.network_flags_;
|
network->needs_to_backprop_ = stub.needs_to_backprop_;
|
||||||
network->num_weights_ = stub.num_weights_;
|
network->network_flags_ = stub.network_flags_;
|
||||||
if (!network->DeSerialize(fp)) {
|
network->num_weights_ = stub.num_weights_;
|
||||||
delete network;
|
if (!network->DeSerialize(fp)) {
|
||||||
return nullptr;
|
delete network;
|
||||||
|
network = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,9 @@ void NetworkIO::Resize2d(bool int_mode, int width, int num_features) {
|
|||||||
// Resizes to a specific stride_map.
|
// Resizes to a specific stride_map.
|
||||||
void NetworkIO::ResizeToMap(bool int_mode, const StrideMap& stride_map,
|
void NetworkIO::ResizeToMap(bool int_mode, const StrideMap& stride_map,
|
||||||
int num_features) {
|
int num_features) {
|
||||||
// If this assert fails, it most likely got here through an uninitialized
|
// If this method crashes with this == nullptr,
|
||||||
// scratch element, ie call NetworkScratch::IO::Resizexxx() not
|
// it most likely got here through an uninitialized scratch element,
|
||||||
// NetworkIO::Resizexxx()!!
|
// ie call NetworkScratch::IO::Resizexxx() not NetworkIO::Resizexxx()!!
|
||||||
ASSERT_HOST(this != nullptr);
|
|
||||||
stride_map_ = stride_map;
|
stride_map_ = stride_map;
|
||||||
int_mode_ = int_mode;
|
int_mode_ = int_mode;
|
||||||
if (int_mode_) {
|
if (int_mode_) {
|
||||||
|
Loading…
Reference in New Issue
Block a user