MCPcopy Create free account
hub / github.com/creatale/node-dv / PostLoadCleanup

Method PostLoadCleanup

deps/tesseract/classify/mastertrainer.cpp:234–252  ·  view source on GitHub ↗

Cleans up the samples after initial load from the tr files, and prior to saving the MasterTrainer: Remaps fragmented chars if running shape anaylsis. Sets up the samples appropriately for class/fontwise access. Deletes outlier samples.

Source from the content-addressed store, hash-verified

232// Sets up the samples appropriately for class/fontwise access.
233// Deletes outlier samples.
234void MasterTrainer::PostLoadCleanup() {
235 if (debug_level_ > 0)
236 tprintf("PostLoadCleanup...\n");
237 if (enable_shape_anaylsis_)
238 ReplaceFragmentedSamples();
239 SampleIterator sample_it;
240 sample_it.Init(NULL, NULL, true, &verify_samples_);
241 sample_it.NormalizeSamples();
242 verify_samples_.OrganizeByFontAndClass();
243
244 samples_.IndexFeatures(feature_space_);
245 // TODO(rays) DeleteOutliers is currently turned off to prove NOP-ness
246 // against current training.
247 // samples_.DeleteOutliers(feature_space_, debug_level_ > 0);
248 samples_.OrganizeByFontAndClass();
249 if (debug_level_ > 0)
250 tprintf("ComputeCanonicalSamples...\n");
251 samples_.ComputeCanonicalSamples(feature_map_, debug_level_ > 0);
252}
253
254// Gets the samples ready for training. Use after both
255// ReadTrainingSamples+PostLoadCleanup or DeSerialize.

Callers

nothing calls this directly

Calls 5

NormalizeSamplesMethod · 0.80
InitMethod · 0.45
IndexFeaturesMethod · 0.45

Tested by

no test coverage detected