\begin{table}[H]
  \centering
    \small
    \caption{Training parameters used to build the classification model on Jetson Nano}
  \begin{tabular}{ll}
    \toprule
    \cmidrule(r){1-2}
    Training Parameter     & Value \\
    \midrule
    Learning rate scheduler & Constant learning rate scheduler \\
    Train/Validation/Test split ratio & 72/18/10\\
    Optimizer & Adam optimiser \\
    Training epochs & 50\\
    Learning rate&	4.3e-05\\
    Fine-tuning training epochs	&10\\
Fine-tuning learning rate&	4e-06\\
Loss functions&	Sparse categorical cross entropy\\
Classifier activation function	&Softmax\\
Include top layers in base model&	False\\
    Batch size & 16 \\
    Base model dropout rate& 0.2 \\
    \bottomrule
  \end{tabular}
  \label{tab:6}
\end{table}
The waste classification models in the previous study \cite{Abdulmahmood2021ImprovingAnalysis} have five output classes: "paper", "metal", "plastic", "cardboard" and "glass". They will be reproduced in the next section as the benchmark models of our study. Our model will be trained with two new classes, "empty" and "hand". "Empty" means there is nothing in the photo, while the "hand" group detects a human's hand to avoid trapping the user's hand by the door. When these two groups are detected, the bin waits and continues detecting. 
\subsection{The Benchmark models }\label{bench}
The waste classification models in \cite{Abdulmahmood2021ImprovingAnalysis} consist of an input layer, a pre-processing augmentation layer, an EfficientNet B0 base model layer, a global average pooling 2D layer and a dense layer. The first model has an input layer size of 512x384 pixels, while the second model input has 384x288 pixels. Table \ref{tab:2} shows the configuration of the augmentation layer and the model training hyperparameters for reproduction. \par

To begin with, the base model is initialized with pre-trained weights on ImageNet. The two models are trained separately by setting the corresponding input sizes. The learning rate was set to 4.3e-05 at the first 50 epochs and was reduced to 4e-06 at the eight epochs afterwards. Eventually, both models achieved the same test accuracy of 95.38\%. Figure \ref{fig:2} shows the confusion matrix of the test results and indicates that most mistakes are made in classifying between paper and cardboard.\par

After the model was reproduced, it was saved into TensorFlow SavedModel format and transferred to Jetson Nano. The 384x288 model was optimized successfully through TensorRT on Jetson Nano, but the 512x384 model caused an OOM error. The throughput of the accelerated model was 19 inferences per second (IPS) at the maximum power mode.\par
Nevertheless, the 384x288 model occupied 94.9\% of memory. The system would freeze up if we ran other applications simultaneously. To implement the classification model in an AI bin application, it is essential to replace the original base model with the lighter model, such as MobileNet V3, which has lower memory usage and power consumption. 
\subsection{MobileNet V3 model}
The EfficientNet architecture used in the benchmark model has demonstrated outstanding performance on the ImageNet dataset. In particular, EfficientNet B7 has the same top-1 accuracy, 84.3\%, as the GPipe while being 8.4x \cite{Howard2017MobileNets:Applications}. However, as EfficientNet B0 is the smallest model in the family, with a parameter size of 4.0 M without top fully connected layers, so MobileNet V3 Large, which only has 3.0M parameters and top-1 accuracy of 1.1\% less than EfficientNet on ImageNet, is chosen as the substitute. 
MobileNet is a series of CNN architectures developed by Google. It contains three architectures: MobileNet V1 \cite{Howard2017MobileNets:Applications}, V2 \cite{Sandler2018MobileNetV2:Bottlenecks} and V3 \cite{Howard2019SearchingMobileNetV3}. MobileNet V2 achieved higher accuracy on ImageNet with a smaller parameter size than MobileNet V1. The MobileNet V3 optimized the latency of MobileNet V2. \par

\section{Methodology}\label{sec:4}
This section introduces the development of the classification model on Jetson Nano and K210. We collected 1872 new recycling waste data to train new models. Experiments were carried out to evaluate the models' accuracy and power consumption.\par
\subsection{Collect more training data}
Firstly, more recycling waste images were collected to increase the training dataset. As the TrashNet dataset only contains waste images with white background, making the classification model vulnerable to variation in lighting conditions and dirt or contamination in the background. Waste photos with a black background were taken to tell the model the background color is irrelevant in classification and increase the robustness of real-world cases. Additionally, we want to add two classes, "empty" and "hand" to the model, but we do not have images belonging to these categories to train the model. Therefore, we built a detection model with plywood material and collected a domain-specific waste dataset.\par
The waste samples were collected from a nearby recycling bin and from people directly. Figure \ref{fig:3} shows a waste photo taken by the camera at the top.\par

\subsection{Train the models with transfer learning}
The two datasets were used to train new classification models with TensorFlow version 2.9. Firstly, we replaced the EfficientNet B0 model layer in the benchmark model with MobileNet V3 architecture initialized with the pre-trained weights on ImageNet. The MobileNet model has a smaller parameter size and memory usage of the model. Then, the output size of the dense layer was changed to seven to add two new classes to the model. Finally, a resizing layer is inserted between the data augmentation layer and the base model layer to resize the input from 512x384 pixels to 224x224 pixels. By compressing the input after data augmentation, we obtained a clearer image for base model input than compressing the data before the data augmentation layer. \par
Figure \ref{fig:6} illustrates the structure of our model. The model was trained with the hyperparameters shown in Table \ref{tab:6}. The final model was converted to the TensorRT model with TensorFlow version 2.5, and its performance was measured on Jetson Nano. 

\section{Results and discussion}\label{sec:5}
The accuracies of models obtained from transfer learning will be analyzed in this section. Our best model, the 224x224 pixels MobileNet V3 Large model, achieved an accuracy of 95.98\% in classifying the images into seven groups. The model had 40 IPS on Jetson Nano at 5 W power mode and consumed 30\% less power than the EfficientNet B0 model. The K210 model achieved a further 96.64\% on waste classification while the board's power only drew 0.89 W. 
\subsection{Accuracies of models trained with TrashNet dataset on Jetson Nano }
As mentioned in section \ref{bench}, The EfficientNet B0 model has achieved high top-1 accuracy on original test data. However, we could not use this compute-intensive model directly in the application. So, we aimed to construct a less resource-intensive model while maintaining higher accuracy than the benchmark model.\par

We trained and tested EfficientNetB0, MobileNet V3 Large and MobileNet V3 Small with new TrashNet training set using the hyperparameters in Table \ref{tab:6}. All the models converged quickly and reached 90\% of the highest validation accuracy after 8 epochs. Table \ref{tab:9} compares the results we obtained.

We trained EfficientNetB0 and MobileNet V3 Large with the new training data. The same hyperparameters in Table \ref{tab:6} were used to train both models. 
The result is shown in Table \ref{tab:10}. The accuracy on 5-class test set of the EfficientNet B0 model increased from 94.40\% in Table \ref{tab:9} to 95.23\%. This indicates that the new dataset had a positive effect on the models and helped them to learn more general features that assist classification tasks. Our photos have different waste samples, lighting and background, so the accuracy on TrashNet will not increase significantly. \par
{"value": "50", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Training epochs", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "4.3e-05", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Learning rate", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "10", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Fine-tuning training epochs", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "4e-06", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Fine-tuning learning rate", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "16", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Batch size", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "0.2", "type": "Hyper-parameter/Architecture", "model": "MobileNet", "parameter/architecture name": "Base model dropout rate", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]}