mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Merge pull request #466 from stweil/opencl
Fix some typos (found by codespell)
This commit is contained in:
commit
cdc2863b48
@ -24,7 +24,7 @@ So, the steps for making Tesseract are:
|
|||||||
You need to install at least English language and OSD data files to TESSDATA_PREFIX
|
You need to install at least English language and OSD data files to TESSDATA_PREFIX
|
||||||
directory. You can retrieve single file with tools like [wget](https://www.gnu.org/software/wget/), [curl](https://curl.haxx.se/), [GithubDownloader](https://github.com/intezer/GithubDownloader) or browser.
|
directory. You can retrieve single file with tools like [wget](https://www.gnu.org/software/wget/), [curl](https://curl.haxx.se/), [GithubDownloader](https://github.com/intezer/GithubDownloader) or browser.
|
||||||
|
|
||||||
All language data files can be retrieved from git repository (usefull only for packagers!):
|
All language data files can be retrieved from git repository (useful only for packagers!):
|
||||||
|
|
||||||
$ git clone https://github.com/tesseract-ocr/tessdata.git tesseract-ocr.tessdata
|
$ git clone https://github.com/tesseract-ocr/tessdata.git tesseract-ocr.tessdata
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class LSTMRecognizer {
|
|||||||
// If label_threshold is positive, uses it for making the labels, otherwise
|
// If label_threshold is positive, uses it for making the labels, otherwise
|
||||||
// uses standard ctc. Returned in scale_factor is the reduction factor
|
// uses standard ctc. Returned in scale_factor is the reduction factor
|
||||||
// between the image and the output coords, for computing bounding boxes.
|
// between the image and the output coords, for computing bounding boxes.
|
||||||
// If re_invert is true, the input is inverted back to its orginal
|
// If re_invert is true, the input is inverted back to its original
|
||||||
// photometric interpretation if inversion is attempted but fails to
|
// photometric interpretation if inversion is attempted but fails to
|
||||||
// improve the results. This ensures that outputs contains the correct
|
// improve the results. This ensures that outputs contains the correct
|
||||||
// forward outputs for the best photometric interpretation.
|
// forward outputs for the best photometric interpretation.
|
||||||
@ -351,7 +351,7 @@ class LSTMRecognizer {
|
|||||||
// The unicharset. Only the unicharset element is serialized.
|
// The unicharset. Only the unicharset element is serialized.
|
||||||
// Has to be a CCUtil, so Dict can point to it.
|
// Has to be a CCUtil, so Dict can point to it.
|
||||||
CCUtil ccutil_;
|
CCUtil ccutil_;
|
||||||
// For backward compatability, recoder_ is serialized iff
|
// For backward compatibility, recoder_ is serialized iff
|
||||||
// training_flags_ & TF_COMPRESS_UNICHARSET.
|
// training_flags_ & TF_COMPRESS_UNICHARSET.
|
||||||
// Further encode/decode ccutil_.unicharset's ids to simplify the unicharset.
|
// Further encode/decode ccutil_.unicharset's ids to simplify the unicharset.
|
||||||
UnicharCompress recoder_;
|
UnicharCompress recoder_;
|
||||||
|
@ -91,7 +91,7 @@ struct RecodeNode {
|
|||||||
bool start_of_word;
|
bool start_of_word;
|
||||||
// True if this represents a valid candidate end of word position. Does not
|
// True if this represents a valid candidate end of word position. Does not
|
||||||
// necessarily mark the end of a word, since a word can be extended beyond a
|
// necessarily mark the end of a word, since a word can be extended beyond a
|
||||||
// candidiate end by a continuation, eg 'the' continues to 'these'.
|
// candidate end by a continuation, eg 'the' continues to 'these'.
|
||||||
bool end_of_word;
|
bool end_of_word;
|
||||||
// True if this is a duplicate of prev in all respects. Some training modes
|
// True if this is a duplicate of prev in all respects. Some training modes
|
||||||
// allow the network to output duplicate characters and crush them with CTC,
|
// allow the network to output duplicate characters and crush them with CTC,
|
||||||
|
@ -142,7 +142,7 @@ bool Series::Backward(bool debug, const NetworkIO& fwd_deltas,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Splits the series after the given index, returning the two parts and
|
// Splits the series after the given index, returning the two parts and
|
||||||
// deletes itself. The first part, upto network with index last_start, goes
|
// deletes itself. The first part, up to network with index last_start, goes
|
||||||
// into start, and the rest goes into end.
|
// into start, and the rest goes into end.
|
||||||
void Series::SplitAt(int last_start, Series** start, Series** end) {
|
void Series::SplitAt(int last_start, Series** start, Series** end) {
|
||||||
*start = NULL;
|
*start = NULL;
|
||||||
|
@ -77,7 +77,7 @@ class Series : public Plumbing {
|
|||||||
NetworkIO* back_deltas);
|
NetworkIO* back_deltas);
|
||||||
|
|
||||||
// Splits the series after the given index, returning the two parts and
|
// Splits the series after the given index, returning the two parts and
|
||||||
// deletes itself. The first part, upto network with index last_start, goes
|
// deletes itself. The first part, up to network with index last_start, goes
|
||||||
// into start, and the rest goes into end.
|
// into start, and the rest goes into end.
|
||||||
void SplitAt(int last_start, Series** start, Series** end);
|
void SplitAt(int last_start, Series** start, Series** end);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ enum LossType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Simple class to hold the tensor shape that is known at network build time
|
// Simple class to hold the tensor shape that is known at network build time
|
||||||
// and the LossType of the loss funtion.
|
// and the LossType of the loss function.
|
||||||
class StaticShape {
|
class StaticShape {
|
||||||
public:
|
public:
|
||||||
StaticShape()
|
StaticShape()
|
||||||
|
@ -38,7 +38,7 @@ bool StrideMap::Index::IsLast(FlexDimensions dimension) const {
|
|||||||
return MaxIndexOfDim(dimension) == indices_[dimension];
|
return MaxIndexOfDim(dimension) == indices_[dimension];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given that the dimensions upto and including dim-1 are valid, returns the
|
// Given that the dimensions up to and including dim-1 are valid, returns the
|
||||||
// maximum index for dimension dim.
|
// maximum index for dimension dim.
|
||||||
int StrideMap::Index::MaxIndexOfDim(FlexDimensions dim) const {
|
int StrideMap::Index::MaxIndexOfDim(FlexDimensions dim) const {
|
||||||
int max_index = stride_map_->shape_[dim] - 1;
|
int max_index = stride_map_->shape_[dim] - 1;
|
||||||
|
@ -69,7 +69,7 @@ class StrideMap {
|
|||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
// Returns true if the index of the given dimension is the last.
|
// Returns true if the index of the given dimension is the last.
|
||||||
bool IsLast(FlexDimensions dimension) const;
|
bool IsLast(FlexDimensions dimension) const;
|
||||||
// Given that the dimensions upto and including dim-1 are valid, returns the
|
// Given that the dimensions up to and including dim-1 are valid, returns the
|
||||||
// maximum index for dimension dim.
|
// maximum index for dimension dim.
|
||||||
int MaxIndexOfDim(FlexDimensions dim) const;
|
int MaxIndexOfDim(FlexDimensions dim) const;
|
||||||
// Adds the given offset to the given dimension. Returns true if the result
|
// Adds the given offset to the given dimension. Returns true if the result
|
||||||
|
@ -163,7 +163,7 @@ const int kDoubleFlag = 128;
|
|||||||
|
|
||||||
// Writes to the given file. Returns false in case of error.
|
// Writes to the given file. Returns false in case of error.
|
||||||
bool WeightMatrix::Serialize(bool training, TFile* fp) const {
|
bool WeightMatrix::Serialize(bool training, TFile* fp) const {
|
||||||
// For backward compatability, add kDoubleFlag to mode to indicate the doubles
|
// For backward compatibility, add kDoubleFlag to mode to indicate the doubles
|
||||||
// format, without errs, so we can detect and read old format weight matrices.
|
// format, without errs, so we can detect and read old format weight matrices.
|
||||||
uinT8 mode = (int_mode_ ? kInt8Flag : 0) |
|
uinT8 mode = (int_mode_ ? kInt8Flag : 0) |
|
||||||
(use_ada_grad_ ? kAdaGradFlag : 0) | kDoubleFlag;
|
(use_ada_grad_ ? kAdaGradFlag : 0) | kDoubleFlag;
|
||||||
@ -202,7 +202,7 @@ bool WeightMatrix::DeSerialize(bool training, bool swap, TFile* fp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// As DeSerialize, but reads an old (float) format WeightMatrix for
|
// As DeSerialize, but reads an old (float) format WeightMatrix for
|
||||||
// backward compatability.
|
// backward compatibility.
|
||||||
bool WeightMatrix::DeSerializeOld(bool training, bool swap, TFile* fp) {
|
bool WeightMatrix::DeSerializeOld(bool training, bool swap, TFile* fp) {
|
||||||
GENERIC_2D_ARRAY<float> float_array;
|
GENERIC_2D_ARRAY<float> float_array;
|
||||||
if (int_mode_) {
|
if (int_mode_) {
|
||||||
|
@ -100,7 +100,7 @@ class WeightMatrix {
|
|||||||
// If swap is true, assumes a big/little-endian swap is needed.
|
// If swap is true, assumes a big/little-endian swap is needed.
|
||||||
bool DeSerialize(bool training, bool swap, TFile* fp);
|
bool DeSerialize(bool training, bool swap, TFile* fp);
|
||||||
// As DeSerialize, but reads an old (float) format WeightMatrix for
|
// As DeSerialize, but reads an old (float) format WeightMatrix for
|
||||||
// backward compatability.
|
// backward compatibility.
|
||||||
bool DeSerializeOld(bool training, bool swap, TFile* fp);
|
bool DeSerializeOld(bool training, bool swap, TFile* fp);
|
||||||
|
|
||||||
// Computes matrix.vector v = Wu.
|
// Computes matrix.vector v = Wu.
|
||||||
|
@ -3163,7 +3163,7 @@ ds_device OpenclDevice::getDeviceSelection( ) {
|
|||||||
// cleanup
|
// cleanup
|
||||||
// TODO: call destructor for profile object?
|
// TODO: call destructor for profile object?
|
||||||
|
|
||||||
bool overrided = false;
|
bool overridden = false;
|
||||||
char *overrideDeviceStr = getenv("TESSERACT_OPENCL_DEVICE");
|
char *overrideDeviceStr = getenv("TESSERACT_OPENCL_DEVICE");
|
||||||
if (overrideDeviceStr != NULL) {
|
if (overrideDeviceStr != NULL) {
|
||||||
int overrideDeviceIdx = atoi(overrideDeviceStr);
|
int overrideDeviceIdx = atoi(overrideDeviceStr);
|
||||||
@ -3173,7 +3173,7 @@ ds_device OpenclDevice::getDeviceSelection( ) {
|
|||||||
"%i)\n",
|
"%i)\n",
|
||||||
overrideDeviceStr, overrideDeviceIdx);
|
overrideDeviceStr, overrideDeviceIdx);
|
||||||
bestDeviceIdx = overrideDeviceIdx - 1;
|
bestDeviceIdx = overrideDeviceIdx - 1;
|
||||||
overrided = true;
|
overridden = true;
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"[DS] Ignoring invalid TESSERACT_OPENCL_DEVICE=%s ([1,%i] are "
|
"[DS] Ignoring invalid TESSERACT_OPENCL_DEVICE=%s ([1,%i] are "
|
||||||
@ -3182,7 +3182,7 @@ ds_device OpenclDevice::getDeviceSelection( ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overrided) {
|
if (overridden) {
|
||||||
printf("[DS] Overridden Device[%i]: \"%s\" (%s)\n", bestDeviceIdx + 1,
|
printf("[DS] Overridden Device[%i]: \"%s\" (%s)\n", bestDeviceIdx + 1,
|
||||||
profile->devices[bestDeviceIdx].oclDeviceName,
|
profile->devices[bestDeviceIdx].oclDeviceName,
|
||||||
profile->devices[bestDeviceIdx].type == DS_DEVICE_OPENCL_DEVICE
|
profile->devices[bestDeviceIdx].type == DS_DEVICE_OPENCL_DEVICE
|
||||||
|
Loading…
Reference in New Issue
Block a user