\documentclass{bmvc2k}

%% Enter your paper number here for the review copy
% \bmvcreviewcopy{??}

\title{Physics-Constrained Lightweight Neural Networks for Calibrated Smog-Level Classification}

% Enter the paper's authors in order
% \addauthor{Name}{email/homepage}{INSTITUTION_CODE}
\addauthor{Sharon Christa}{}{1}
\addauthor{Mansi Bhonsle}{}{2}
% Enter the institutions
% \addinstitution{Name\\Address}
\addinstitution{
 School of Computing\\
 MIT Art Design and Technology University\\
 Pune, India
}

\runninghead{Researcher, Researcher}{BMVC Author Guidelines}

% Any macro definitions you would like to include
% These are not defined in the style file, because they don't begin
% with \bmva, so they might conflict with the user's own macros.
% The \bmvaOneDot macro adds a full stop unless there is one in the
% text already.
\def\eg{\emph{e.g}\bmvaOneDot}
\def\Eg{\emph{E.g}\bmvaOneDot}
\def\etal{\emph{et al}\bmvaOneDot}
\def\eg{\emph{e.g}\bmvaOneDot}
\def\Eg{\emph{E.g}\bmvaOneDot}
\def\etal{\emph{et al}\bmvaOneDot}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{arrows.meta,positioning,calc,fit}

%-------------------------------------------------------------------------
% Document starts here
\begin{document}

\maketitle

\begin{abstract}
Air pollution is a major environmental and health challenge, with fine particulate matter (PM\textsubscript{2.5}) responsible for millions of premature deaths each year. Ground-based sensors provide reliable air quality measurements but are costly and sparsely distributed, limiting large-scale coverage. As a complementary approach, image-based methods using street-level photographs have emerged, though most rely on large, computationally heavy networks that neglect physical principles of haze formation and often produce poorly calibrated outputs. This paper introduces a lightweight, physics-informed, and calibrated framework for smog-level classification from street-level imagery. The backbone model is MobileNetV3-Small, designed for efficient CPU inference. To better recognize minority pollution categories, physics-informed regularization is applied by embedding atmospheric scattering cues—contrast, sharpness, and dark channel prior—into the loss function. Reliability is enhanced through test-time augmentation and temperature scaling, while interpretability is addressed using Grad-CAM visualizations and monotonic physics-feature trends. Experiments on the Smartphone-Based Air Pollution Image Dataset (SAPID) show that the proposed Physics v2 model achieves 86.5\% test accuracy and a macro-F1 score of 0.835, surpassing the baseline MobileNetV3-Small (81.1\%, 0.756 macro-F1). The framework also operates in real time on CPU hardware at over 100 FPS, with an Expected Calibration Error (ECE) of 0.071. These results demonstrate the potential of combining lightweight architectures, physics priors, and calibration techniques to deliver accurate, interpretable, and deployable vision systems for low-cost urban air quality monitoring.
\end{abstract}

%-------------------------------------------------------------------------
\section{Introduction}
\label{sec:intro}
Air pollution is among the most significant global health risks, with approximately seven million premature deaths annually linked to fine particulate matter and other pollutants \cite{WHO2020}. Chronic exposure to PM\textsubscript{2.5} and PM\textsubscript{10} is associated with cardiovascular and respiratory diseases, as well as impaired child lung development \cite{Cohen2017}. Rapid urbanization and industrialization, especially in low- and middle-income countries, exacerbate air quality challenges where dense monitoring infrastructure is lacking.

Ground-based stations provide precise pollutant measurements but remain expensive to install and maintain, leading to sparse coverage and limiting fine-grained assessments \cite{Huang2019}. To overcome this, recent research has explored low-cost alternatives leveraging ubiquitous sensing modalities such as smartphones and public cameras. Street-level imagery captures visual indicators of pollution, including haze and reduced visibility, making it a promising complementary data source.

Early computer vision methods employed handcrafted features such as edge sharpness and color attenuation. More recent approaches apply deep learning, directly regressing particulate levels from images \cite{Huang2019, Li2021}. Despite promising results, three key limitations remain: (i) reliance on large models like ResNet and VGG that require GPUs, hindering deployment in resource-constrained settings; (ii) neglect of atmospheric scattering principles underlying haze formation; (iii) class imbalance in critical but underrepresented categories such as “Unhealthy for Sensitive Groups” and “Very Unhealthy”; and (iv) overconfident predictions, underscoring the need for calibration \cite{Guo2017}.

