You are on page 1of 5

Automatic consumption reading on electromechanical meters using

HoG and SVM

D. B. P. Quintanilha*, R. W. S. Costa*, J. O. B. Diniz*,


J. D. S. de Almeida*, G. Braz Junior*, A. C. Silva*, A. C. de Paiva*,
E. M. Monteiro+, B. R. Froz+, L. P. A. Piheiro+, W. Melho+

*Computer Applied Group, Federal University of Maranho, Brazil


+Power Company of Maranho S.A. - CEMAR and Power Company of Para - CELPA, Brazil

Keywords: Power consumption measurement, Electrome- The distributor’s critics sector uses an acquired image as
chanical meters, Digit recognition, HoG, SVM one of the ways to analyze inconsistencies in reading. This is
done in order to avoid errors in the charged consumption, theft
Abstract or fraud. That is, it seeks to avoid the non-technical losses that
according to [1] in Brazil represent a total of 44% of the total
The reading of the electrical energy consumption is carried out annual loss that is around 52 Terawatts / hour (TWh). On a
manually for the most part. One of the ways to validate the daily basis, a mean volume of 30,000 images is captured and
measurement performed by the meter reader on the field is sent for analysis before generating an invoice for the customer.
through the request of images acquisition in situations where Due to the large number of images to be evaluated, the audit
there is a divergence in the consumption informed by the meter is done by sampling. Yet the verification routine of the invoices
reader. However, this validation process in two Brazilian en- that were not printed on the field is done in its entirety. In cases
ergy companies (CEMAR and CELPA) entails a daily volume where inconsistencies with the images have been found, the
of roughly 30 thousand images to be analyzed. In this context, distributor needs to send another meter reader to the field to
this article presents a method for automatic consumption read- redo the reading or investigate the situation.
ing on electromechanical meters based on meter image using
Some works have been proposed aiming achievement of
HoG and SVM. The method obtained an accuracy of 79.52%
automatic consumption reading from electrical energy con-
in tests performed with more than 8000 digits.
sumer units based on images. In general, these works carry
out the acquisition of the image by fixing a camera positioned
1 Introduction in front of the meter, focusing on the region of the equipment’s
An electric meter or energy meter is a device or equipment digits and then using image processing techniques and machine
capable of measuring the electrical power consumption of a learning to recognize the digits from the reading region [2, 3].
residence, company or electrical appliance. The electricity There are few published works with a similar goal and present-
distribution companies perform a monthly reading of the dig- ing consistent results applied in a base with a sufficient amount
its which represent the consumption of the consumer unit in of images..
kilowatt-hours (kWh). Most of the time, the reading process Another approach for automatic consumption reading is
is performed manually by meter readers, which can result in proposed based on the use of smart meters. Smart meters are
reading errors and generate inconsistencies. devices that perform the reading and send it automatically via
The energy company of Maranho (CEMAR) and power data network (SMS, GSM, PLC or wireless) [4, 5, 6].
plants from Para S.A (CELPA) use a mobile device and a In this context, this article describes an automatic method
portable printer to respectively collect the consumption and to perform the reading of electric energy consumption in elec-
print out the costumer’s invoice. The meter readers typically tromechanical meters based on image. The result of this work
record on a mobile device application the consumption dis- is part of a Research and Development (R&D) project, hired by
played on the meter. If there is no inconsistency, the invoice CEMAR / CELPA (ANEEL PD-00371-0029 / 2016), executed
is generated, printed and then delivered to the customer. How- by the Applied Computing Center (NCA) from the Federal
ever, in some cases, the informed consumption is outside the University of Maranho (UFMA). The purpose of this project
consumer’s consumption average or the meter reader can not is to develop a Validation System (SIVAL) that is capable of
read. In these cases, the application requests the image acqui- automatically reading and processing images captured on the
sition from the meter and captures the geographical location of field, detecting inconsistencies (absence of the meter, incorrect
the reader as a record of the informed reading. The procedure meter identification, impossibility of reading the consumption
may contain failures, such as: image acquired without a me- and incorrect consumption) at the same time it performs auto-
ter, or present image of meter different from the corresponding matic recognition of consumption.
meter, etc. SIVAL has the objective of automatically processing and

IET Digital Library, LACNEM-2017, 6-7 November, Valparaíso, Chile 57


