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)
|
||||
* Description: Polygonal blocks
|
||||
* Author: Sheelagh Lloyd?
|
||||
* Created:
|
||||
*
|
||||
* (C) Copyright 1993, Hewlett-Packard Ltd.
|
||||
** 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.
|
||||
POLY_BLOCK::POLY_BLOCK(const TBOX& box, PolyBlockType t) {
|
||||
POLY_BLOCK::POLY_BLOCK(const TBOX& tbox, PolyBlockType t) {
|
||||
vertices.clear();
|
||||
ICOORDELT_IT v = &vertices;
|
||||
v.move_to_first();
|
||||
v.add_to_end(new ICOORDELT(box.left(), box.top()));
|
||||
v.add_to_end(new ICOORDELT(box.left(), box.bottom()));
|
||||
v.add_to_end(new ICOORDELT(box.right(), box.bottom()));
|
||||
v.add_to_end(new ICOORDELT(box.right(), box.top()));
|
||||
v.add_to_end(new ICOORDELT(tbox.left(), tbox.top()));
|
||||
v.add_to_end(new ICOORDELT(tbox.left(), tbox.bottom()));
|
||||
v.add_to_end(new ICOORDELT(tbox.right(), tbox.bottom()));
|
||||
v.add_to_end(new ICOORDELT(tbox.right(), tbox.top()));
|
||||
compute_bb();
|
||||
type = t;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class DLLSYM POLY_BLOCK {
|
||||
public:
|
||||
POLY_BLOCK() = default;
|
||||
// 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 () = 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
|
||||
// null_threshold, or the next choice is space, in which case we will use the
|
||||
// null anyway.
|
||||
#if 0 // TODO: unused, remove if still unused after 2020.
|
||||
static bool NullIsBest(const NetworkIO& output, float null_thr,
|
||||
int null_char, int t) {
|
||||
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 output.f(t)[null_char] > output.f(t)[UNICHAR_SPACE];
|
||||
}
|
||||
#endif
|
||||
|
||||
// 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
|
||||
|
@ -244,7 +244,6 @@ Network* Network::CreateFromFile(TFile* fp) {
|
||||
network = new TFNetwork(stub.name_);
|
||||
#else
|
||||
tprintf("TensorFlow not compiled in! -DINCLUDE_TENSORFLOW\n");
|
||||
return nullptr;
|
||||
#endif
|
||||
break;
|
||||
// All variants of FullyConnected.
|
||||
@ -259,15 +258,16 @@ Network* Network::CreateFromFile(TFile* fp) {
|
||||
network = new FullyConnected(stub.name_, stub.ni_, stub.no_, stub.type_);
|
||||
break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
if (network) {
|
||||
network->training_ = stub.training_;
|
||||
network->needs_to_backprop_ = stub.needs_to_backprop_;
|
||||
network->network_flags_ = stub.network_flags_;
|
||||
network->num_weights_ = stub.num_weights_;
|
||||
if (!network->DeSerialize(fp)) {
|
||||
delete network;
|
||||
return nullptr;
|
||||
network = nullptr;
|
||||
}
|
||||
}
|
||||
return network;
|
||||
}
|
||||
|
@ -50,10 +50,9 @@ void NetworkIO::Resize2d(bool int_mode, int width, int num_features) {
|
||||
// Resizes to a specific stride_map.
|
||||
void NetworkIO::ResizeToMap(bool int_mode, const StrideMap& stride_map,
|
||||
int num_features) {
|
||||
// If this assert fails, it most likely got here through an uninitialized
|
||||
// scratch element, ie call NetworkScratch::IO::Resizexxx() not
|
||||
// NetworkIO::Resizexxx()!!
|
||||
ASSERT_HOST(this != nullptr);
|
||||
// If this method crashes with this == nullptr,
|
||||
// it most likely got here through an uninitialized scratch element,
|
||||
// ie call NetworkScratch::IO::Resizexxx() not NetworkIO::Resizexxx()!!
|
||||
stride_map_ = stride_map;
|
||||
int_mode_ = int_mode;
|
||||
if (int_mode_) {
|
||||
|
Loading…
Reference in New Issue
Block a user