Lightweight networks such as MobileNetV3 \cite{Howard2019} offer efficiency for edge devices, while physics-informed learning introduces domain priors into training. Atmospheric cues like contrast, sharpness, and dark channel priors are particularly relevant to haze modeling \cite{Narasimhan2002, He2009}. Calibration methods (e.g., temperature scaling) enhance reliability \cite{Guo2017}, and interpretability techniques like Grad-CAM \cite{Selvaraju2017} provide transparency.

This study proposes a lightweight, physics-informed, and calibrated framework for smog-level classification using MobileNetV3-Small. Evaluated on the Smartphone-based Air Pollution Image Dataset (SAPID), the approach integrates physics priors and calibration to improve recognition of minority classes, ensure reliable predictions, and enable efficient CPU-only deployment. 
\section{Related Work}
Compact CNNs have enabled efficient on-device perception. MobileNetV2 introduced inverted residuals with linear bottlenecks and depthwise separable convolutions \cite{Sandler2018}, while MobileNetV3 added h-swish activation, squeeze-and-excitation, and hardware-aware NAS for state-of-the-art accuracy under latency constraints \cite{Howard2019}. These remain strong baselines for CPU-only deployment.
Adverse-weather vision builds on the atmospheric scattering model, where observed radiance combines attenuated scene radiance and airlight \cite{Narasimhan2002}. The dark channel prior (DCP) became a seminal dehazing heuristic \cite{He2009}, and benchmarks such as RESIDE \cite{Li2017Reside} established standardized evaluation. Air-quality estimation evolved from handcrafted cues to CNN-based regression/classification of PM$_{2.5}$/AQI from street or surveillance imagery, sometimes extended with temporal modeling (CNN–LSTM) \cite{Wang2023_SurveillanceAQ}. Practical deployments for real-time regression \cite{Kow2022_JEnvMan} and hybrid pipelines with satellites further highlight its applicability.

PINNs embed governing equations as constraints to improve physical fidelity \cite{Raissi2019}. For haze/smog vision, cues such as contrast, Laplacian sharpness, and DCP align with scattering physics and are increasingly used as priors or regularizers \cite{Hsieh2023_HLE}. Deep models are often miscalibrated. Guo \emph{et al.} \cite{Guo2017} showed that temperature scaling significantly improves reliability without reducing accuracy. In environmental monitoring, calibrated confidence estimates are critical for thresholding and decision support. RESIDE \cite{Li2017Reside} supports dehazing evaluation, while HVAQ links images with pollutant and meteorological data across cities \cite{Chen2021HVAQ}. SAPID \cite{SAPID2024} provides smartphone photos grouped into five EPA AQI categories, enabling lightweight classification studies.
Deployment faces dataset shift across cameras, cities, seasons, and co-occurring weather \cite{QuioneroCandela2009}. Classical domain adaptation aligns source and target via CORAL \cite{Sun2016DeepCORAL} or adversarial learning \cite{Ganin2016DANN}. Surveys \cite{Wang2018SurveyUDA, Wilson2020SurveyUDA} document strong gains, while recent test-time adaptation dispenses with source data and adapts using entropy minimization (TENT) \cite{Wang2021TENT} or source-free SHOT \cite{Liang2020SHOT}. Such lightweight adaptation is promising for environmental vision where labels are scarce.

Across lightweight CNNs, image-based haze/AQ estimation, physics-informed learning, calibration, and domain adaptation, several gaps remain salient for deployment in resource-constrained urban monitoring since many models assume GPU availability and large backbones; fewer studies report accuracy–latency trade-offs for CPU-only inference suitable for smart phones or embedded devices \cite{Howard2019}. Learning pipelines often remain purely data-driven; the literature shows fewer examples where atmospheric scattering cues (contrast, sharpness, dark-channel statistics) are explicitly enforced during training in a way that improves minority-class recognition. Image-based AQ estimation systems rarely report calibration metrics; yet calibrated confidence is critical for thresholding and alerting in environmental applications \cite{Guo2017}. Datasets such as SAPID exhibit severe class imbalance, with under-represented high-severity categories. Robust learning under such imbalance, coupled with interpretability, remains under-explored at the edge. Cross-region generalization and test-time adaptation are underutilized in AQ-from-images, despite clear distribution shifts across cameras, cities, and seasons \cite{Wang2021TENT, Liang2020SHOT, Wilson2020SurveyUDA}.

These observations indicate a research gap for a \emph{lightweight, physics-informed, and calibrated} air-quality classifier that performs on CPU-class hardware, improves minority-class recognition, and remains robust under realistic distribution shifts via simple test-time procedures. Such a design directly addresses operational constraints in low-cost, scalable urban monitoring.