recognizing the consumption in electric meters that are in crit- tion, (2) digit segmentation and (3) digit recognition . Figure 2
ical condition. It is divided into several steps: (1) detecting the shows the proposed method steps.
presence of the meter, (2) segmenting the meter, (3)Correcting
orientation, (4) segmenting reading area and (5) recognizing 2.3 Display Segmentation
digits.
In this work, the methodology developed for performing Initially the display region‘s segmentation is performed. The
stage 4 (segmentation of the reading area) and 5 (digits recog- purpose of this step is to reduce the digits space.
nition) in electromechanical meters is presented. This stage The segmentation algorithm is organized in 5 steps:
manipulates a large and complex set of meter images, of the • The search area is delimited: The search space is reduced
most diverse natures and without standardization in the images having the reference of the possible location and region
acquisition protocol (distance of acquisition, lighting, framing, area of the digits based on the a priori knowledge from
etc.). These characteristics are even added to the diversity of the type of meter.
meter types present in the distributors (341 types of different
meters were cataloged). • Image enhancement: the search region is transformed
from the RGB color space to HSV [7]; Then the 5x5
2 Materials and Methods Laplacian Filter [7] is applied to channel V, that repre-
sents luminance channel;
We present in this section the proposed method to perform the
reading of consumption in electromechanical meters in an im- • Segmentation of the display: Lastly, the display template
age obtained on the field, as well as the description of the ma- is applied in channel V. We use display templates from
terials used to validate the proposed method. the 22 types of meters to identify them individually. The
template matching technique [8] was used for this com-
parison. Thus, we could use the individual characteris-
2.1 Images database formation
tics of each type of meter to segment the display.
In order to validate this work, we used a database of meters ex- Figure 3 shows examples of display templates used in seg-
tracted from the Energy company of Maranho - CEMAR and mentation of the display region.
Power Plants from Para S.A - CELPA databases. The images
were acquired during the critical process by means of portable
2.4 Digit Segmentation
devices with Android operating system, and cameras with res-
olution varying between 5 and 8 megapixels. In all, 3886 im- After the segmentation step of the digits region, it was neces-
ages were acquired. The proposed method here assumes that sary to segment the digits in order to extract characteristics for
the meter will be pre-segmented, so all the images had the me- their recognition.
ter regions manually segmented (forming the regions of interest The Contrast Limited Adaptive Histogram Equalization
(ROI) used) and the consumption value noted. (CLAHE) [9] was used to enhance the images contrast and un-
In this set of images we have 22 types of electromechanical sharp [7] to realign the contours of the images and leave them
meters. The Figure 1 shows some examples of meter images less blurred than the original ones. The next step was to seg-
present on the image database we used. ment the digits region through the threshold. However, the use
of a single threshold was not feasible since the digits intensity
values in a same image may not be similar
We applied multiple thresholds (between 10 and 240, with
intervals of 10) for the extraction of blobs (candidate regions).
However, many blobs can be extracted, becoming computa-
tionally unfeasible the digits selection in the next step. Thus,
geometric measurements of the blobs are taken to reduce the
Figure 1. Examples of meter images. amount of candidate regions. Only blobs with height H(bi ),
bounding box area Ab b(bi ), proportion between bounding box
We divided the sample of 3886 images of segmented meters width and height Wb b(bi )/Hb b(bi ), within the previously de-
for training and testing. We use 2000 images for training and fined range are kept for next step. The second filtering is the
1886 for testing. We divide this way to preserve a big test base elimination of repeated blobs. For each pair of blobs that have
and stay focuses in a real scenario. From the training dataset, it a distance between their centers of mass less than 5 pixels and a
was selected 3867 digits images, identified by specialists. minimum proportion between areas greater than 0.8, the small-
est blob is eliminated. After the candidate blobs are reduced,
2.2 Proposed method they are sorted according to the X coordinate value of their cen-
ters.
The proposed method aims to perform the automatic reading of Then it is performed the digits selection, in which the
consumption from electrical energy meters of electromechani- method must return the bounding box from each of the five
cal type, It is organized in three stages: (1) display segmenta- digits (or six, depending on the meter model) for recognition.

IET Digital Library, LACNEM-2017, 6-7 November, Valparaíso, Chile 58


Figure 2. Steps of the proposed method.

Figure 3. Examples of templates used in the segmentation of the display.

Some information such as the number of digits (n), and mean 2.5 Digit Recognition
horizontal spacing between digits (dw), which were previously
defined. In order to reduce the computational complexity of the The segmented digits in the previous step are submitted to the
candidates search based on local similarity we used dynamic recognition step. In this step the Histogram of Oriented Gra-
programming [10]. The similarity are the information’s of the dients (HoG)[11] is used on the digits images for recognition.
spacing and alignment between digits. The method is robust The HoG could capture local shape feature while avoiding tex-
because it reduces the limitations such as the lighting variation ture noises. Initially it was found that there is no uniform size
from the external environment and digits dimension variation. for the extracted digits. To make the extraction of characteris-
The ET Energy from each simple blob combination is com- tics invariant to size, it was taken as a stepping stone that the
puted. Thus, the lowest energy combination (min ET), is cho- amount of cells, blocks and angles, HoG parameters , must be
sen for the digits segmentation. constant for all the extracted regions.
Thus each digit is centered on the smallest rectangular
 bounding box having dimensions in power terms of 2, rang-
