\begin{table*}[!ht]
 \caption{Accuracy of three models on 70/15/15 split}
  \centering
  \begin{adjustbox}{width=1\textwidth}
      \small
\begin{tabular}{p{3cm}p{2cm}p{2.5cm}p{2.5cm}p{2.5cm}p{2.5cm}}
\toprule
\cmidrule(r){1-6}
Model \newline Architecture & Total \newline parameters (M) & Total keras(.h5)\newline model size (MB) & Training \newline accuracy (\%) & Top-1 Validation \newline Accuracy (\%) & Top-1 Accuracy \newline on test set (\%) \\
\midrule
EfficientNetB0     & 4.2                  & 15.8                               & 99.44                  & 96.32                          & 94.40                           \\
MobileNet V3 Large & 3.0                  & 11.7                               & 99.50                  & 94.94                          & 95.52                           \\
MobileNet V3 Small & 0.94                 & 3.87                               & 98.94                  & 93.33                          & 93.56                          \\
\bottomrule
\end{tabular}
  \end{adjustbox}
  \label{tab:9}
\end{table*}
] 
\section{Introduction}
Waste generation has increased dramatically in the 21st century due to the growth in the global population. According to the World Bank Group's report \cite{WorldBankGroup2018What2.0}, 2.01 billion tonnes of municipal solid waste are generated worldwide every year, with only about 19\% adequately recycled  \cite{WorldBankGroup2018What2.0}. Recycling not only helps to preserve raw material but, more importantly, reduces the landfills required, which is an undesirable way of waste disposal due to its high demand for space and the danger of introducing contaminants into the ground or even groundwater system. A major step of recycling is to separate the waste into specific categories according to its material. Failure to do so will significantly harm the effectiveness of recycling. Traditionally, workers at the recycling company sort the waste into corresponding categories by hand, which is an inefficient method and requires unnecessary labor. Therefore, people are now in dire need of a more advanced and automated waste separation system.\par
Image classification machine learning (ML) algorithms have been used to build automatic waste classification systems and assist waste management. This research aimed to improve the existing classification system and pursue the commercialization of an artificial intelligence (AI) street bin. Specifically, we focused on reducing the power consumption of the controller board to extend AI bin’s battery life, increasing its waste classification accuracy and reducing its price. \par
The only intelligent recycling bin on the market, Bin-e  \cite{Bin-e}, uses image classification algorithms to separate the trash into four categories: plastic, paper, metal and glass. It achieves a waste segmentation accuracy of 92\% \cite{Bin-e}. However, the price USD 5200 \cite{Bin-e} is expensive for a rubbish bin. Also, Bin-e’s operation requires a 230V power supply, so it cannot replace the traditional trash bins at the locations without plug sockets. Therefore, it can hardly increase the household and street recycling rate. As a result, this paper proposes low-cost battery-powered real-time recycling waste segmentation bin systems to fill this gap.\par
In this research, we trained a light MobileNet image classification model for Jetson Nano with TrashNet  \cite{GaryThungGarythung/trashnet:Classification}, an open-source waste dataset, and 1800 new training samples collected by us. The model demonstrated great performance with a high test accuracy of 95.98\% and a small parameter size of 3.0 M. Jetson Nano only consumed 4.7 W when it ran the model. We also found a cheaper and less energy-hungry device, K210 \cite{CanaanKendryteK210} to further reduce power consumption. The K210 board only consumed 0.89 W at inference time and the model on it achieved a high test accuracy of 96.64\%, which made it a more practical solution for trash bin applications. The code used in this study is available on Github \cite{XueyingLiMolvcanAN-SMART-RECYCLING-BIN-USING-WASTE-IMAGE-CLASSIFICATION-AT-THE-EDGE}.\par
This paper is organized as follows. In Section \ref{sec:2}, the related works performed in waste classification and AI trash bins are introduced. Section \ref{sec:3} introduces the system design and explains the background theories that support this study. The methodology of data collection and model training is introduced in section \ref{sec:4}. Section \ref{sec:5} analyses the test results and evaluates the system performance on Jetson Nano and K210. Finally, Section \ref{sec:6} concludes the achievements and provides suggestions for future research.

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