\section{Research Methods}
\label{sec:method}
The Smartphone-Based Air Pollution Image Dataset (SAPID) \cite{SAPID2024} is used as the primary benchmark. It consists of 492 street-level images annotated with five air quality categories following the US Environmental Protection Agency (EPA) Air Quality Index (AQI): Good, Moderate, Unhealthy for Sensitive Groups (USG), Unhealthy, and Very Unhealthy. As shown earlier (Table~\ref{tab:dataset}), the dataset is highly imbalanced, with only 32 samples in the USG class and 40 in Very Unhealthy, in contrast to 188 in the Moderate class. Images are resized to $224 \times 224$ and normalized using ImageNet mean and standard deviation. Data augmentation includes random flips, rotations, and color jittering to improve generalization \cite{SAPID2024}. The baseline classifier is based on MobileNetV3-Small \cite{Howard2019}, which uses depthwise separable convolutions, inverted residuals, and squeeze-and-excitation blocks with h-swish activations. For an input image $x \in \mathbb{R}^{3 \times H \times W}$, the network extracts features $f(x) \in \mathbb{R}^{d}$, which are passed to a fully connected classifier:
\[
z = W f(x) + b, \quad \hat{y} = \mathrm{softmax}(z),
\]
where $z \in \mathbb{R}^{C}$ are the logits, $C=5$ is the number of AQI classes, and $\hat{y}$ is the predicted probability distribution. The baseline is trained using class-weighted cross-entropy loss:
\[
\mathcal{L}_{CE} = - \sum_{i=1}^{C} w_i \, y_i \log \hat{y}_i,
\]
where $y$ is the one-hot ground truth vector and $w_i$ are class weights to address dataset imbalance.

\subsection{Physics-Informed Model}
To integrate atmospheric scattering priors \cite{Narasimhan2002, He2009}, three physics-inspired features are extracted from each input image:
\begin{enumerate}
    \item \textbf{Contrast ($C(x)$)}: Standard deviation of pixel intensities or global contrast tensor, expected to decrease with pollution severity.
    \item \textbf{Sharpness ($S(x)$)}: Laplacian variance measuring edge clarity, also decreasing under haze.
    \item \textbf{Dark Channel Prior ($D(x)$)}: Defined as 
    \[
    D(x) = \min_{c \in \{R,G,B\}} \Big( \min_{u \in \Omega(x)} I_c(u) \Big),
    \]
    where $\Omega(x)$ is a local patch around pixel $x$, and $I_c(u)$ is the intensity in color channel $c$. The DCP increases under heavier smog.
\end{enumerate}

Let $\phi(x) = [C(x), S(x), D(x)]$ be the physics feature vector. The model enforces monotonic consistency by penalizing violations of the expected order across pollution categories. For two samples $(x_i,y_i)$ and $(x_j,y_j)$ with $y_i < y_j$ (less polluted vs. more polluted), the physics-informed ranking loss is defined as:
\[
\mathcal{L}_{physics} = \sum_{i,j} \Big( \max\big(0, \, (C(x_j)-C(x_i)) \big) + \max\big(0, \, (S(x_j)-S(x_i)) \big) + \max\big(0, \, (D(x_i)-D(x_j)) \big) \Big).
\]
This enforces decreasing contrast and sharpness, and increasing dark channel prior, with rising pollution severity.

The total objective is:
\[
\mathcal{L}_{total} = \mathcal{L}_{CE} + \lambda_{phys} \mathcal{L}_{physics},
\]
where $\lambda_{phys}=0.2$ balances classification and physics constraints.

Neural networks are often miscalibrated, producing overconfident predictions \cite{Guo2017}. Logits $z$ are calibrated using temperature scaling:
\[
\hat{y}^{cal}_i = \frac{\exp(z_i / T)}{\sum_{j=1}^C \exp(z_j / T)},
\]
where $T > 0$ is a learned temperature parameter optimized on the validation set. A perfectly calibrated model satisfies
\[
\mathbb{P}(Y = y \mid \hat{p}) = \hat{p}, \quad \forall \hat{p} \in [0,1].
\]

To improve robustness, test-time augmentation (TTA) generates $K$ transformations $\{t_k(x)\}_{k=1}^K$ for each input, and predictions are averaged:
\[
\hat{y}_{TTA} = \frac{1}{K} \sum_{k=1}^K \hat{y}(t_k(x)).
\]