ET = Eh (bi , bi+1 )) + Ech (bi , bi+1 ) + EdistW (b1 , bi+1 ) + Eth (b1 , bi+1 ) to 512 pixels in length and height, which pre-
ing from 32
(1) sented maximum and minimum dimensions present on images
Knowing that: database. The empty spaces created are filled with zero (zero-
padding). In this way, there are no distortions in the extracted
Eh (bi , bi+1 ) = α1 |h(bi ) − h(bi+1 )| (2) regions and it is guaranteed that the central regions from the
bounding box contain the digit. Finally, the parameters used
for all digits, regardless of size, are 4 blocks, 8 cells per block
Ech (bi , bi+1 ) = α2 |Ch (bi ) − Ch (bi+1 )| (3) and overlap 1. Empirically, the number of directions used in
the histogram was 24 directions.
EdistW (bi , bi+1 ) = α3 |dw (bi ) − dw (bi+1 − dw )| (4) A total of 3,867 digit images were manually segmented and
used for training as described in Section 2.1. From the 3,867
Et h(bi , bi+1 ) = α4 |th(bi ) − th(bi+1 )| (5) images we have: 478 digit 0, 462 digit 1 , 454 digit 2, 354 digit
3, 372 digit 4, 362 digit 5, 350 digit 6, 336 digit 7, 356 digit
where (bi , bi+1 ) refers to adjacent blobs, Eh is the height dif- 8 e 342 digit 9. The characteristics extracted with the HoG on
ference energy, EC h is the energy of the difference from the the training images were submitted to the Support Vector Ma-
vertical distance between the centers of mass, EdistW is the chine Training (SVM) [12] using a radial kernel, configured
energy of the horizontal spacing variation and Et h is the en- with parameters C equal to 32 and γ equal to 0.0078125 esti-
ergy of the difference between the thresholds values used to mated with Grid search method using cross-validation with 10
obtain the binary blobs. Lastly, the bounding boxes from the folders. We choose SVM because literature prove that is a high
selected blobs are extracted and go to the recognition step. efficient method for pattern recognition in many different tasks.

IET Digital Library, LACNEM-2017, 6-7 November, Valparaíso, Chile 59


3 Results believe that in order to obtain better results in performing the
automatic digit reading it is necessary that meter readers adopt
The proposed methodology method was trained with 3867 dig- an acquisition protocol to achieve the acquisition of good im-
its using the HoG and SVM, as described in Section 2.2. In ages.
order to test the model generated in the training, we used 1886 This method is also useful for alerting energy companies to
electromechanical meters images . On each meter image was the possible need of maintaining meters that cannot be read. It
performed the display segmentation stages and digits recogni- is important that the display area is well maintained and with
tion segmentation. the visible digits for SIVAL to achieve success in the other
The method reached 91.73% (1730/1886) accuracy for the stages of the project.
various types of meters in adverse conditions (erased, dirty,
etc). In relation to the digits‘ segmentation and recognition Acknowledgements
step, we tested it in two ways:1) only with the display cor-
rectly classified and 2) with the displays segmented correctly Our research group acknowledges financial support from CE-
and wrongly. The Figure 4 Shows some examples of the dis- MAR/CELPA made available through the project PD-00371-
play segmentation failure. It is noticed that some of these fail- 0029/2016.
ures are caused by lack of adequate meter image.
Figure 4 shows some examples of failure on the digits seg- References
mentation. In some cases the method segments region that does
not have a digit or partially segments the digit. In both cases, [1] R Vidinich and GAL Nery. Pesquisa e desenvolvimento
such segmentation will hamper the next recognition stage. contra o furto de energia. Revista Pesquisa e Desenvolvi-
The Table 1 Displays the digit recognition result for the Test mento da ANEEL–P&D, page 15, 2009.
1. In this one, it is verified that the method was able to correctly [2] Yunzhou Zhang, Shanbao Yang, Xiaolin Su, Enyi Shi,
read all the display digits in 44.27% of the cases, it missed a and Handuo Zhang. Automatic reading of domestic elec-
digit only in 25.29% and missed all the digits in only 0.16% tric meter: an intelligent device based on image process-
(3/1886). By evaluating the accuracy per digit, the method got ing and zigbee/ethernet communication. Journal of Real-
74.11% (6989/9431) of the digit recognition correct. This is Time Image Processing, 12(1):133–143, 2016.
an expressive result, considering mostly the analyzed images
characteristics. [3] Lamiaa A Elrefaei, Asrar Bajaber, Sumayyah Natheir,
The Table 2 presents the digits recognition result for the Nada AbuSanab, and Marwa Bazi. Automatic electric-
Test 2. In this one, it is verified that the method obtained better ity meter reading based on image processing. In Ap-
accuracy than in Test 1, in the correct reading performing of plied Electrical Engineering and Computing Technolo-
all the digits from the display, reaching accuracy of 48.73%. gies (AEECT), 2015 IEEE Jordan Conference on, pages
In 26.99% of the meters it failed in only one digit in 11.21% 1–5. IEEE, 2015.
it missed two digits. There were only two cases in which the
[4] M Popa. Gateway design and implementation in an auto-
method could not read any of the digits. In the analysis by digit,
matic meter reading system based on power line commu-
we had 79.52% (6879/8651) of the digits correctly recognized.
nications. In Networked Computing and Advanced Infor-
As in the results presented in Test 1, these are quite expressive
mation Management (NCM), 2011 7th International Con-
results if compared with papers presented in the literature that
ference on, pages 295–298. IEEE, 2011.
cite the use based on images with amount lower than the set of
images used in this article. [5] A Ali, NH Saad, NA Razali, and N Vitee. Implemen-
Figure 5 shows two reading examples in which the method tation of automatic meter reading (amr) using radio fre-
failed to recognize the digits. In the first one (on the left), only quency (rf) module. In Power and Energy (PECon), 2012
one digit failed to read, and in the second one the method failed IEEE International Conference on, pages 876–879. IEEE,
to recognize three digits. In this one the method had already 2012.
failed in the segmentation of the digit that was recognized with
a value equal to one. That is, the segmentation failure made it [6] Champ Prapasawad, Kittitach Pornprasitpol, and Wan-
difficult to correctly recognize the digit. chalerm Pora. Development of an automatic meter read-
ing system based on zigbee pro smart energy profile ieee
802.15. 4 standard. In Electron Devices and Solid State
4 Conclusion Circuit (EDSSC), 2012 IEEE International Conference
This work presented preliminary results for automatic digits on, pages 1–3. IEEE, 2012.
recognition in achievement of automatic reading of electric en- [7] Rafael C Gonzalez and Richard E Woods. Image process-
ergy consumption based on the analysis of images from the ing. Digital image processing, 2, 2007.
meter. It is important to emphasize that the images used in this
study were not acquired in the most diverse conditions, which [8] Roberto Brunelli. Template matching techniques in com-
hinders any recognition method. Even so, the accuracy of the puter vision: theory and practice. John Wiley & Sons,
proposed method achieved satisfactory results. However, we 2009.

IET Digital Library, LACNEM-2017, 6-7 November, Valparaíso, Chile 60


Figure 4. Failure examples: display segmentation (A-C), digit segmentation (E-F).

Table 1. Digits recognition result (Test 1) Table 2. Digits recognition result (Test 2).
Fault by Fault by
digit Accuracy Amount digit Accuracy Amount
0 44.27% 835/1886 0 48.73% 843/1730
1 25.29% 477/1886 1 26.99% 467/1730
2 10.18% 192/1886 2 11.21% 194/1730
3 5.83% 110/1886 3 4.45% 77/1730
4 5.94% 112/1886 4 3.53% 61/1730
5 8.32% 157/1886 5 4.97% 86/1730
6 0.16% 3/1886 6 0.12% 2/1730
Success by Success by
digit 74.11% 6989/9431 digit 79.52% 6879/8651

Figure 5. Digit recognition failure examples.

[9] Karel Zuiderveld. Contrast limited adaptive histogram


equalization. In Graphics gems IV, pages 474–485. Aca-
demic Press Professional, Inc., 1994.
[10] D J Kang. Dynamic programming-based method for ex-
traction of license plate numbers of speeding vehicles on
the highway. International Journal of Automotive Tech-
nology, 10(2):205–210, 2009.
[11] Navneet Dalal and Bill Triggs. Histograms of oriented
gradients for human detection. In Computer Vision and
Pattern Recognition, 2005. CVPR 2005. IEEE Computer
Society Conference on, volume 1, pages 886–893. IEEE,
2005.

[12] Vladimir Naumovich Vapnik. Statistical learning theory,


volume 1. Wiley New York, New York, USA, 1998.

IET Digital Library, LACNEM-2017, 6-7 November, Valparaíso, Chile 61

You might also like