\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. 

We tested both the implementation of MobileNet V1 and V2 on K210. K210 only supported MobileNet V1 with alpha equal to 0.75 and MobileNet V2 with alpha equal to 0.5. OOM error occurs when a larger model is deployed. The ImageNet  accuracies of the V1 (alpha = 0.75) and V2 (alpha = 0 .5) were 68.4\% \cite{Tensorflow/models/research/slim/nets/mobilenet_v1.md} and 65.4\% \cite{Tensorflow/models/research/slim/nets/mobilenet/} correspondingly, so only MobileNet V1 architecture was trained.\par
The trained model is accelerated into kmodel format and loaded onto K210 together with the firmware using Kflash provided by Kendryte \cite{KendryteKendryteKflash.py}. We used the firmware that only supports basic Application Programming Interface (API) and integrated development environment (IDE) on K210 to reduce memory usage.

\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

Firstly, we applied a 70/15/15 training/validation/test split to the TrashNet dataset by randomly separating 15\% of TrashNet data to form the TrashNet test set. The rest of the TrashNet dataset became a new TrashNet training set. This ratio was used because the author in \cite{YuTowardsClassification} demonstrated that both 15\% and 10\% could produce the same level of classification accuracy on the TrashNet dataset, which is higher than 20\% and 25\% with statistical analysis. Other research \cite{Aral2019ClassificationModels}\cite{Bircanoglu2018RecycleNet:Networks} also utilized 70\% of the TrashNet data as training data. So, we consider that 70/15/15 would also be suitable for model training.\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": "4.2", "type": "Hyper-parameter/Architecture", "model": "EfficientNetB0", "parameter/architecture name": "Total parameters (M)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "15.8", "type": "Hyper-parameter/Architecture", "model": "EfficientNetB0", "parameter/architecture name": "Total keras(.h5) model size (MB)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "99.44", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Training accuracy", "experimental settings": {"xx": "yy"}, "model": "EfficientNetB0", "model settings": {"xx": "yy"}} {"value": "96.32", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Validation accuracy", "experimental settings": {"xx": "yy"}, "model": "EfficientNetB0", "model settings": {"xx": "yy"}} {"value": "94.40", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Accuracy on test set", "experimental settings": {"xx": "yy"}, "model": "EfficientNetB0", "model settings": {"xx": "yy"}} {"value": "3.0", "type": "Hyper-parameter/Architecture", "model": "MobileNet V3 Large", "parameter/architecture name": "Total parameters (M)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "11.7", "type": "Hyper-parameter/Architecture", "model": "MobileNet V3 Large", "parameter/architecture name": "Total keras(.h5) model size (MB)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "99.50", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Training accuracy", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Large", "model settings": {"xx": "yy"}} {"value": "94.94", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Validation accuracy", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Large", "model settings": {"xx": "yy"}} {"value": "95.52", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Accuracy on test set", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Large", "model settings": {"xx": "yy"}} {"value": "0.94", "type": "Hyper-parameter/Architecture", "model": "MobileNet V3 Small", "parameter/architecture name": "Total parameters (M)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "3.87", "type": "Hyper-parameter/Architecture", "model": "MobileNet V3 Small", "parameter/architecture name": "Total keras(.h5) model size (MB)", "dataset": ["TrashNet collected 1871 images", "The two datasets", "TrashNet", "new TrashNet"]} {"value": "98.94", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Training accuracy", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Small", "model settings": {"xx": "yy"}} {"value": "93.33", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Validation accuracy", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Small", "model settings": {"xx": "yy"}} {"value": "93.56", "type": "Result", "training data/set": ["TrashNet", "new TrashNet"], "test data/set": ["TrashNet", "new TrashNet"], "task": ["image classification", "waste image classification"], "metric": "Top-1 Accuracy on test set", "experimental settings": {"xx": "yy"}, "model": "MobileNet V3 Small", "model settings": {"xx": "yy"}}