\begin{figure}[t]
\centering
\resizebox{\linewidth}{!}{%
\begin{tikzpicture}[
  font=\small, >=Latex, node distance=7mm and 10mm,
  blk/.style={draw, rounded corners, minimum width=20mm, minimum height=7mm, align=center},
  lite/.style={draw, rounded corners, fill=gray!10, minimum width=18mm, minimum height=6mm, align=center},
  io/.style={draw, rounded corners, fill=blue!5, minimum width=18mm, minimum height=6mm, align=center},
  line/.style={-Latex, thick}, dash/.style={-Latex, dashed},
  every node/.style={transform shape}
]
% main chain (WHAT)
\node[io]   (in)   {Input $x$};
\node[blk, right=of in]   (back) {MobileNetV3};
\node[lite, right=of back](log)  {Logits $\mathbf z$};
\node[lite, right=of log] (sm)   {Softmax $\hat{\mathbf y}$};
\node[lite, right=of sm]  (cal)  {Temp.\ Scaling $\hat{\mathbf y}^{cal}$};
\node[io,  right=of cal]  (out)  {AQI class};

\draw[line] (in)--(back)--(log)--(sm)--(cal)--(out);

% physics cues (only as a component)
\node[lite, below=9mm of back] (phys) {Physics cues\\ $C(x),S(x),D(x)$};
\draw[line] (in.south) |- (phys.west);

% TTA: just a stub (component-level)
\node[lite, below=9mm of sm] (tta) {TTA (augment \& average)};
\draw[dash] (sm.south) -- (tta.north);
\draw[dash] (tta.north east) to[bend left] (cal.south);

\end{tikzpicture}}
\caption{Architecture overview}
\label{fig:framework_overview}
\end{figure}



\begin{figure}[t]
\centering
\resizebox{\linewidth}{!}{%
\begin{tikzpicture}[
  font=\small, >=Latex, node distance=7mm and 10mm,
  box/.style={draw, rounded corners, minimum width=20mm, minimum height=7mm, align=center},
  op/.style={draw, rounded corners, fill=gray!10, minimum width=19mm, minimum height=6mm, align=center},
  loss/.style={draw, rounded corners, fill=red!5, minimum width=20mm, minimum height=7mm, align=center},
  io/.style={draw, rounded corners, fill=blue!5, minimum width=18mm, minimum height=6mm, align=center},
  sum/.style={circle, draw, inner sep=1.0pt, minimum size=3.6mm},
  line/.style={-Latex, thick}, dash/.style={-Latex, dashed},
  every node/.style={transform shape}
]
% forward (shared)
\node[io]  (x) {Input $x$};
\node[box, right=of x] (mnet) {MobileNetV3-Small};
\node[op,  right=of mnet] (feat) {Features $f(x)$};
\node[op,  right=of feat] (log)  {Logits $\mathbf z$};
\node[op,  right=of log]  (sm)   {Softmax $\hat{\mathbf y}$};
\node[op,  right=of sm]   (cal)  {Temp.\ Scaling $\hat{\mathbf y}^{cal}$};
\node[io,  right=of cal]  (pred) {Prediction};
\draw[line] (x)--(mnet)--(feat)--(log)--(sm)--(cal)--(pred);

% training: classification loss
\node[loss, above=8mm of log] (ce) {$\mathcal L_{\mathrm{CE}}$};
\draw[line] (log.north) -- (ce.south);

% training: physics branch + loss
\node[op, below=13mm of mnet] (phys) {Physics feats\\ $C(x),S(x),D(x)$};
\node[loss, right=of phys] (lphys) {$\mathcal L_{\mathrm{physics}}$};
\draw[line] (x.south) |- (phys.west);
\draw[line] (phys)--(lphys);

% total loss
\node[loss, right=12mm of lphys] (ltot) {$\mathcal L_{\mathrm{total}}$};
\draw[line] (ce.east) |- (ltot.north);
\draw[line] (lphys.east) -- (ltot.west);

% inference: TTA
\node[op, below=12mm of sm] (tta) {TTA transforms $t_k(x)$};
\node[sum, right=7mm of tta] (agg) {$\Sigma$};
\node[op,  right=7mm of agg] (avg) {Average};
\draw[dash] (sm.south) -- (tta.north);
\draw[line] (tta) -- (agg) -- (avg);
\draw[dash] (avg.north) -- ++(0,8mm) -| (cal.north);

% grouping boxes
\node[draw, dashed, rounded corners, fit=(log) (sm) (ce), inner sep=3mm,
      label={[align=center]above:Training (classification)}] {};
\node[draw, dashed, rounded corners, fit=(phys) (lphys), inner sep=3mm,
      label={[align=center]below:Training (physics regularization)}] {};
\node[draw, dashed, rounded corners, fit=(sm) (cal) (pred) (avg), inner sep=3mm,
      label={[align=center]above:Inference (TTA + calibration)}] {};
\end{tikzpicture}}
\caption{End-to-end pipeline}
\label{fig:training_inference_pipeline}
\end{figure}



\begin{figure}[t]
\centering
\resizebox{\linewidth}{!}{% keeps figure within text width and scales text
\begin{tikzpicture}[
    >=Latex,
    font=\small,
    axis/.style={->, thick},
    tick/.style={thin},
    pt/.style={circle, draw, fill=white, inner sep=1.2pt},
    good/.style={circle, draw=black, fill=green!20, inner sep=1.2pt},
    bad/.style={circle, draw=black, fill=red!20, inner sep=1.2pt},
    guide/.style={dashed, gray},
    marginband/.style={fill=blue!8, draw=blue!30, rounded corners},
    every node/.style={transform shape}
]

% --- tighter panel geometry so three panels fit nicely ---
\def\W{4.2}   % width of each panel
\def\H{2.8}   % height of each panel
\def\xoff{5.0}% horizontal shift between panels

% ================= Panel 1: Contrast C (decrease with severity) =================
\begin{scope}[shift={(0,0)}]
  \draw[axis] (0,0) -- (\W,0) node[below right] {Severity $s$};
  \draw[axis] (0,0) -- (0,\H) node[above left] {$C(x)$};

  \draw[guide, thick] (0.35,\H-0.25) -- (\W-0.35,0.45);
  \path[marginband] (0.35,\H-0.02) -- (\W-0.35,0.70) --
                    (\W-0.35,0.20) -- (0.35,\H-0.52) -- cycle;

  \coordinate (Ci) at (1.05,2.3);
  \coordinate (Cj) at (3.15,1.7);
  \node[good, label={[xshift=-3pt,yshift=3pt]left:$i$}]  at (Ci) {};
  \node[good, label={[xshift= 3pt,yshift=-3pt]right:$j$}] at (Cj) {};

  \draw[guide] (Ci) -- ++(0,-2.3);
  \draw[guide] (Cj) -- ++(0,-1.7);
  \draw[guide] (1.05,0) node[below] {$s_i$} -- (1.05,0.06);
  \draw[guide] (3.15,0) node[below] {$s_j$} -- (3.15,0.06);

  \node[align=center] at (\W/2,-0.8) {\textbf{Contrast} (expect $C\downarrow$ as $s\uparrow$)};
\end{scope}

% ================= Panel 2: Sharpness S (decrease with severity) =================
\begin{scope}[shift={(\xoff,0)}]
  \draw[axis] (0,0) -- (\W,0) node[below right] {Severity $s$};
  \draw[axis] (0,0) -- (0,\H) node[above left] {$S(x)$};

  \draw[guide, thick] (0.35,\H-0.25) -- (\W-0.35,0.45);
  \path[marginband] (0.35,\H-0.02) -- (\W-0.35,0.70) --
                    (\W-0.35,0.20) -- (0.35,\H-0.52) -- cycle;

  % intentional violation to illustrate hinge push
  \coordinate (Si) at (1.05,2.2);
  \coordinate (Sj) at (3.15,2.35);
  \node[good, label={[xshift=-3pt,yshift=3pt]left:$i$}]  at (Si) {};
  \node[bad,  label={[xshift= 3pt,yshift=-3pt]right:$j$}] at (Sj) {};

  \draw[guide] (Si) -- ++(0,-2.2);
  \draw[guide] (Sj) -- ++(0,-2.35);
  \draw[guide] (1.05,0) node[below] {$s_i$} -- (1.05,0.06);
  \draw[guide] (3.15,0) node[below] {$s_j$} -- (3.15,0.06);

  \draw[->, red!70] (Sj) -- ++(0,-0.5) node[midway, right, xshift=1pt] {\scriptsize push $\downarrow$};

  \node[align=center] at (\W/2,-0.8) {\textbf{Sharpness} (expect $S\downarrow$ as $s\uparrow$)};
\end{scope}

% ================= Panel 3: Dark Channel D (increase with severity) =================
\begin{scope}[shift={(2*\xoff,0)}]
  \draw[axis] (0,0) -- (\W,0) node[below right] {Severity $s$};
  \draw[axis] (0,0) -- (0,\H) node[above left] {$D(x)$};

  \draw[guide, thick] (0.35,0.50) -- (\W-0.35,\H-0.30);
  \path[marginband] (0.35,0.75) -- (\W-0.35,\H-0.05) --
                    (\W-0.35,\H-0.55) -- (0.35,0.25) -- cycle;

  \coordinate (Di) at (1.05,1.0);
  \coordinate (Dj) at (3.15,2.4);
  \node[good, label={[xshift=-3pt,yshift=3pt]left:$i$}]  at (Di) {};
  \node[good, label={[xshift= 3pt,yshift=-3pt]right:$j$}] at (Dj) {};

  \draw[guide] (Di) -- ++(0,-1.0);
  \draw[guide] (Dj) -- ++(0,-2.4);
  \draw[guide] (1.05,0) node[below] {$s_i$} -- (1.05,0.06);
  \draw[guide] (3.15,0) node[below] {$s_j$} -- (3.15,0.06);

  \node[align=center] at (\W/2,-0.8) {\textbf{Dark Channel} (expect $D\uparrow$ as $s\uparrow$)};
\end{scope}

% ================= Bottom box: Pairwise hinge loss (moved under panels) =================
\begin{scope}[shift={(0,-3.3)}] % move below the panels for readability
  \node[draw, rounded corners, align=left, inner sep=2.2mm, minimum width=13.2cm] (lossbox) {%
    \scriptsize
    \textbf{Pairwise ranking loss} for $s_i < s_j$:\\[-2pt]
    $\displaystyle
      \mathcal{L}_{\text{phys}} =
        \max\!\big(0,\, C(x_j)-C(x_i)+\delta\big) +
        \max\!\big(0,\, S(x_j)-S(x_i)+\delta\big) +
        \max\!\big(0,\, D(x_i)-D(x_j)+\delta\big)
    $.\\[-1pt]
    Margin $\delta>0$ enforces monotonic ordering; total objective
    $\mathcal{L}_{\text{total}}=\mathcal{L}_{CE}+\lambda_{\text{phys}}\mathcal{L}_{\text{phys}}$.
  };
\end{scope}

\end{tikzpicture}
}% end resizebox
\caption{Physics-informed pairwise ranking}
\label{fig:physics_loss_tikz}
\end{figure}



