Wednesday, November 19, 2014

Using Entropy to Distinguish Shape versus Text in Hand drawn Diagrams

Entropy rate is typically higher for text strokes an can be used to distinguish shape and text strokes. Using this single feature, zero-order entropy, a high accuracy was obtained.

Approach

Handwritten text strokes are more randomly structured which increases their entropy measure. Entropy is defined as measure of uncertainty associated with a random variable.

Entropy Model : Each hand drawn stroke is represented as string of the letters from alphabets.  Each point in the stroke is assigned a symbol depending on the angle it makes with its neighboring points. This symbol in the random variable based on which entropy is calculated. The entropy model in the paper has 7 symbols. Each symbol corresponds to a range of angles. The total range is [0,pi).

SYMBOL RANGE
A [0, /6)
B [ /6,2 /6)
C [2 /6,3 /6)
D [3 /6,4 /6)
E [4 /6,5 /6)
F [5 /6, )
X End points

Algorithm:

1. The diagram is classified into stroke groups. All strokes which are below spatial and temporal threshold are grouped together. Temporal threshold is 100 or 400 ms.
2. The strokes are resampled to smoothen the substroke angles and to makes points equidistant from each other.( 4 pixels)
3. Each stroke is assigned a string of symbols from the entropy model.
4. Probability estimate of each symbol is calculated by dividing the number of occurrences of that symbol by the total number of symbols. We sum the probabilities of symbols assigned to the points according to the formula
H(S) = -k∑SP(xi) log(P(xi))
where P(xi) is the probability of label assignment of label(xi) to point xi in the stroke and k is a constant.
5. The resulting value is divided by the bounding box diagonal and this is the entropy rate of the stroke group.

A stroke  group is either classified as text, shape or unclassified. For unclassified strokes the entropy values lie between the text and shape entropy values.

Confidence measure was introduced to reflect the authority with which each classification was made.

C(x | TEXT) = 0.5 + (arctan(x- b))/pi
C(x | SHAPE) = 1 – C(x | TEXT)
b represents the entropy value for which classification of text is 0.5.

Tesing was done in two domains - military course of action and free body diagram. A ten-fold cross validation was used on COA and a accuracy of 99.56% was obtained on the produced classification which was 77.51%. For free body diagrams the threshold obtained from COA was used to measure the performance on unseen domains. In this case classification rate was 71.06% with overall accuracy 96.42%.
When the system was required to produce a classification always the accuracy was 96.02%.

Problem with zero-order entropy
Zero-order will not capture patterns which are repeating such as resistor and produce high values of entropy. This misclassification can be mitigated using low confidence values.





1 comment: