Inter
national
J
our
nal
of
Recongurable
and
Embedded
Systems
(IJRES)
V
ol.
15,
No.
3,
No
v
ember
2026,
pp.
629
∼
644
ISSN:
2089-4864,
DOI:
10.11591/ijres.v15.i3.pp629-644
❒
629
Image
pr
ocessing
and
computer
vision
on
lo
w-cost
micr
ocontr
ollers:
a
case
study
on
water
meter
r
eading
Sohrab
J
alali
1
,
Filiz
Ers
¨
oz
2
,
Babak
T
aeb
3
1
Department
of
Softw
are
Engineering,
Graduate
School
of
Natural
and
Applied
Sciences,
OST
˙
IM
T
echnical
Uni
v
ersity
,
Ankara,
T
urk
e
y
2
Department
of
Data
Science
and
Analytics,
F
aculty
of
Economics
and
Administrati
v
e
Sciences,
OST
˙
IM
T
echnical
Uni
v
ersity
,
Ankara,
T
urk
e
y
3
Independent
Researcher
,
Ankara,
T
urk
e
y
Article
Inf
o
Article
history:
Recei
v
ed
Jun
16,
2026
Re
vised
Aug
14,
2026
Accepted
Sep
11,
2026
K
eyw
ords:
Adapti
v
e
sampling
Anomaly
detection
Embedded
computer
vision
ESP32-CAM
INT8
quantization
T
in
yML
W
ater
meter
reading
ABSTRA
CT
Despite
the
w
orldwide
mo
v
e
to
w
ards
smart
meters,
mechanical
w
ater
meters
are
still
used
e
xtensi
v
ely
in
residential
and
municipal
netw
orks.
Upgrading
them
with
computer
vision
a
v
oids
cost
ly
infrastructure
replacement,
yet
most
approaches
send
data
to
cloud
serv
ers
for
processing.
This
paper
introduces
an
end-to-end
on-de
vice
solution
for
recognizing
w
ater
meter
digits
on
the
ESP32-
CAM
board,
which
costs
belo
w
$15
and
features
only
520
KB
SRAM.
A
MobileNetV2-based
digit
classier
is
quantized
to
INT8.
Three
rmw
are
im-
pro
v
ements
e
xtend
the
inference
loop:
i)
a
temporal
check
conrming
a
reading
only
when
three
consecuti
v
e
detections
match,
ii)
on-de
vice
anomaly
detection
without
serv
er
support,
and
iii)
adapti
v
e
sampling
between
3
s
during
w
at
er
us-
age
and
60
s
when
idle.
A
Flask-based
internet
of
things
(IoT)
dashboard
named
MeterW
atch
pro
vides
li
v
e
monitoring.
The
model
achie
v
es
2
ms
latenc
y
and
235.6
KB
peak
memory
.
On
a
553-image
test
subset
from
a
custom
6,155-image
dataset
with
13,470
digit
annotations
it
reaches
99.60%
cell-le
v
el
accurac
y
in-
cluding
background,
96.89%
digi
t-only
accurac
y
and
87.70%
e
xact
v
e-digit
reading
accurac
y
.
T
o
the
best
of
our
kno
wledge,
this
is
the
rst
sys
tem
combin-
ing
on-de
vice
INT8
deplo
yment,
w
a
ter
meter
digit
recognition
and
intelligent
rmw
are
beha
viour
on
the
ESP32-CAM.
Ev
aluations
used
a
single
meter
brand
under
x
ed
ash
illumination.
This
is
an
open
access
article
under
the
CC
BY
-SA
license
.
Corresponding
A
uthor:
Sohrab
Jalali
Department
of
Softw
are
Engineering,
Graduate
School
of
Natural
and
Applied
Sciences
OST
˙
IM
T
echnical
Uni
v
ersity
Ankara,
T
urk
e
y
Email:
sohrabjallali@gmail.com
1.
INTR
ODUCTION
Edge
articial
intelligence
(AI)
in
conjunction
with
cheap
embedded
de
vices
has
made
a
ne
w
form
of
intelligence
possible
to
deplo
y
.
One
of
the
most
adv
anced
de
vices
in
this
cate
gory
is
the
ESP32-CAM
which
comprises
a
dual-core
system
on
chip
(SoC)
de
vice
along
with
an
O
V2640
camera
and
802.11
b/g/n
W
i-Fi
capability
.
W
ith
its
cheap
price
of
less
than
$15
per
unit,
this
platform
represents
a
good
replacement
for
ener
gy
intensi
v
e
s
ingle-board
computers
lik
e
Raspberry
Pi
and
NVIDIA
Jetson
for
massi
v
e
sensing
purposes.
It
can
e
v
en
be
used
inside
already-e
xisting
enclosures
at
city
scale.
One
area
that
is
poised
to
see
great
g
ains
is
w
ater
utilities.
The
traditional
mechanical
meter
is
by
f
ar
the
most
common
de
vice
for
measuring
w
ater
consumption
in
both
pri
v
ate
homes
and
city
w
ater
systems
J
ournal
homepage:
http://ijr
es.iaescor
e
.com
Evaluation Warning : The document was created with Spire.PDF for Python.
630
❒
ISSN:
2089-4864
around
the
w
orld.
Ho
we
v
er
,
the
y
still
require
manual
meter
reading
in
almost
all
cases.
This
procedure
is
both
inef
cient
and
costly
not
to
mention
that
it
is
subject
to
e
rror
from
human
transcription
[1].
Upgrading
all
of
these
meters
to
contemporary
digital
meters
is
a
nancially
prohibit
i
v
e
proposition,
costing
man
y
millions
of
dollars.
A
less
costly
solution
in
v
olv
es
retrotting
these
meters
with
computer
vision
capabilities
that
capture
and
interpret
the
digit
display
in
real
time
[2],
[3].
Implementing
deep
learning
on
a
microcontroller
presents
se
v
eral
challenges.
The
re
gular
object
detection
algorithms
consume
hundreds
of
me
g
abytes
of
memory
,
alongside
the
need
for
GPU
or
NEON
optimization,
neither
of
which
is
a
v
ailable
on
the
ESP32
board.
Apart
from
the
memory
requirements,
the
tw
o
core
processors
on
the
ESP32
w
ork
at
a
maximum
speed
of
240
MHz,
which
is
enough
for
an
embedded
de
vice
application
b
ut
w
ay
slo
wer
than
the
computing
po
wer
required
for
a
typical
inference
algorithm.
Achie
ving
practical
accurac
y
on
real-w
orld
meter
images
which
e
xhi
b
i
t
v
ariable
lighting,
angular
distortion,
glare,
dirt,
and
surf
ace
wear
needs
both
careful
model
design
and
rigorous
compression
[4],
[5].
The
e
v
aluation
reported
her
e
isolates
the
modeling
and
compression
problem
under
a
controlled
x
ed-illumination
deplo
yment.
Generalisation
to
uncontrolled
lighting
remains
future
w
ork.
The
proposed
paper
pro
vides
an
inte
grated
approach
to
w
ard
solving
the
abo
v
e
problem
.
Some
of
the
main
points
include
the
follo
wing:
-
An
INT8-quantized
MobileNetV2-based
digit
classier
running
enti
rely
on
the
ESP32-CAM
o
v
er
a
x
ed
12
×
12
grid,
achie
ving
2
ms
model
inference
latenc
y
,
235.6
KB
peak
RAM,
a
99.60%
o
v
erall
cell-le
v
el
accurac
y
including
the
background
class,
and
a
96.89%
digit-only
classication
accurac
y
on
a
553-image
box-annotated
test
subset.
-
A
temporal
consistenc
y
technique
where
the
rolling
b
uf
fer
consists
of
three
readings
and
an
y
reading
is
considered
v
alidated
only
if
three
consecuti
v
e
readings
match,
ltering
transient
errors
and
sensor
noise.
-
On-de
vice
anomaly
detection
using
rmw
are-le
v
el
arithmetic
on
conrmed
readings
to
ag
abnormal
consumption
e
v
ents
such
as
pipe
leaks,
without
an
y
serv
er
in
v
olv
ement.
-
Adapti
v
e
sampling:
a
time-interv
al-based
system
that
changes
the
interv
al
length
from
60
seconds
when
the
system
is
idle
to
3
seconds
when
there
is
an
y
acti
vity
.
It
helps
in
sa
ving
c
ycles
of
inference.
-
MeterW
atch:
an
internet
of
things
(IoT)
dashboard
de
v
eloped
using
Flask
technology
which
supports
li
v
e
JPEG
images
with
bounding
box
es,
trend
graphs
using
Chart.js,
anomalies,
multi-de
vice
capability
,
and
session
statistics.
-
A
custom
dataset
of
6,155
w
ater
meter
images,
including
2,694
images
with
digit-le
v
el
bounding
box
annotations
totalling
13,470
box
es,
obtained
under
real-w
orld
scenarios.
2.
RELA
TED
W
ORK
2.1.
W
ater
meter
and
utility
meter
r
eading
Dif
ferent
approaches
ha
v
e
been
tak
en
to
research
automatic
w
ater
meter
reading.
Initially
,
approaches
were
based
on
traditional
image
processing
techniques
such
as
thresholding,
morphological
processing,
and
template
matching.
Ho
we
v
er
,
these
approaches
suf
fer
from
poor
rob
ustness
due
to
f
actors
such
as
v
arying
lighting
conditions
and
de
graded
surf
aces
[1].
Deep
l
earning
models
pro
v
ed
more
ef
fecti
v
e.
In
particular
,
Nguyen
et
al.
[2]
utilized
te
xt
recognition
techniques
along
with
a
deep
learning
approach.
Their
model
demon-
strates
competiti
v
e
performance
when
applied
to
a
lar
ge
dataset
of
meters.
The
only
dra
wback
is
that
the
system
uses
a
GPU
serv
er
for
inference.
Zhang
et
al.
[3]
implemented
an
attention
model
at
a
character
le
v
el
in
order
to
o
v
ercome
partially
occluded
or
blurred
digits.
The
y
also
apply
inference
on
a
GPU
serv
er
,
which
is
used
on
cloud
computing
platforms.
Hong
et
al.
[4]
tested
their
meter
reader
model
in
deplo
yment
settings
character
-
ized
by
hea
vy
fouling,
lo
w
lighting,
and
se
v
ere
vie
wing
angles
and
found
that
data
augmentation
signicantly
enhances
accurac
y
.
Their
system
is
e
x
ecuted
on
w
orkstations.
Li
et
al.
[5]
focused
on
mechanical
w
ater
meters
and
reported
97.9%
mAP@0.5
with
an
impro
v
ed
Y
OLOv4
detector
in
natural
scenes
without
the
need
for
em-
bedded
deplo
yment.
Martinelli
et
al.
[6]
incorporated
meter
reading
into
a
lar
ger
smart
grid
monitoring
system
and
used
cloud
computing
infrastructure
for
inference.
Qiao
et
al.
[7]
de
v
eloped
a
compact
v
ariant
of
Y
OLO
named
Meter
-Y
OLOv8n
that
supports
w
ord-wheel
w
ater
meters
b
ut
still
requires
serv
er
-side
deplo
yment.
A
major
limi
tation
in
the
surv
e
y
arises
in
this
conte
xt:
se
v
en
prior
studies
specically
focus
on
the
task
of
digit
recognition
in
w
ater
meters,
of
which
only
one
(Ne
v
e
[8])
tar
gets
the
ESP32-CAM.
Ne
v
ertheless,
the
w
ork
of
Ne
v
e
[8]
lacks
INT8
quantization,
an
y
memory
proling,
or
anomaly
and
adapti
v
e
capabilities.
This
limitation
stems
from
a
technical
perspecti
v
e.
First,
due
to
the
limited
RAM
of
the
ESP32
(520
KB),
the
stan-
Int
J
Recongurable
&
Embedded
Syst,
V
ol.
15,
No.
3,
No
v
ember
2026:
629–644
Evaluation Warning : The document was created with Spire.PDF for Python.
Int
J
Recongurable
&
Embedded
Syst
ISSN:
2089-4864
❒
631
dard
format
of
a
machine
learning
model
cannot
be
used,
second,
due
to
the
requirement
of
proper
calibration
in
case
of
TFLite
Micro,
and
third,
due
to
the
need
for
an
annotated
dataset
suitable
for
the
tar
get
meter
and
deplo
yment
conditions.
Be
yond
these
g
aps,
Ne
v
e’
s
system
relies
on
manually
dened
re
gions
of
interest
for
each
digit
position,
congured
once
through
a
calibration
interf
ace
and
x
ed
thereafter
,
rather
than
a
learned
localisation
or
classication
mechanism.
The
captured
images
are
also
de
scribed
as
being
sent
o
v
er
W
i-Fi
for
processing,
with
the
actual
location
of
inference
(on-de
vice
or
serv
er
-side)
left
unspecied.
No
accurac
y
,
mem-
ory
footprint,
or
latenc
y
gures
are
reported,
which
limits
direct
quantitati
v
e
comparison
(see
subsection
4.7).
Our
w
ork
addresses
precisely
this
g
ap.
T
able
1
summarises
the
comparison.
T
able
1.
W
ater
meter
reading
studies:
platform
summary
(7
prior
w
orks
and
this
w
ork,
6
of
the
7
prior
w
orks
rely
on
serv
er/cloud
inference)
Reference
Platform
On-de
vice
INT8
Ne
v
e
[8]
ESP32-CAM
Unspecied
No
Nguyen
et
al.
[2]
DL
serv
er
No
N/A
Zhang
et
al.
[3]
CNN
serv
er
No
N/A
Hong
et
al.
[4]
ML
serv
er
No
N/A
Li
et
al.
[5]
CNN
serv
er
No
N/A
Martinelli
et
al.
[6]
IoT
+
cloud
No
N/A
Qiao
et
al.
[7]
Y
OLO
serv
er
No
N/A
This
w
ork
ESP32-CAM
Y
es
Y
es
2.2.
On-de
vice
infer
ence
on
ESP32
There
are
some
papers
related
to
on-chip
inference
in
ESP32.
Ho
we
v
er
,
v
ery
fe
w
w
orks
succe
ssfully
deplo
y
an
end-to-end
embedded
solution.
The
research
paper
most
rele
v
ant
to
our
case
is
that
of
Ben
Aicha
[9],
who
conducts
INT8-quantized
CNN
inference
on
ESP32-CAM
for
generic
image
classi
cation.
The
paper
sho
ws
ho
w
ef
fecti
v
e
the
INT8
post-training
quantization
is
in
impro
ving
the
accurac
y
of
the
model
after
the
training
process.
It
pro
v
es
the
possibil
ity
of
performing
real-time
embedded
inference
under
the
memory
limitation
of
the
ESP32.
Nonetheless,
the
paper
does
not
consider
the
cases
of
w
ater
-metering
reading
and
anomaly
detection
nor
adapti
v
e
system
beha
vior
.
Sine
glazo
v
and
Khotsyano
vsk
y
[10]
sho
wed
that
the
implementation
of
the
entire
con
v
olutional
neural
netw
ork
architecture
w
as
possible
right
on
the
ESP32
without
an
y
pre-processing
steps
performed
e
xternally
.
The
w
ork
of
Dokic
[11]
took
a
simpler
approach
through
using
logistic
re
gression
on
lo
w-resolution
images
captured
by
the
ESP32
camer
a.
On
the
other
hand,
P
aul
et
al.
[12]
applied
re
gression
algorithms
in
embedded
systems
for
the
task
of
reading
analog
pressure
g
auges
in
a
laboratory
en
vironment.
Ho
we
v
er
,
current
research
using
ESP32-CAM
mostly
in
v
olv
es
taking
the
pictures
locally
,
after
which
inference
is
done
of
f-de
vice.
According
to
Narw
aria
et
al.
[13]
and
Sulistiyo
w
ati
et
al.
[14],
local
pic-
ture
captur
e
is
follo
wed
by
sending
the
captured
images
to
a
PC
for
processing
with
Y
OLO
or
OpenCV
.
Hadz
et
al.
[15]
managed
to
int
e
grat
e
Y
OLO
with
ESP32-CAM
for
stereoscopic
depth
estimation,
where
inference
is
carried
out
of
f-de
vice
too.
In
addition,
No
wroz
et
al.
[16]
and
Im
ron
et
al.
[17]
conducted
infer
-
ence
on
a
cloud-based
back-end
system.
Setia
w
an
et
al.
[18]
combined
Y
OLOv8
with
ESP32-CAM
capture
b
ut
processed
detections
serv
er
-side.
Chang
et
al.
[19]
carried
out
object
detection
using
ESP32
edge
computing
and
Ne
vliudo
v
et
al.
[20]
conducte
d
object
recognition
with
a
microcontroller
-based
robot.
The
aforemen-
tioned
of
f-de
vice
processing
represe
n
t
s
the
most
widely
used
methodology
in
ESP32-CAM
research,
whereas
the
present
research
represents
only
one
of
the
fe
w
e
xceptions
from
that
rule.
2.3.
T
inyML
and
model
compr
ession
The
basis
of
theory
for
INT8
quantization
is
laid
by
Nagel
et
al.
[21]
as
the
y
analyze
the
roots
of
quantization
error
and
de
v
elop
calibration
methods
to
counteract
s
u
c
h
ne
g
ati
v
e
ef
fects.
Theory
into
practice
w
as
achie
v
ed
through
research
done
by
No
v
ac
et
al.
[22]
whereby
the
y
implemented
quantized
deep
neural
netw
orks
on
Corte
x-M
microcontrollers
and
analyzed
the
trade-of
f
curv
e
of
accurac
y
v
ersus
memory
footprint
at
dif
ferent
bit-widths.
Finally
,
Shabir
et
al.
[23]
conduct
an
analysis
comparing
pruning
ag
ainst
quantization
methods
on
T
in
yML
applications
concluding
that
post-training
INT8
quantization
i
s
optimal
for
accurac
y
and
ef
cienc
y
trade-of
f.
Ima
g
e
pr
ocessing
and
computer
vision
on
low-cost
micr
ocontr
oller
s:
a
case
study
on
...
(Sohr
ab
J
alali)
Evaluation Warning : The document was created with Spire.PDF for Python.
632
❒
ISSN:
2089-4864
T
in
yissimoY
OLO
w
as
introduced
by
Moosmann
et
al.
[24],
which
is
a
fully
quantized
Y
OLO
v
ariant
designed
specical
ly
for
ultra-lo
w-memory
MCUs,
reporting
sub-1
MB
memory
operation
on
ARM
Corte
x-M
class
hardw
are.
Further
progress
in
this
direction
w
as
made
by
Bo
yle
et
al.
[25]
with
DSOR
T
-MCU,
focusing
on
de
v
eloping
methods
that
w
ould
enable
small
object
detection
on
microcontroller
units.
In
addition,
Zhang
[26]
e
xamined
quantization-a
w
are
training
(QA
T)
as
a
substitute
approach
compared
to
post-training
quantization
in
embedded
articial
intelligence
systems.
MC
UNetV2
w
as
de
v
eloped
by
Lin
et
al.
[27],
where
inference
w
as
done
using
patches
in
order
to
reduce
peak
acti
v
ation
memory
requirements
do
wn
to
256
KB.
2.4.
Embedded
inter
net
of
things
and
anomaly
detection
Ba
w
ankar
et
al.
[28]
de
v
eloped
a
retrot
w
ater
-monitoring
system
that
recognizes
meter
digits
from
camera
images
on
a
Raspberry
Pi
Zero
W
edge
de
vice
and
transmits
the
readings
to
the
cloud
for
further
analysis.
Our
anomaly
detection
algorithm
is
quit
e
unique
in
nature
since
it
detects
abnormalities
through
vision-based
meter
readings
and
completes
all
the
processing
logic
via
ESP32
rmw
are.
P
a
w
ar
et
al.
[29]
con-
ducted
a
surv
e
y
on
smart
ener
gy
meters
using
ESP32
to
justify
its
applicability
in
utility
IoT
.
In
addition,
Samanta
et
al.
[30]
used
T
in
yML
in
combination
with
ESP32-CAM
for
disaster
location
identication
in
the
real
w
orld
pro
ving
the
ef
fecti
v
eness
of
on-de
vice
inference
under
real
deplo
yment
constraints.
Lastly
,
Donsk
o
y
et
al.
[31]
adopted
T
in
yML
on
the
ESP32
for
agricultural
classication
to
sho
w
that
embedded
mod-
els
can
maintain
reliable
accurac
y
across
di
v
erse
real-w
orld
en
vironments.
3.
METHOD
3.1.
System
o
v
er
view
Figure
1
sho
ws
the
pipeline
o
v
ervie
w
.
In
the
rst
step,
the
ESP32-CAM
captures
a
JPEG
image
and
then
performs
its
pre-processing
and
INT8
inference
completely
onboard
before
applying
the
three
rmw
are
contrib
utions
and
sending
the
output
data
to
MeterW
atch
via
W
i-Fi.
The
pre-processing
procedure,
which
in
v
olv
es
trans
forming
from
320
×
240
JPEG
to
96
×
96
graysca
le,
is
done
on-de
vice
by
decoding
the
JPEG
format
and
performing
bilinear
do
wnsampling,
adding
approximately
8–12
ms
to
the
pipeline
latenc
y
.
Model
inference
itself
accounts
for
only
2
ms.
Only
the
nal
POST
request
lea
v
es
the
de
vice.
Figure
1.
End-to-end
system
pipeline
with
all
inference
and
rmw
are
logic
e
x
ecuted
on
the
ESP32-CAM
3.2.
Hard
war
e
platf
orm
The
ESP32-CAM
board
runs
on
Espressif
’
s
ESP32
chip,
which
has
tw
o
Xtensa
LX6
cores
that
can
hit
speeds
up
to
240
MHz.
It
packs
520
KB
of
SRAM,
4
MB
of
PSRAM
and
4
MB
of
Flash
memory
,
along
with
a
b
uilt-in
O
V2640
camera.
W
i-Fi
802.11
b/g/n
is
supported
nati
v
ely
without
additional
hardw
are.
Priced
at
under
$15
per
unit,
it
is
an
af
fordable
option
for
lar
ge-scale
infrastructure
deplo
yment.
Int
J
Recongurable
&
Embedded
Syst,
V
ol.
15,
No.
3,
No
v
ember
2026:
629–644
Evaluation Warning : The document was created with Spire.PDF for Python.
Int
J
Recongurable
&
Embedded
Syst
ISSN:
2089-4864
❒
633
3.3.
Dataset
collection
and
annotation
The
images
were
captured
using
a
self-designed
and
manuf
actured
3D-printed
data
acquisition
de
vi
ce
(Figure
2).
The
de
vice
consists
of
a
rigid
structure
that
includes
a
base
with
rail
on
which
the
re
are
four
v
ertically
mounted
guide
rods
to
allo
w
mo
v
ement
of
the
camera
mount
in
all
three
dimensions.
While
v
ertical
adjustment
is
done
by
mo
ving
the
camera
mount
up
and
do
wn
the
rods,
independent
horizontal
adjustments
can
be
made
by
v
arying
the
positions
of
thumb-scre
w-mounted
cameras.
This
e
xibility
enabled
systematic
capture
of
images
across
a
controlled
range
of
distances
and
angles.
Figure
2.
Custom
3D-printed
data
acquisition
rig
with
a
camera
mount
repositionable
in
all
three
ax
es
A
customized
dataset
w
as
created
using
the
image
capturing
of
the
Baylan-brand
mechanical
w
ater
meter
across
a
range
of
camera-to-meter
distances
and
observ
ation
angles
up
to
∼
30
◦
of
f-axis,
with
some
im-
ages
e
xhibiting
surf
ace
de
gradation
including
glare,
dirt,
and
scratches.
Illumination
w
as
held
constant
across
all
captures
via
the
rig’
s
inte
grated
ash
LED,
matchi
ng
the
illumination
used
in
the
production
enclosure.
Only
distance
and
vie
wing
angle
v
aried
systematically
.
All
images
were
captured
at
320
×
240
pix
els
in
JPEG
format.
Deplo
yment
enclosure:
as
for
the
production
deplo
yment,
the
ESP32-CAM
is
housed
in
a
sealed
3D-printed
enclosure
that
sits
directly
o
v
er
the
f
ace
of
the
meter
.
This
ensures
that
an
y
form
of
ambient
light
interference
is
elim
inated
while
pro
viding
a
consistent
illumination
en
vironment
through
the
inte
grated
ash
LED
of
the
O
V2640
sensor
.
Controlled
illumination
is
one
of
the
k
e
y
f
actors
responsible
for
the
high
reported
accurac
y
(99.60%),
as
the
model
operates
under
conditions
closely
matching
those
of
data
collection:
no
uncontrolled
light
sources,
since
the
ash-illuminated
capture
re
gime
is
identical
between
data
collection
and
production.
The
cam
era-to-meter
distance
and
vie
wing
angle
are
x
ed
at
8
cm
and
0
de
grees
of
f-axis
specically
in
the
production
enclosure,
whereas
the
training
and
test
data
span
the
wider
5–12
cm
/
0–30
de
gree
range
listed
i
n
T
able
2,
since
the
train-test
split
w
as
performed
at
image
le
v
el
rather
than
by
condition
(see
subsection
4.1).
T
able
2.
Data
collection
rig
parameters
P
arameter
V
alue/range
Camera-to-meter
distance
5–12
cm
(production:
8
cm)
Horizontal
vie
wing
angle
0°–30°
of
f-axis
V
ertical
tilt
angle
0°–15°
of
f-axis
Illumination
source
Inte
grated
O
V2640
ash
LED
Capture
resolution
320
×
240
JPEG
Meter
brand
Baylan
mechanical
(single)
Ima
g
e
pr
ocessing
and
computer
vision
on
low-cost
micr
ocontr
oller
s:
a
case
study
on
...
(Sohr
ab
J
alali)
Evaluation Warning : The document was created with Spire.PDF for Python.
634
❒
ISSN:
2089-4864
T
otal
number
of
images
in
this
dataset
is
6,155,
where
4,961
of
them
represent
the
training
set
while
1,194
images
form
the
testing
set
(80%/20%
ratio).
Of
these,
2,694
images
carry
digit-le
v
el
bounding
box
annotations
(2,141
train,
553
test),
each
with
all
v
e
digits
indi
vidually
mark
ed,
yielding
a
total
of
13,470
bounding
box
annotations.
Of
these
annotations,
9,622
were
hand-dra
wn
and
3,848
were
generated
via
an
au-
tomatic
suggestion
mechanism
based
on
a
hand-dra
wn
reference
box
in
the
same
image,
subsequently
re
vie
wed
and
corrected
by
hand.
The
remaining
3,461
images
(2,820
train,
641
test)
contain
no
digit-le
v
el
box
es
and
no
ground-truth
label
of
an
y
kind,
including
no
full
meter
reading
v
alue.
The
label
eld
for
these
les
carries
only
a
le
identier
.
Consequently
these
images
were
not
used
in
model
training:
the
ef
fecti
v
e
training
sample
size
is
limited
to
the
2,141
box-annotated
training
images,
for
which
cell-le
v
el
ground
truth
could
be
generated.
The
641
box-unlabelled
test
images
were
run
through
inference
after
training
solely
to
observ
e
whether
the
model
produced
a
structurally
complete
v
e-digit
output.
In
the
absence
of
ground
truth
this
cannot
be
scored
for
correctness.
551
of
the
641
images
(86.0%)
yielded
a
complete
v
e-digit
output
group,
which
is
a
structural-
completeness
indicator
only
and
not
a
reading-accurac
y
metric.
Digit
widths
range
from
25
to
41
pix
els
and
heights
from
37
to
61
pix
els.
The
distrib
ution
of
the
number
of
instances
per
class
sho
ws
an
imbalance,
where
the
most
common
class
is
“3”
with
1,965
instances
(14.6%),
and
the
least
common
are
“1”
and
“6”
with
1,158
instances
each
(8.6%).
Pre-processing
steps
applied
before
training
included
centre-cropping
to
the
digit
re
gion,
grayscale
con
v
ersion,
and
normalisation
to
a
96
×
96
pix
el
input.
Augmentation
included
random
rotation
(
±
15
◦
),
zoom
(0.85–1.15
×
),
and
Gaussian
blur
.
3.4.
Model
ar
chitectur
e
selection
The
choice
of
an
architecture
w
as
limited
to
the
f
act
t
hat
the
ESP32
only
has
520
KB
of
SRAM
mem-
ory
.
Most
OCR
librarie
s
(such
as
T
esseract
or
EasyOCR)
and
object
d
e
tection
algorithms
(including
Y
OLO,
F
aster
R-CNN,
or
v
ariations
of
SSDs)
consume
hundreds
of
me
g
abytes
of
memory
,
and
require
x86
or
ARM
processors
with
dedicated
NEON
or
CUD
A
acceleration,
hardw
are
entirely
absent
on
the
ESP32.
In
the
conte
xt
of
suitable
architectures
for
embedded
de
vi
ces,
MobileNetV2
w
as
selected
because
depthwise
separable
con
v
o-
lutions
allo
w
for
fe
wer
multiply-accumulate
operations
while
still
pro
viding
suf
cient
representational
capac-
ity
to
recognize
digits
among
ten
classes.
Compared
to
MobileNetV1,
MobileNetV2
uses
an
in
v
erted
residual
structure,
which
yields
better
gradient
o
w
and
lo
wer
acti
v
ation
memory
at
equi
v
alent
parameter
counts.
The
nal
INT8-quantized
model
ts
within
235.6
KB
peak
RAM,
less
than
half
the
a
v
ailable
b
udget.
3.5.
Model
ar
chitectur
e
and
training
The
digit
recognition
model
is
made
up
of
a
backbone
inspired
by
MobileNetV2’
s
in
v
er
ted-residual
block
structure,
signicantly
narro
wed
relati
v
e
to
the
standard
architecture,
combined
with
a
dense
classica-
tion
head,
accepting
96
×
96
grayscale
input.
Depthwise
separable
con
v
olutions
k
eep
the
multiply-accumulate
count
and
parameter
total
within
the
ESP32’
s
memory
b
udget.
The
backbone
reduces
the
input
spatially
to
a
x
ed
12
×
12
grid
of
cells,
each
co
v
ering
an
8
×
8-pix
el
re
gion
of
the
input.
Each
cell
is
independently
classied
via
softmax
into
ele
v
en
cate
gories:
background
or
one
of
ten
digit
classes.
No
bounding
box
coordinates
are
re
gressed.
At
inference,
adjacent
cells
sharing
the
same
predicted
digit
class
abo
v
e
the
condence
threshold
are
geometrically
mer
ged
into
a
single
bounding
box
for
display
purposes,
without
an
y
learned
localisation
component.
This
mer
gi
ng
follo
ws
a
simple
axis-aligned-box
(AABB)
adjacenc
y
test
rather
than
an
intersection
o
v
er
union
(IoU)
threshold:
the
grid
is
scanned,
each
positi
v
e
cell
starts
or
e
xtends
a
group,
and
cells
are
joined
to
a
group
when
their
boundaries
touch
or
o
v
erlap,
with
a
nal
mer
ge
pass
across
all
groups.
Cells
of
dif
ferent
classes
ne
v
er
mer
ge
into
the
same
group
because
each
cell
carries
a
single
softmax-ar
gmax
label.
T
raining
labels
were
generated
from
the
digit-le
v
el
bounding
box
es
described
in
subsection
3.3
as
follo
ws:
the
centre
(cx,
c
y)
of
each
b
ox
w
as
computed
and
mapped
to
a
single
grid
cell
via
oor
di
vision
by
the
8-pix
el
cell
stride,
cell
x
=
oor(cx/8)
and
cell
y
=
oor(c
y/8).
Only
that
single
centre
cell
w
as
assigned
the
corresponding
digit
label.
Other
cells
geometrically
o
v
erlapped
by
the
same
box
were
not
separately
labelled.
All
remaining
cells
def
aulted
to
the
background
class
with
no
additional
rule.
No
IoU-bas
ed
o
v
erlap
threshold
w
as
used.
The
cell-label
ass
ignment
depends
solely
on
the
centre
point.
Because
adjacent
digits
in
a
v
e-digit
reading
are
spaced
well
be
yond
one
cell
width
apart,
no
tw
o
digits’
centres
were
observ
ed
to
f
all
within
the
same
cell
in
this
dataset.
Int
J
Recongurable
&
Embedded
Syst,
V
ol.
15,
No.
3,
No
v
ember
2026:
629–644
Evaluation Warning : The document was created with Spire.PDF for Python.
Int
J
Recongurable
&
Embedded
Syst
ISSN:
2089-4864
❒
635
T
raining
w
as
carried
out
using
cloud
GPU
infrastructure
without
ImageNet
pretraining.
All
la
y
e
rs
were
trai
ned
from
scratch,
starting
from
a
learning
rate
of
1e-4,
wi
th
ReduceLR
OnPlateau
(patience=5,
f
ac-
tor=0.5)
halving
the
learning
rate
whene
v
er
v
alidation
loss
f
ailed
to
impro
v
e
for
v
e
epochs.
T
raining
w
as
bounded
by
EarlyStopping
(patience=10,
restore
best
weights=T
rue)
with
a
maximum
of
1,000
epochs
and
a
batch
size
of
32.
The
loss
function
is
a
per
-cell
weighted
cate
gorical
cross-entrop
y
,
with
the
weight
for
each
digit
class
computed
as
a
x
ed
fore
ground
boost
f
actor
(15.0)
multiplied
by
the
ratio
of
the
median
class
fre-
quenc
y
to
that
class’
s
frequenc
y
.
The
background
class
weight
is
x
ed
at
1.0.
A
x
ed
random
seed
(1337)
w
as
used
for
the
train/v
alidation
split
and
data
shuf
ing.
No
seed
w
as
x
ed
for
in-training-loop
randomness
such
as
weight
initialisation
or
batch
ordering,
so
the
training
procedure
itself
is
not
fully
deterministic.
The
de
v
elopment
en
vironment
used
T
ensorFlo
w
2.21.0,
though
the
e
xact
v
ersion
used
for
the
original
training
run
could
not
be
conrmed
from
the
code
base.
After
oat-precision
training,
a
dedicated
calibration
subset
of
200
images,
collected
separately
from
the
training
set
and
not
dra
wn
from
the
training
split,
w
as
used
to
deri
v
e
INT8
acti
v
ation
ranges
via
representati
v
e
dataset
calibration.
3.6.
INT8
quantization
Post-training
INT8
quantization
con
v
erts
all
we
ights
and
act
i
v
ations
from
FP32
to
8-bit
inte
ger
rep-
resentation,
follo
wi
ng
Nagel
et
al.
[21]
as
v
alidated
for
MCU
deplo
yment
by
No
v
ac
et
al.
[22].
The
Float32
model
w
as
ne
v
er
e
x
ecuted
on
the
ESP32.
At
887.2
KB
it
e
xceeds
the
board’
s
520
KB
SRAM
b
udget.
Its
98.54%
accurac
y
gure
w
as
obtained
from
a
generic
e
v
aluation-function
output
in
the
training
en
vironment
(PC/GPU,
T
ensorFl
o
w),
not
from
the
detailed
553-image
box-annotated
confusion-matrix
analys
is
used
for
the
INT8
model
in
subsection
4.2.
Because
the
tw
o
gures
deri
v
e
from
dif
ferent
e
v
aluation
methodologies,
no
class-le
v
el
F1-score
is
a
v
ailable
for
Float32
and
the
tw
o
accurac
y
v
alues
are
not
directly
comparable.
The
com-
piled
INT8
TFLite
binary
occupies
approximately
142
KB
(141,952
bytes)
on
disk
as
a
atb
uf
fer
.
The
EON
compiler
con
v
erts
this
into
ra
w
C++
arrays
and
direct
function
calls,
stripping
the
atb
uf
fer
schema,
reection,
and
operator
-code-table
o
v
erhead,
which
is
wh
y
the
resulting
94.8
KB
on-de
vice
binary
is
smaller
than
the
source
atb
uf
fer
le.
T
able
3
summarises
the
comparison.
T
able
3.
Float32
vs.
INT8
model:
k
e
y
metrics
Metric
Float32
INT8
Change
Peak
RAM
(KB)
887.2
235.6
3
.
8
×
↓
Flash
(KB)
—
94.8
—
Inference
(ms)
—
2.04
(min
1.98,
max
2.17,
SD
0.05,
n=100)
—
Accurac
y
(%)
98.54
99.60
+1.06
pp
∗
F1-score
—
0.9355
—
∗
Ra
w
arithmetic
dif
ference
between
v
alues
obtained
under
dif
ferent
e
v
aluation
methodologies
(see
te
xt).
Not
tested
for
statistical
signicance
and
should
not
be
read
as
e
vidence
that
INT8
impro
v
es
accurac
y
.
3.7.
Firmwar
e
contrib
utions
Three
mechanisms
were
added
to
the
ESP32
rmw
are
on
top
of
the
basic
inference
loop.
3.7.1.
T
emporal
consistency
check
The
rmw
are
maintains
a
rolling
b
uf
fer
of
the
three
most
recent
successful
readings.
A
reading
is
la-
belled
conrmed
only
when
all
three
entries
are
identical.
This
eliminates
single-frame
errors,
sensor
noise,
and
motion
artef
acts.
Each
transmission
to
the
serv
er
carries
a
confirmed
ag
so
the
dashboard
can
distinguish
v
eried
readings
from
tentati
v
e
ones.
3.7.2.
On-de
vice
anomaly
detection
The
rmw
are
maintains
a
reference
v
alue
that
is
set
at
the
last
reset
point,
either
the
pre
vious
anomal
y
e
v
ent
or
the
conrmed
reading
at
session
start,
and
does
not
update
on
e
v
ery
reading.
After
each
conrmed
reading,
the
rmw
are
comput
es
the
cumulati
v
e
dif
ference
between
the
ne
w
v
alue
and
this
x
ed
reference.
If
this
dif
ference
e
xceeds
a
congurable
threshold
(def
ault:
ten
units),
the
reading
is
classied
as
an
anomaly
,
the
anomaly
a
g
is
set
in
the
transmission
payload,
and
the
reference
v
alue
is
reset
to
the
current
reading.
Because
the
reference
only
resets
on
an
anomaly
e
v
ent
rather
than
e
v
ery
c
ycle,
the
same
rule
catches
both
sudden
usage
spik
es
and
slo
w
leaks
that
accumulate
gradually
across
man
y
reading
c
ycles.
This
enables
detection
of
pipe
leaks
or
une
xpected
high-usage
e
v
ents
entirely
on
the
microcontroller
,
without
an
y
serv
er
-side
in
v
olv
ement.
Ima
g
e
pr
ocessing
and
computer
vision
on
low-cost
micr
ocontr
oller
s:
a
case
study
on
...
(Sohr
ab
J
alali)
Evaluation Warning : The document was created with Spire.PDF for Python.
636
❒
ISSN:
2089-4864
The
def
ault
threshold
of
ten
units
w
as
selected
empirically
based
on
the
maximum
obser
v
ed
cumulati
v
e
con-
sumption
increme
nt
during
normal
usage
on
the
test
meter
.
It
is
e
xposed
as
a
compile-time
constant
to
allo
w
operators
to
calibrate
it
for
meters
with
dif
ferent
o
w
proles
or
usage
patterns.
The
approach
is
fundamentally
dif
ferent
from
Ba
w
ankar
et
al.
[28],
who
transmit
vision-deri
v
ed
readings
to
the
cloud
for
further
analysis.
3.7.3.
Adapti
v
e
sampling
The
reading
interv
al
is
adjusted
dynamically
.
When
the
units
digit
of
the
meter
v
alue
stays
unchanged
across
consecuti
v
e
readings,
the
interv
al
increases
by
5
s
per
c
ycle
up
to
a
ceiling
of
60
s.
When
the
units
digit
changes,
indicating
acti
v
e
w
ater
o
w
,
the
interv
al
immediately
drops
to
5
s,
then
decreases
by
2
s
per
c
ycle
do
wn
to
a
oor
of
3
s.
An
anomaly
e
v
ent
immediately
resets
to
the
minimum
interv
al
to
enable
rapid
consecuti
v
e
readings.
This
polic
y
cuts
unnecessary
inference
c
ycles
during
idle
periods
without
sacricing
responsi
v
eness.
3.8.
MeterW
atch
inter
net
of
things
dashboard
MeterW
atch
is
a
Flask
web
application
that
serv
es
as
the
monitoring
front-end
for
the
system.
Figure
3
sho
ws
the
complete
hardw
are–softw
are
architecture
connecting
the
ESP32-CAM
t
o
the
MeterW
atch
dashboard.
On
each
HTTP
POST
from
the
ESP32-CAM,
the
serv
er
recei
v
es
the
ra
w
JPEG
image,
the
recognised
meter
v
alue,
mer
ged-cell
bounding
box
coordinates
for
display
o
v
erlay
,
and
the
three
rmw
are
ags
(
confirmed
,
anomaly
,
sampling
interval
).
It
dra
ws
bounding
box
o
v
erlays
on
the
recei
v
ed
image
and
stores
all
data
in
memory
.
Figure
3.
System
architecture
connecting
the
ESP32-CAM,
the
Flask
serv
er
,
and
the
MeterW
atch
dashboard
The
dashboard
frontend,
refreshed
via
AJ
AX
polling
e
v
ery
3
s
,
pro
vides:
a
li
v
e
image
grid
of
the
ten
most
recent
unique
readings
with
o
v
erlays.
A
Chart.js
trend
graph
of
the
last
20
readings
with
anomaly
mark
ers
highlighted
in
red.
A
connected
de
vice
panel
supporti
ng
multiple
simultaneous
ESP32-CAM
units.
Real-time
session
statistics
(conrmed
reading
rate,
anomaly
rate,
a
v
erage
sampling
interv
al,
system
success
rate).
Also
a
full
reading
history
table
with
per
-ro
w
highlighting
for
anomalies,
conrmed
readings,
and
error
states.
Figure
4
sho
ws
t
he
MeterW
atch
web
interf
ace
itself,
illustrating
the
li
v
e
reading
grid,
connected-de
vice
panel,
session
statistics,
trend
chart,
and
reading
history
table
described
abo
v
e.
The
de
vice
count,
reading
total
and
session
statistics
in
this
screenshot
demonstrate
interf
ace
functionality
only
and
do
not
represent
the
single-meter
e
xperimental
results
reported
in
section
4.
Int
J
Recongurable
&
Embedded
Syst,
V
ol.
15,
No.
3,
No
v
ember
2026:
629–644
Evaluation Warning : The document was created with Spire.PDF for Python.
Int
J
Recongurable
&
Embedded
Syst
ISSN:
2089-4864
❒
637
Figure
4.
MeterW
atch
dashboard
interf
ace
(illustrati
v
e
screenshot)
4.
RESUL
TS
AND
DISCUSSION
4.1.
Experimental
pr
otocol
All
metrics
were
collected
on
a
ph
ysical
Baylan-brand
mechanical
w
ater
me
ter
under
the
same
real
-
w
orld
conditions
used
during
data
collection.
The
full
6,155-image
dataset
w
as
collected
across
approximately
6–7
distinct
capture
sessions.
The
test
images
were
e
xcluded
from
model
training
and
INT8
calibration.
Ho
w-
e
v
er
,
because
the
split
w
as
performed
at
image
le
v
el
rather
than
acquisition-session
le
v
el,
the
e
v
aluation
should
be
interpreted
as
an
internal
frame-le
v
el
v
alidation
rather
than
an
independent
session-le
v
el
test.
The
train-
test
split
w
as
performed
by
random
image-le
v
el
partitioning
across
the
complete
capture
pool
rather
than
by
session-le
v
el
separation.
T
est
images
may
therefore
share
capture
ses
sions,
lighting
setups,
and
meter
posi-
tions
with
training
images,
dif
fering
at
the
frame
le
v
el
rather
than
representing
fully
independent
acquisition
conditions.
This
should
be
tak
en
into
account
when
interpreting
the
reported
accurac
y
.
Ima
g
e
pr
ocessing
and
computer
vision
on
low-cost
micr
ocontr
oller
s:
a
case
study
on
...
(Sohr
ab
J
alali)
Evaluation Warning : The document was created with Spire.PDF for Python.
638
❒
ISSN:
2089-4864
4.2.
Classication
perf
ormance
The
INT8
model
w
as
e
v
aluated
on
the
553-image
box-annotated
test
subset,
comprising
79,632
in-
di
vidually
labelled
grid
cells
(2,765
true
digit
cells
and
76,867
true
background
cells)
at
a
x
ed
classication
condence
threshold
of
0.5.
The
model
achie
v
es
a
99.60%
o
v
erall
cell-le
v
el
accurac
y
including
the
background
class
(79,310
of
79,632
ce
lls
correctly
classied).
Because
background
cells
mak
e
up
96.5%
of
all
e
v
aluated
cells
and
are
classied
almost
without
error
(99.69%
recall),
this
gure
is
dominated
by
the
background
class
and
should
not
be
read
as
a
measure
of
digit-recognition
dif
culty
.
Restricting
the
e
v
aluation
to
the
2,765
true
digit
cells
gi
v
es
a
96.89%
digit-only
micro
accurac
y
(2,679
of
2,765).
Macro
precision
across
the
ten
digit
classes
is
90.44%,
macro
recall
is
96.92%,
and
macro
F1
is
0.9355.
Class-le
v
el
recall
ranges
from
93.89%
(digit
“6”,
the
class
most
frequently
confused
with
digits
“5”
and
“7”)
to
99.16%
(digit
“2”).
Class-le
v
el
F1
ranges
from
0.9142
(digit
“8”)
to
0.9631
(digit
“3”).
These
gures
deri
v
e
from
a
single
Baylan-brand
meter
and
an
image-le
v
el
split
across
approximately
6–7
capture
ses
sions.
Multi-session
and
cross-brand
v
alidation
are
needed
before
treating
this
accurac
y
as
a
general
performance
bound.
Complete
v
e-digit
meter
readings
were
correctly
recognised
in
485
of
the
553
box-annotated
test
images,
corresponding
to
an
e
xact-reading
accurac
y
of
87.70%.
Figure
5
sho
ws
the
ro
w-normalised
confusion
matrix
on
the
553-image
test
subset
(79,632
grid
cells)
with
per
-class
recall
on
the
diagonal.
The
dominant
confusion
sources
are
misclassication
of
true-class
sam-
ples
as
background,
reaching
3.45%
for
digit
“8”
and
2.62%
for
digit
“6”,
and
genuine
inter
-digit
confusion,
most
notably
digit
“6”
being
misread
as
digit
“5”
(1.75%)
and
digit
“7”
(1.31%),
and
digit
“9”
being
misread
as
di
git
“8”
(2.25%).
F
our
digit-pair
confusions
e
xceed
1%
of
the
corresponding
true
class:
“0”
→
“9”
(1.17%),
“6”
→
“5”
(1.75%),
“6”
→
“7”
(1.31%),
and
“9”
→
“8”
(2.25%).
Background
misclass
ication
is
therefore
not
the
sole
error
source.
Figure
6
sho
ws
the
per
-class
F1
distrib
ution.
Figure
5.
Ro
w-normalised
confusion
matrix
of
the
INT8
model
on
the
553-image
box-annotated
test
subset
Int
J
Recongurable
&
Embedded
Syst,
V
ol.
15,
No.
3,
No
v
ember
2026:
629–644
Evaluation Warning : The document was created with Spire.PDF for Python.