Physics loss mechanics for pairwise ranking is depicted in Figure \ref{fig:physics_loss_tikz}. For two samples with severities $s_i < s_j$, contrast $C$ and sharpness $S$ are expected to decrease, while dark channel $D$ is expected to increase with severity. A hinge margin $\delta$ penalizes violations, forming the physics-informed component of the total objective.

The models are trained in PyTorch using the AdamW optimizer with weight decay $10^{-4}$ and an initial learning rate of $3 \times 10^{-4}$, following a cosine decay schedule. A batch size of 32 is used. Early stopping is triggered if validation macro-F1 does not improve for six consecutive epochs. To address dataset imbalance, class-weighted cross-entropy with label smoothing ($\epsilon=0.05$) is employed. Gradient clipping ($\ell_2$ norm capped at 1.0) prevents instability. Performance is evaluated using accuracy and macro-F1, the latter being particularly important under imbalanced data distributions. In addition, per-class precision, recall, and average precision (AP) are reported. Reliability of predicted probabilities is measured using Expected Calibration Error (ECE) \cite{Guo2017}. Model efficiency is evaluated in terms of parameter count, file size, CPU latency (milliseconds per image), and frames per second (FPS). Interpretability is assessed qualitatively with Grad-CAM \cite{Selvaraju2017} and quantitatively with physics-feature alignment trends.

