1. Introduction
Industry 4.0 allows for the digitalization of industrial machinery, operations, and assets, which offers new understandings and effectively addresses current challenges [
1]. IoT (Internet of Things) is a key technology driving the fourth industrial revolution, also known as Industry 4.0. Industry 4.0 is the incorporation of cutting-edge technologies, such as IoT, Artificial Intelligence, big data, and cloud computing, into the manufacturing and industrial sectors. By connecting and communicating physical objects to the internet using IoT, large amounts of data can be gathered and analyzed, resulting in enhanced automation, efficiency, and decision-making in industrial procedures. For example, IoT-enabled sensors can be used for monitoring the environmental temperature of server rooms [
2,
3], network monitoring systems [
4,
5], monitoring automotive manufacturing [
6,
7], and healthcare monitoring systems [
8,
9].
RFID, or Radio-Frequency Identification, is a technology that uses radio waves to communicate between a reader and a tag attached to an object. RFID is considered a part of the Internet of Things (IoT) because it allows for the identification and tracking of physical objects over the internet, enabling them to connect and communicate with other devices and systems. This enables real-time monitoring, automation, and remote control of the objects. RFID tags can be placed on products and used to monitor their movement in and out of a warehouse by installing RFID readers at the gates. However, the reader cannot determine the direction of the tags, whether they are entering or exiting the warehouse. Previous studies have shown that using the received signal strength (RSS), timestamps, and machine-learning algorithms can be used to determine false positive tags [
10,
11,
12,
13,
14]. However, these studies have not evaluated different types of tag movement that may occur in real-world scenarios. Therefore, it is important to use machine-learning models to identify the direction of tags by considering different types of tag movement to improve the efficiency of the RFID gate [
15,
16,
17,
18].
Random Forest is an ensemble machine learning method that combines multiple decision trees to improve classification and regression predictions by reducing overfitting and providing an estimate of feature importance. RF models have been effectively used for classification problems and have improved system performance [
19,
20,
21,
22,
23,
24]. However, machine learning algorithms often face difficulties such as outliers and imbalanced datasets, which can decrease accuracy. Studies have shown that by removing outliers using the Isolation Forest (iForest) method [
25,
26,
27,
28] and balancing imbalanced data with Synthetic Minority Over Sampling Technique (SMOTE) [
29,
30,
31,
32], the performance of the prediction system can be improved.
Despite this, there is no study on integrating the iForest-based outlier detection, SMOTE, and RF classifiers to improve the performance of RFID gates. Therefore, this study proposes a prediction model that combines iForest-based outlier detection, SMOTE, and RF to predict the movement and direction of RFID tags based on RSS and timestamps. Furthermore, implementing the proposed predicted model into a web-based monitoring system could detect the direction of the tagged product automatically. The contributions of the present study can be summarized as follows:
We proposed a combined method of iForest outlier detection, SMOTE data balancing and Random Forest to classify movements and directions of RFID tags, which has never been done before.
We evaluated the performance of the proposed prediction model on our dataset by considering more complex movements and directions of RFID tags that can happen in real warehouse environments.
We improved the performance of the proposed model by removing the outlier and balancing the training-set.
We conducted extensive comparative experiments on the proposed model with other prediction models and previous study results.
We provided the impact analysis of outlier detection and data balancing method with or without iForest and SMOTE toward model’s accuracy performance.
Finally, we demonstrated the practicability of our proposed model by designing and developing the web-based RFID monitoring system.
In addition, implementing the proposed predicted model into a web-based RFID monitoring system could be applied in warehouse to detect the direction of the tagged product automatically.
The rest of this study is organized as follows: In
Section 2, we present machine learning models, including iForest, SMOTE, and RF. In
Section 3, we explain the proposed prediction model for tag movement and direction. In
Section 4, we report the results of our experiments and the implementation of our model. Lastly, in
Section 5, we provide the conclusion, including any limitations of the study and potential areas for future research.
3. Methodology
The proposed model in
Figure 1 uses RSS and timestamps to predict tag movement and direction. Data pre-processing was done to remove inconsistent data and missing values were replaced with the mean. Outlier detection based on iForest has been applied to the RFID readings dataset so that the outliers can be eliminated. Statistical features were extracted from RSS and timestamps and the SMOTE technique was applied to generate new instances of the minority class. The RF algorithm was used for prediction and performance was evaluated by comparing the proposed model to other machine-learning models. The trained model was then integrated into a web-based application for easy use by end users. The evaluation of the model was done using stratified 10-fold cross-validation, a variation of k-fold cross-validation where each subset contains the same proportion of class labels as the original dataset.
3.1. Dataset
We proposed a prediction model based on RF to improve the prediction performance for tag movement and direction. We used a dataset from a previous study [
17,
35] which consists of five (5) types of tag movements, they are moving in, moving out, moving close, static, and turning back. There are 180 unique data generated for each move in, move out, move close and turn back, while for static tag 310 unique data were collected. In total, our study uses 1030 unique RFID movement data.
The dataset was collected using the RFID reader ALR-9900+ from Alien Technology and two linear antennas, ALR-9610-AL with 5.90 dbi Gain. The reader operates at a frequency of 902–928 MHz and supports EPC Class1 Gen2 (18000-6C). Passive RFID tags were attached to one side of each product box, using the model 9662 with a frequency range of 860–960 MHz, IC type Alien H3 and EPC Class1 Gen2 (ISO 18000-6C) protocol.
The dataset in [
17,
35] was gathered by considering various possible movements and directions of tags that can happen in real warehouse environments such as moving in and out through the gate, moving near the gate, turning back, and static tags (
Figure 2). The setup used for this scenario was a single reader with two antennas, one installed outside and the other inside the warehouse gate. This allows for the recording of tagged products moving in and out of the warehouse. However, the RFID reader may also pick up false positive readings like when the product is moved near the gate, during a turn-back movement, or from static tags. These static tags occur when tags are located within the nominal read range or when the range is extended accidentally by metal objects within the field. The prediction model in this study is utilized to record the products that move in or out through the gate and filter out false positive readings.
Figure 3 illustrates an example of tagged products moving in through the gate in a real warehouse.
3.2. iForest Outlier Detection
iForest works by constructing an ensemble of isolation trees (
iTrees) for each dataset, where outliers are defined as instances with short average lengths in the
iTrees [
33]. The
iTrees are recursively built by dividing the dataset until all instances are isolated or a specific tree height is reached.
Algorithm 1 provides pseudocode for iForest. Given D (input data), MaxSample (subsample size), and NumTree (number of trees to build), the algorithm generates many iTrees and returns a Forest. The iTree is generated by using sample data from D.
Algorithm 1 Isolation forest - |
Input | D, NumTree, MaxSample |
Output | Set of iTrees |
1: | Initialize Forest |
2: | set height limit h = |
3: | for i = 1 to NumTree do |
4: | D’ ⟵ sample(D, MaxSample) |
5: | Forest ⟵ Forest iTree (D’, 0, h) |
6: | end for |
7: | return Forest |
During iTrees generation, the next process is randomly select a feature q from each iTree and select a random value p within the range. The data is then split into two parts, they are left branch (data points ) and right branch (data points ). This process is iterated until there is only one data point in the branch or the iTree has reached the maximum depth. This process is repeated many times for each iTree and finally, a Forest is produced. The last step is finding data points from each iTree which has a shorter path length and is labeled as an outlier. We used the Scikit-learn Python library to implement iForest. We found 120 outliers’ data and eliminated them from the RFID readings dataset and retained the remaining data for further analysis.
3.3. Feature Extraction
RSS attributes, which are used to distinguish between moving and stationary tags, have been used in previous studies [
10,
11,
13,
17]. The strength of the RSS signal is determined by the distance between the antenna and the tag, with closer tags producing stronger signals. The timestamp information, which is used to determine the direction of the tags, is also an important parameter [
10,
13,
17].
Table 1 shows our statistical features extracted from a single antenna. Since this study utilizes two antennas, 36 attributes (including RSS and Timestamps) are extracted in total from both antennas. The statistical attributes were generated from the RFID readings dataset after outlier data were removed by iForest. We used all statistical features in [
17] and add other features such as
median, kurtosis, skewness, and
count for both RSS and timestamps.
Finally, the extracted features from the dataset were used as input X, while the label of tag movement was used as output y. Machine-learning algorithms are utilized to learn from this pair of X and y in the training set, thus generating predictions. In our study, we use RF to detect the direction of RFID tags.
3.4. SMOTE
The SMOTE (Synthetic Minority Over-sampling Technique) is a method used to increase the number of minority class instances in a dataset by generating new synthetic instances of the minority class [
29]. This is done by randomly selecting the nearest neighbors of each minority class sample and creating new synthetic samples between them (see
Figure 4). In this study, SMOTE was applied to our training set during Stratified 10-Fold CV in order to balance the training set, so that could improve prediction accuracy.
3.5. Random Forest
The RF (random forest) algorithm is a classification method that combines decision trees [
34]. Previous research has shown that using a randomization approach, such as bagging or the random space method, can improve the performance of RF. This randomization is achieved by using bootstrapped sampling of the original data and randomly selecting a subset of features at each node to determine the best split. The process of generating each tree in an RF model is described in Algorithm 2.
Algorithm 2 Random forest |
Input | : training dataset D, ensemble size T, subspace dimension d |
Output | : majority votes from tree models |
for t = 1 to T do |
| Build a bootstrap sample from D |
| Select d features randomly and reduce the dimensionality of accordingly |
| Train a tree model on |
| Split on the best feature in d |
| Let grow without pruning |
end |
In the random forest method, individual decision trees are generated by randomly selecting a subset of features at each node to determine the split. The algorithm works as follows: given a training dataset (D), the number of trees (T) in the model, a subspace dimension (d), and the available features (F), then a bootstrapped sample () of the original dataset (D) is taken. This sample includes some records from the original dataset multiple times and excludes others. Then, a subset (d) of features is randomly selected from the bootstrapped sample () to use as candidates for the split at each node. The decision tree classifier is trained on the bootstrapped sample () and the selected features (d) and grown to their maximum size without pruning. This process is repeated for all the trees in the forest. During the classification phase, each tree votes, and the most popular class is chosen as the prediction result.
Random forests (RFs) can address several issues that affect decision trees, such as avoiding overfitting and generating low variance. In this study, data from RFID tags that were identified by iForest as outliers were removed. The SMOTE method was then used to balance the training set. Finally, a random forest model was trained to learn from five classes (moving in and out through the gate, moving near the gate, turning back, and static tags) on the prepared training set and its prediction results were compared to the testing set to evaluate the model’s accuracy. In this study, the input features are the statistical information from RSS and timestamps of RFID tags and the output is the movement types. The random forest model has 100 trees (T), and 36 features (F), and uses the Gini index for splitting the reduced number of features (d).
Machine learning models were used to classify the different types and directions of movement for tagged products. The classification models were implemented in Python, XGBoost, and Scikit-learn and used default parameters provided by Scikit-learn [
36]. The models were evaluated using stratified 10-fold cross-validation and their performance was measured using true positive (TP), true negative (TN), false positive (FP), and false negative (FN) rates [
37]. TP and TN represent correctly classified instances, while FP and FN represent incorrectly classified instances (see
Table 2).
5. Conclusions and Future Works
The proposed RF model with iForest outlier detection and SMOTE was able to identify the movement and direction of tags using RFID technology. It was tested on various types of tag movement, including entering and exiting the gate, moving close to the gate, turning back, and remaining stationary. The results showed that the proposed model outperformed other models, such as MLP, LR, KNN, DT, NB, RF, XGBoost, and Adaboost, by up to 94.251%, 93.751%, 98.612%, 93.502%, and 93.332% in terms of accuracy, precision, specificity, recall, and f-score, respectively. The trained model can be used in an RFID gate to detect whether a product is entering or leaving and can also filter out false positive readings like static tags, tags turning back, and tags moving close to the gate. This information can be combined with product information and stored in a database.
In the future, the performance of readers, tags, and IoT sensors will be evaluated under various conditions. It is also possible that the comparison with other classification models and the use of machine learning to identify miss-reads will be presented in the near future.