\section{Experimental Setup}
\label{sec:setup}
All experiments were conducted in Google Colab with access to an NVIDIA Tesla T4 GPU (16 GB) when available and CPU-only mode otherwise. The model architecture and training routines were implemented in PyTorch 2.1, using the Torchvision model zoo for MobileNetV3-Small initialization \cite{Howard2019}. Training and evaluation pipelines were executed under Python 3.12, with supporting libraries including NumPy, Pandas, and scikit-learn. Grad-CAM visualizations were generated using the TorchCAM library. The SAPID dataset \cite{SAPID2024} was split into training (70\%), validation (15\%), and test (15\%) sets, ensuring class-stratified sampling to preserve distribution across splits. The validation set was used for hyperparameter tuning, early stopping, and calibration (temperature scaling). The final test set was reserved strictly for performance reporting. All images were resized to $224 \times 224$ pixels and normalized with ImageNet mean and standard deviation values. To increase robustness and mitigate overfitting, training augmentations included random horizontal flips and random rotations ($\pm$15$^{\circ}$), random brightness, contrast, and saturation jitter, random cropping and scaling. 
For inference, standard resizing was applied, and test-time augmentation (TTA) was used to generate multiple crops and scales per image, with averaged predictions. Models were trained using the AdamW optimizer with an initial learning rate of $3 \times 10^{-4}$ and cosine decay scheduling. A batch size of 32 and early stopping with patience of six epochs were employed. Gradient clipping with a maximum $\ell_2$ norm of 1.0 stabilized optimization. To address dataset imbalance, class-weighted cross-entropy loss was combined with label smoothing ($\epsilon=0.05$). For the physics-informed variant, a regularization weight of $\lambda_{phys}=0.2$ was used for the physics-based loss component. Performance was assessed using overall accuracy and macro-F1 score, the latter being critical for imbalanced datasets. Class-wise precision, recall, and average precision (AP) were also reported. Calibration quality was evaluated via Expected Calibration Error (ECE) following \cite{Guo2017}. Model interpretability was analyzed through Grad-CAM heatmaps \cite{Selvaraju2017} and physics-feature trend plots (contrast, sharpness, dark channel prior). Efficiency metrics included parameter count, model file size, CPU latency, and frames per second (FPS). The following configurations were compared: 1) MobileNetV3-Small with standard cross-entropy training. 2) Initial physics-informed model with basic regularization. 3) Improved physics-informed model with tuned $\lambda_{phys}$ and ranking constraints. 3) Incorporating TTA and temperature scaling for reliability. 4) Weighted averaging of baseline and physics-informed predictions.
This setup ensures a fair ablation study and highlights the contributions of physics-informed regularization and calibration.

\section{Results and Discussion}
\label{sec:results}

Figure~\ref{fig:dataset_dist} shows the SAPID dataset distribution, highlighting significant class imbalance. Minority categories (USG and Very Unhealthy) contain fewer than 50 samples each, motivating the use of class weighting and physics-informed regularization.

\begin{figure}
\centering
\bmvaHangBox{\fbox{\includegraphics[width=6cm]{images/1.jpg}}}
\caption{Class distribution of SAPID dataset across five AQI categories.}
\label{fig:dataset_dist}
\end{figure}

The baseline MobileNetV3-Small achieved 81.1\% test accuracy and 0.756 macro-F1 with TTA. Figure~\ref{fig:baseline_results} presents the confusion matrix and one-vs-rest precision-recall (PR) curves. While performance was strong for ``Good'' and ``Moderate'', the model misclassified minority categories (USG and Very Unhealthy).

\begin{figure}
\begin{tabular}{cc}
\bmvaHangBox{\fbox{\includegraphics[width=5.5cm]{images/1.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=5.5cm]{images/2.jpg}}} \\
(a) Confusion Matrix (Baseline) & (b) PR Curves (Baseline)
\end{tabular}
\caption{Baseline results: (a) Confusion Matrix; (b) PR curves}
\label{fig:baseline_results}
\end{figure}

The Physics v2 model improved recognition of minority categories by enforcing monotonic trends in haze-sensitive features. It achieved 85.1\% accuracy and 0.804 macro-F1 with TTA. With calibration, performance further improved to 86.5\% accuracy and 0.835 macro-F1. Figure~\ref{fig:physics_results} compares confusion matrices of baseline, physics-informed, and ensemble models.

\begin{figure}
\begin{tabular}{ccc}
\bmvaHangBox{\fbox{\includegraphics[width=3.7cm]{images/4a.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=3.7cm]{images/4b.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=3.7cm]{images/4c.jpg}}} \\
(a) Baseline & (b) Physics v2 & (c) Ensemble
\end{tabular}
\caption{Confusion matrices comparing Baseline, Physics v2, and Ensemble models.}
\label{fig:physics_results}
\end{figure}

To validate interpretability, physics features (contrast, sharpness, dark channel prior) were analyzed against predicted classes. As shown in Figure~\ref{fig:physics_features}, contrast and sharpness decrease with increasing pollution severity, while the dark channel prior increases. These trends are consistent with atmospheric scattering theory.

\begin{figure}
\centering
\bmvaHangBox{\fbox{\includegraphics[width=9cm]{images/5.jpg}}}
\caption{Boxplots of physics features across predicted classes.}
\label{fig:physics_features}
\end{figure}

Figure~\ref{fig:gradcam} presents Grad-CAM visualizations for sample test images. The model consistently attends to haze-heavy regions of the sky and building outlines, confirming that decisions align with haze-relevant image regions rather than spurious background features.

\begin{figure}
\begin{tabular}{ccc}
\bmvaHangBox{\fbox{\includegraphics[width=3.5cm]{6a.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=3.5cm]{6b.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=3.5cm]{6c.jpg}}} \\
(a) Input Image & (b) Grad-CAM Heatmap & (c) Overlay
\end{tabular}
\caption{Grad-CAM visualizations.}
\label{fig:gradcam}
\end{figure}

Temperature scaling improved probability calibration. Figure~\ref{fig:reliability} shows the reliability diagram of Physics v2 after calibration, with an Expected Calibration Error (ECE) of 0.071. This demonstrates alignment between predicted confidence and observed accuracy.

\begin{figure}
\centering
\bmvaHangBox{\fbox{\includegraphics[width=6cm]{images/7.jpg}}}
\caption{Reliability diagram for Physics v2 + temperature scaling.}
\label{fig:reliability}
\end{figure}

Table~\ref{tab:efficiency} compares efficiency metrics. Both baseline and physics-informed models remain lightweight, with $\sim$1.5M parameters, $\sim$6 MB file size, and CPU inference speeds exceeding 100 FPS. Physics-informed modifications incur negligible additional cost.

\begin{table}
\begin{center}
\begin{tabular}{|l|c|c|c|c|}
\hline
Model & Params (M) & File Size (MB) & CPU Latency (ms) & FPS \\
\hline\hline
Baseline (v3-small) & 1.52 & 6.23 & 9.16 & 109.2 \\
Physics v2 (v3-small) & 1.52 & 6.23 & 8.99 & 111.2 \\
\hline
\end{tabular}
\end{center}
\caption{Efficiency comparison between baseline and Physics v2 models.}
\label{tab:efficiency}
\end{table}

Table~\ref{tab:final_results} reports the final comparison of baseline, physics-informed, and calibrated models. The Physics v2 model with TTA and temperature scaling achieved the best performance with 86.5\% accuracy and 0.835 macro-F1.

\begin{table}
\begin{center}
\begin{tabular}{|l|c|c|}
\hline
Model & Test Accuracy & Macro-F1 \\
\hline\hline
Baseline (TTA) & 0.811 & 0.756 \\
Physics v2 (TTA) & 0.851 & 0.804 \\
Physics v2 + TTA + Temp Scaling & \textbf{0.865} & \textbf{0.835} \\
Ensemble (equal weights, TTA) & 0.824 & 0.788 \\
\hline
\end{tabular}
\end{center}
\caption{Final results summary on SAPID test set}
\label{tab:final_results}
\end{table}

\section{Conclusion and Future Work}
\label{sec:conclusion}

This study introduced a lightweight, physics-informed, and calibrated framework for smog-level classification from street-level imagery. Built on MobileNetV3-Small, the model integrates atmospheric scattering priors—contrast, sharpness, and dark channel statistics—into the loss function to improve recognition of minority classes in the imbalanced SAPID dataset. With test-time augmentation and temperature scaling, the Physics v2 model achieved 86.5\% accuracy and a macro-F1 of 0.835, surpassing the baseline while maintaining real-time CPU performance at over 100 FPS. Grad-CAM analyses and monotonic physics-feature trends enhanced interpretability, and calibration reduced Expected Calibration Error to 0.071, ensuring reliable confidence estimates.

The results highlight three contributions: (1) CPU-ready lightweight models for urban air quality monitoring, (2) physics-informed constraints that improve robustness under class imbalance, and (3) calibration as a requirement for trustworthy deployment.

\textbf{Future Research Directions: }While promising, several extensions remain like addressing dataset shifts across regions, seasons, and devices via source-free or test-time methods \cite{Wang2021TENT, Liang2020SHOT}. Combining street-level imagery with meteorological or satellite data to improve robustness. Applying semi- or weakly-supervised learning to mitigate scarcity in high-pollution categories. Benchmarking on smartphones, Raspberry Pi, and Jetson Nano for practical scalability.Exploring attribution methods and physics-driven interpretability beyond Grad-CAM. By uniting efficiency, interpretability, and calibration, this framework advances vision-based environmental intelligence and lays groundwork for scalable, low-cost air quality monitoring. Further, while evaluated on SAPID, future work will address cross-city and seasonal generalization, and integration with real-world monitoring networks.


\bibliography{egbib}
\end{document}
