Robust Collision Detection for Robots with Variable Stiffness Actuation
  by Using MAD-CNN: Modularized-Attention-Dilated Convolutional Neural Network
Ensuring safety is paramount in the field of collaborative robotics to
mitigate the risks of human injury and environmental damage. Apart from
collision avoidance, it is crucial for robots to rapidly detect and respond to
unexpected collisions. While several learning-based collision detection methods
have been introduced as alternatives to purely model-based detection
techniques, there is currently a lack of such methods designed for
collaborative robots equipped with variable stiffness actuators. Moreover,
there is potential for further enhancing the network's robustness and improving
the efficiency of data training. In this paper, we propose a new network, the
Modularized Attention-Dilated Convolutional Neural Network (MAD-CNN), for
collision detection in robots equipped with variable stiffness actuators. Our
model incorporates a dual inductive bias mechanism and an attention module to
enhance data efficiency and improve robustness. In particular, MAD-CNN is
trained using only a four-minute collision dataset focusing on the highest
level of joint stiffness. Despite limited training data, MAD-CNN robustly
detects all collisions with minimal detection delay across various stiffness
conditions. Moreover, it exhibits a higher level of collision sensitivity,
which is beneficial for effectively handling false positives, which is a common
issue in learning-based methods. Experimental results demonstrate that the
proposed MAD-CNN model outperforms existing state-of-the-art models in terms of
collision sensitivity and robustness.
Zhenwei Niu, Lyes Saad Saoud, Irfan Hussain
# Robust Collision Detection for Robots with Variable Stiffness Actuation by Using MAD-CNN:

###### Abstract

Ensuring safety is paramount in the field of collaborative robotics to mitigate the risks of human injury and environmental damage. Apart from collision avoidance, it is crucial for robots to rapidly detect and respond to unexpected collisions. While several learning-based collision detection methods have been introduced as alternatives to purely model-based detection techniques, there is currently a lack of such methods designed for collaborative robots equipped with variable stiffness actuators. Moreover, there is potential for further enhancing the network's robustness and improving the efficiency of data training. In this paper, we propose a new network, the Modularized Attention-Dilated Convolutional Neural Network (MAD-CNN), for collision detection in robots equipped with variable stiffness actuators. Our model incorporates a dual inductive bias mechanism and an attention module to enhance data efficiency and improve robustness. In particular, MAD-CNN is trained using only a four-minute collision dataset focusing on the highest level of joint stiffness. Despite limited training data, MAD-CNN robustly detects all collisions with minimal detection delay across various stiffness conditions. Moreover, it exhibits a higher level of collision sensitivity, which is beneficial for effectively handling false positives, which is a common issue in learning-based methods. Experimental results demonstrate that the proposed MAD-CNN model outperforms existing state-of-the-art models in terms of collision sensitivity and robustness.

Under consideration at Pattern Recognition Letters

\({}^{a*}\)Zhenwei Niu \({}^{b*}\)Lyes Saad Saoud, \({}^{c}\)Irfan Hussain

\({}^{*}\) The authors contributed equally to this work.

Khalifa University Center for Robotics and Autonomous Systems (KUCARS)

Department of Mechanical Engineering, Khalifa University, PO Box 127788, Abu Dhabi, United Arab Emirates.

\({}^{a}\)zhenwei.niu@ku.ac.ae, \({}^{b}\)lyes.saoud@ku.ac.ae, \({}^{c}\)irfan.hussain@ku.ac.ae

Human-robot interaction Robot collision detection Deep learning for robot

## 1 Introduction

To enhance industrial productivity and facilitate daily human activities, physical collaboration between humans and robots has grown considerably. Ensuring safety in collaborative tasks is crucial to realize widespread and effective human-robot collaboration [1]. Effectively addressing unexpected collisions during physical human-robot interaction (pHRI) tasks holds great significance.

In collaborative tasks, external sensors are utilized for collision avoidance [2, 3, 4]. However, relying solely on collision avoidance may not ensure safety during pHRI due to rapid and unpredictable relative motions between humans and robots. Thus, rapid and accurate collision detection and response are essential to maintain safety. Haddadin _et al._[5] introduced the collision event pipeline to minimize injury risks during physical contact. The pipeline's crucial first step is rapid and accurate collision detection. Currently, collision detection techniques fall into three main categories: artificial skin-based, model-based, and data-driven methods.
Artificial skins, equipped with deformable materials and tactile sensors, offer accurate collision detection and localization [6; 7; 8; 9]. However, their application to cover the entire robot can be complex and costly. In contrast, model-based approaches utilize identified dynamic models to estimate external torque on robots. The generalized momentum observer (MOB) method has gained significant attention [10; 11; 5; 12]. MOB relies solely on proprioceptive sensors, eliminating the need for acceleration computation. Yet, accurate identification of the dynamic robot model remains a challenge due to nonlinearity and uncertainties like friction, backlash, and elasticity [13; 14]. Moreover, adjusting user-defined thresholds requires considerable effort.

Learning-based collision detection techniques offer an alternative to overcome challenges in purely model-based methods. By training neural network models with collision and/or collision-free data, uncertainties and unmodeled effects within the dynamic model can be accounted for without requiring a user-defined threshold [13]. These techniques involve residual and uncertainty regression or end-to-end approaches, providing binary outcomes indicating collision occurrence [15; 16]. Some studies also utilize joint position and velocity data for uncertainty regression, leading to more precise estimates of external torque by subtracting these uncertainties from the residual [17; 18].

Learning-based collision detection methods are widely used in robots with rigid joints but their suitability for collaborative robots (cobots) with variable stiffness actuation is not fully validated. Cobots with variable stiffness enable close human collaboration, emphasizing the need for accurate and rapid collision detection. However, data collection across all conditions is challenging due to the dynamic changes in stiffness during tasks. The ideal network should be robust to stiffness variations and achieve excellent performance when trained using data from a single stiffness condition, providing reliable collision detection across various scenarios involving cobots.

Collecting sufficient collision data for training the network is challenging and hazardous for both human users and robots. Thus, a data-efficient solution is crucial for robot collision detection, given the highly imbalanced features in the collected dataset. The number of collision cases is substantially lower than that of collision-free cases, underscoring the importance of optimizing data efficiency. Efficient classification methods, like the modularized neural network (MNN) introduced in [14], accurately distinguish between collision and collision-free cases even with limited collision information. However, it's worth noting that training MNN still requires a minimum of 1 hour of collision data and 2 hours of free-motion data.

In this paper, we introduce MAD-CNN, a novel network for collision detection in robots with variable stiffness actuators. MAD-CNN incorporates joint modularization and dilated convolutional neural network (CNN), along with an attention module, as shown in Figure 1. Joint modularization separates individual joints by using joint-specific variables, reducing the parameter search space and enabling efficient training with limited data. Dilated convolution allows the network to capture long-range dependencies in the input signal, enhancing collision detection sensitivity. The attention module

Figure 1: The proposed MAD-CNN architecture for robot collision detection encompasses a comprehensive structure aimed at improving collision sensitivity, robustness, and data efficiency, particularly for robots equipped with variable stiffness actuation. MAD-CNN integrates a dual inductive bias mechanism that incorporates joint modularization and a dilated convolutional neural network, along with an attention module. It is well suited for robots equipped with variable stiffness actuation, as well as for scenarios involving hard-to-collect and imbalanced collision data.
prioritizes relevant components within the joint collision features, further improving the network's sensitivity and robustness to collisions.

### Main Contributions and Organization of the Paper

The main contributions of this papers are illustrated as following:

* Our proposed MAD-CNN integrates dual inductive bias and an attention module to enhance collision sensitivity and robustness in robots with variable stiffness actuators. Remarkably, the model achieves 100% detection accuracy with minimal delay across all stiffness conditions, trained only on data from a single stiffness setting.
* MAD-CNN demonstrates remarkable data efficiency, requiring only 4 minutes of collision data from the highest stiffness setting for training. Despite the limited data, the pre-trained model successfully detects all 516 collisions occurring at random links during the robot's execution of different stiffness level motions within 30 minutes.
* Experimental results validate MAD-CNN's superior performance compared to state-of-the-art methods for collision detection, even with limited training information. The network exhibits enhanced collision sensitivity and robustness, effectively handling false positives that often challenge learning-based approaches. The conducted ablation study provides empirical evidence supporting the efficacy of MAD-CNN's network structure.

The rest of this paper is organized as follows: Section 2 provides an introduction to the platform used in this study. The proposed MAD-CNN model is elaborated in detail in Section 3. Data collection and input processing are described in Section 4. In Section 5, we present the comprehensive evaluation of MAD-CNN, including the ablation study and a comparison with state-of-the-art models. Additionally, the experimental results showcasing the integration of MAD-CNN with the continuous filter (CF) validate the collision detection sensitivity and robustness of our proposed model. Finally, Section 6 concludes this study.

## 2 Platform Introduction

This study utilizes a robot platform equipped with discrete variable stiffness actuators (DVSAs), as depicted in Fig. 2. The working principle of the DVSA is illustrated in Fig. 3, with each joint offering four different levels of physical stiffness. The stiffness of each joint can be swiftly adjusted to predefined levels by engaging or disengaging the springs. Table 1 provides a comprehensive overview of the specific stiffness level values.

In our previous work [19], we introduced a novel collision handling pipeline incorporating DVSA to enhance safety during human-robot interaction. One reaction strategy involves rapidly switching the joint's physical stiffness to the lowest level (stiffness level 1 in Table 1) to mitigate the impact of unexpected collisions. Experimental validation was conducted to evaluate the effectiveness of this strategy.

Figure 2: Experiments platform: a robotic manipulator with discrete variable stiffness actuators (DVSAs). It has four levels of intrinsic physical stiffness, and the stiffness can be rapidly adjusted online by controlling the engagement of the springs.
This study specifically focuses on collision detection for collaborative robots equipped with variable stiffness actuation, and our proposed model is based on this platform to examine the effectiveness of collision detection in this context.

## 3 The Proposed MAD-CNN Model

The proposed network structure, MAD-CNN, depicted in Fig. 1, is specifically designed to enhance data training efficiency and collision detection robustness for collaborative robots equipped with variable stiffness actuation. Efficient utilization of collision data is crucial due to the costly and laborious nature of its collection process. Additionally, the highly imbalanced features in the dataset, where collision cases are significantly fewer than collision-free cases, highlight the importance of optimizing data efficiency. Therefore, employing efficient classification methods to accurately distinguish between collision and collision-free cases, even with limited collision information [14], is essential.

Collecting collision data for all stiffness conditions is particularly challenging and costly when dealing with robots equipped with variable stiffness actuators. Thus, there is a need to develop a network architecture that remains robust to changes in the physical stiffness of the joint. MAD-CNN addresses these challenges and aims to enhance collision detection performance while effectively utilizing limited data.

### Network Structure

MAD-CNN uses dual inductive bias in the network structure. The first dual inductive bias, which is the modularized joint network structure, enables the extraction of collision information for each joint through the utilization of local joint variables. This bias in the network structure achieves the decoupling of individual joints by independently inputting joint-specific variables into their corresponding modular networks, which can decrease the search space for network parameters [14].

An additional inductive bias used in this study is the utilization of dilated convolutional neural networks. Dilated convolution, as described in [20], is a variant of the convolutional layer that offers an expanded receptive field while maintaining the same number of parameters. The concept is illustrated in Fig. 4, where the gaps within the convolutional kernel introduce an increased spacing between sampled input pixels. As a result, the network becomes capable of capturing long-range dependencies within the input signal without sacrificing resolution or computational efficiency. This emphasis on discriminating between these two classes enhances the network's sensitivity to detecting collisions,

\begin{table}
\begin{tabular}{|l|l|l|l|} \hline Spring with high stiffness (\(K_{h}\)) & Spring with medium stiffness (\(K_{m}\)) & Stiffness & Equivalent stiffness (\(K_{eq}\)) \\  & & & [N.m/rad] \\ \hline \hline
0 & 0 & 1 & 6 \\ \hline
0 & 1 & 2 & 50 \\ \hline
1 & 0 & 3 & 160 \\ \hline
1 & 1 & 4 & 246 \\ \hline \end{tabular}
\end{table}
Table 1: Joint Stiffness Levels of the Experiment Setup

Figure 3: The working principle of the DVSA involves adjusting the stiffness by manipulating the number of active springs through the engagement or disengagement of the clutches.
thereby further improving its collision detection capabilities. The effects of both inductive bias are further validated in Section 5.1.

Following the application of modularized dilated joint networks, the resulting extracted features are combined through concatenation and subsequently inputted into a multi-head self-attention module. The self-attention module represents a critical architectural component within the Transformer framework, as highlighted in [21]. In the context of collision detection, the utilization of the self-attention module allows for the prioritization of the most pertinent components within the concatenated joint collision features. This prioritization aids in the classification process by assigning higher weights to the relevant parts of the collision features. For a given input \(I\in\mathbb{R}^{d\times n}\), where \(d\) represents the input dimension and \(n\) denotes the input length, the self-attention mechanism begins by performing a linear projection to derive the components of query (\(Q\)), key (\(K\)) and value (\(V\)), as outlined below:

\[Q=W_{q}I,\quad K=W_{k}I,\quad\text{and}\quad V=W_{V}I, \tag{1}\]

where \(W_{q}\) and \(W_{k}\in\mathbb{R}^{s1\times d}\), \(W_{V}\in\mathbb{R}^{s\times d}\) are learnable weight matrices. Then the scaled Dot-product is processed to get the attention score:

\[Z=\text{softmax}(\frac{QK^{T}}{\sqrt{d_{k}}})V, \tag{2}\]

where \(d_{k}\) corresponds to both the query and key dimensions and it serves the purpose of mitigating the issue of vanishing gradients that may arise when applying the softmax function. After that, by concatenating multi-head information and doing the linear projection, several levels of correlation information can be extracted and used for the final classification.

### Network Structure Details

The modularized joint network consists of two 1D dilated convolutional layers. The first layer has 16 filters, and the second layer has 32 filters. Both layers use a \(3\times 3\) filter size and a stride of 1. The dilation factor is set to 4 for the first layer and 8 for the second layer. Max pooling layers follow each convolutional layer. The outputs from the max-pooling layers are flattened and connected to a fully connected layer with 32 hidden neurons, using the Gaussian error linear unit (GELU) activation function for improved accuracy. The resulting outputs from this layer, representing each joint, are concatenated to form a combined representation with 64 hidden neurons. This concatenated representation then goes through a self-attention module with 1 head. The output of the self-attention module is connected to another fully connected layer with 64 hidden neurons, employing the GELU activation function. The output layer uses the softmax function for classification, providing prediction scores between 0 and 1 for the "no collision" and "collision" classes. The proposed network structure can be computed in only 0.046 \(\mu s\), enabling real-time collision detection on hardware such as Intel i9-19700H with Nvidia GeForce RTX 3070 Ti.

Figure 4: An example of the 1D dilated convolution layers with dilation 1, 2, and 4, respectively.
## 4 Data Collection and Network Training

### Data Collection

The data collection process utilized the robot platform described in Section 2 for conducting experiments. During this process, the robot executed random point-to-point acceleration-deceleration movements within its joint space without implementing any collision reaction strategy. A human operator intentionally collided with the robot at various random positions and instances using a collision tool (Fig. 5), specifically a limit switch, to record the ground truth data. A value of 1 represents a collision, and 0 indicates no collision. The joint space dataset (joint torque \(\tau\), joint velocity \(\dot{\theta}\)) was recorded at a sampling rate of 1000 Hz. The data collection considered two scenarios: collision and collision-free, each having three cases representing different levels of physical stiffness (stiffness levels 2, 3, and 4). The lowest stiffness level (stiffness level 1) is exclusively assigned to the safety configuration, following our previous work [19], and was not involved in the data collection process.

Table 2 presents the durations of the training and testing data scenarios. For training, only collision data from the highest stiffness level (level 4) lasting four minutes was used. The remaining data collected from different stiffness levels were used to evaluate the network's robustness to stiffness changes. The testing phase involved a total of 30 minutes of collision motions (516 collisions) and 45 minutes of collision-free motions.

### Input Processing

All the collected data is normalized to fit within the range of [0, 1]. The time-series data is segmented using a shifting time window that includes the current data point and the ten past points, with a sampling interval of \(t_{I}=0.01\). This results in a time window duration of \(t_{w}=(11-1)\times 0.01=0.1s\). The utilization of segmented time-series data with a time window helps mitigate the influence of sensor noise, as suggested by Kim _et al._[14]. The choice of time step eleven is determined through an evaluation process where the time step is progressively increased until a relatively superior performance is achieved.

The input to MAD-CNN is shaped as \(X=[X^{1},X^{2}]\), where \(X^{i}\) represents the input data corresponding to the \(i\)th joint. These \(X^{i}\) data are constructed by combining the segmented data, as depicted in Figure 6, where \(x^{i}(t)\) includes the normalized observed signals, consisting of the joint torque \(\tau\) and joint velocity \(v\):

\[X^{i}=[x^{i}(t-100),x^{i}(t-90),...,x^{i}(t-10),x^{i}(t)], \tag{3}\]

\[x^{i}(t)=[\tau,v]. \tag{4}\]

\begin{table}
\begin{tabular}{|l|l|l|l|} \hline Data Type & States & Joints Stiffness & Time \\ \hline Training & Collision & Highest level & 4min \\ \hline \multirow{4}{*}{Testing} & \multirow{4}{*}{Collision} & Highest level & 10min \\ \cline{3-4}  & & 3rd level & 10min \\ \cline{3-4}  & & 2nd level & 10min \\ \cline{2-4}  & \multirow{4}{*}{No Collision} & Highest level & 15min \\ \cline{3-4}  & & 3rd level & 15min \\ \cline{3-4}  & & 2nd level & 15min \\ \hline \end{tabular}
\end{table}
Table 2: Training and testing dataset and the corresponding duration

Figure 5: The limit switch used to collide with the manipulator and record the ground truth collision labels. It outputs binary results: 1 - collision, 0 - no collision.
### Network Training Details

Training data in Table 2 are randomly shuffled prior to training. The network structure is implemented in Python with PyTorch 1.13.1. The mini-batch size is 1000, and the number of epochs is set to 30. The optimizer is Adam with default parameters (\(\beta_{1}\) = 0.9, \(\beta_{2}\) = 0.999, \(\epsilon\) = 1e-07) and the learning rate of \(lr\) = 1e-3. We use binary cross-entropy loss (BCELoss) as the loss function.

\[\text{BCELoss}=-(y*log(\hat{y})+(1-y)*log(1-\hat{y})), \tag{5}\]

where \(y\) represents the ground truth collision label, while \(\hat{y}\) denotes the network's prediction.

## 5 Results

To evaluate the proposed approach and conduct a fair comparison with state-of-the-art methods, we use three criteria: detection failure number (DFn), detection delay (DD) in milliseconds (ms), and false positive number (FPn), consistent with the evaluation framework in [14]. The collision tool generates a "1" signal when a collision occurs, and the network predicts collisions with an output threshold of 0.5. DFn represents the count of collisions not accurately classified by the network, while FPn indicates instances where the network wrongly classifies non-collision events as collisions. Minimizing FPn is crucial for operational efficiency, as false positives may trigger unnecessary stop actions. Successive FPs within the time step are considered as one FP.

To address FP, a continuous filter (CF) is commonly used, as highlighted in [14; 13]. While CF can reduce FP, it may increase DFn and DD, creating a trade-off between collision detection sensitivity and false positive occurrence. Section 5.2 investigates the impact of integrating CF into MAD-CNN to assess its efficacy in enhancing collision detection robustness. An ablation study in Section 5.1 evaluates the contributions of various components within MAD-CNN, verifying the superiority of the proposed network architecture. Additionally, in Section 5.3, we perform a comparative analysis of collision detection performance between MAD-CNN and state-of-the-art models.

Figure 6: The time-series signals \(\mathbf{x}(t)\) are segmented by dividing them into consecutive non-overlapping windows of size 101, with a sampling interval of 10. These segmented windows of \(\mathbf{x}(t)\) are then sampled and arranged as the input data fed into the network.

Figure 7: Explanation of Detection Delay (DD), Detection Failure (DF) and False Positive (FP). The dots represents the samples
### Ablation Study

The ablation study investigates the effects of modularization, dilated convolution, and the attention module on collision detection performance. Five cases are examined:

* MAD-CNN: Incorporates all components, including modularization, dilated convolution, and the attention module.
* M-CNN: Utilizes joints modularization without dilation and the attention module.
* MD-CNN: Excludes the attention module while retaining modularization and dilated convolution.
* MA-CNN: Excludes dilated convolution but retains both modularization and the attention module.
* AD-CNN: Eliminates joints modularization and uses all joint signals together as input to the network.

Table 3 presents the corresponding results, highlighting the individual contributions of these components to the overall effectiveness of the model.

* MAD-CNN outperforms other models with its combination of modularization, dilated convolution, and attention module, resulting in superior collision sensitivity. It achieves zero detection failure and minimal detection delay. Although DD increases with decreasing stiffness, MAD-CNN shows a smaller increase

\begin{table}
\begin{tabular}{|l|l|l|l|l|l|l|} \hline \multicolumn{2}{|l|}{Ablation Study} & \multicolumn{1}{l|}{**MAD-CNN**} & \multicolumn{1}{l|}{**M-CNN**} & \multicolumn{1}{l|}{**MD-CNN**} & \multicolumn{1}{l|}{**MA-CNN**} & \multicolumn{1}{l|}{**AD-CNN**} \\ \hline \multicolumn{2}{|l|}{Modularization} & \multicolumn{1}{l|}{\(\checkmark\)} & \(\checkmark\) & \(\checkmark\) & \(\checkmark\) & \\ \hline \multicolumn{2}{|l|}{Dilation} & \multicolumn{1}{l|}{\(\checkmark\)} & \(\checkmark\) & \(\checkmark\) & \(\checkmark\) & \\ \hline \hline \multirow{4}{*}{Joints Stiffness} & \multirow{2}{*}{Highest level} & DFN & **0/172** & 0/172 & 0/172 & 4/172 & 0/172 \\ \cline{3-7}  & & DD(ms) & **11.3095** & 15.3491 & 15.1065 & 18.1818 & 13.6488 \\ \cline{3-7}  & \multirow{2}{*}{3rd level} & FPn & 183 & **42** & 74 & 543 & 158 \\ \cline{3-7}  & & DFN & **0/172** & 2/172 & 1/172 & 10/172 & 0/172 \\ \cline{3-7}  & \multirow{2}{*}{3rd level} & DD(ms) & **12.4093** & 17.6 & 16.3508 & 19.7592 & 14.4011 \\ \cline{3-7}  & & FPn & 261 & **102** & 116 & 135 & 167 \\ \cline{3-7}  & \multirow{2}{*}{2nd level} & DFN & **0/172** & 24/172 & 1/172 & 30/172 & 6/172 \\ \cline{3-7}  & & DD(ms) & **12.4319** & 18.6283 & 16.7894 & 21.4647 & 16.0304 \\ \cline{3-7}  & & FPn & 137 & **78** & 94 & 120 & 123 \\ \hline \multirow{4}{*}{Total} & DFN & **0/516** & 26/516 & 2/516 & 44/516 & 6/516 \\ \cline{3-7}  & & DD(ms) & **12.0502** & 17.1924 & 16.0822 & 19.8019 & 14.6934 \\ \cline{1-1} \cline{3-7}  & & FPn & 581 & **222** & 284 & 798 & 448 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Results for ablation study of MAD-CNN

Figure 8: The study of continuous filter (CF) integrated with MAD-CNN. We explore various CF durations ranging from 0ms to 27ms to assess the robustness of MAD-CNN for collision detection.
compared to other models. However, it does have a higher false positive rate, which can be effectively handled with continuous filters (CF), as discussed in Section 5.2..
* Modularization reduces the parameter search space, making training more data-efficient. It also helps in minimizing detection failures and detection delay, as shown in the performance comparison with MAD-CNN and AD-CNN. However, using modularization alone (M-CNN) does not achieve satisfactory collision sensitivity performance.
* Dilation significantly improves collision detection in MAD-CNN compared to MA-CNN, enhancing sensitivity to collisions. This is due to the capability of dilated convolution to extract discriminative features, aiding in robust collision detection. However, dilated convolution may increase false positives at lower stiffness levels, possibly due to reflecting system noise more prominently. Similar observations are seen in comparisons between M-CNN and MD-CNN.
* The attention module improves collision detection by reducing DFn and DD, enhancing the network's sensitivity to collisions by prioritizing relevant features. However, it also increases false positives, likely due to sensitivity to system noise. Combining modularization and attention without dilation results in unfavorable performance compared to other network structures examined.

### False Positive Handling with Continuous Filter

In the previous section, MAD-CNN outperforms other network structures in terms of detection failure number and detection delay but results in a higher false positive number. To address this issue, the current section focuses on investigating the impact of employing a continuous filter (CF) in effectively handling false positives. The CF can be understood as a temporal filtering mechanism in which the collision label is assigned only when the network prediction extends beyond a specific duration. The utilization of a CF has demonstrated its efficacy in reducing FPs while typically resulting in increased DFn and DD. For instance, in the study conducted by Kim _et al_. [14], the implementation of a 3-millisecond CF in their MNN model led to a significant 20.5% increase in DD. Our proposed model, MAD-CNN, exhibits superior performance in terms of DFn and DD compared to other models but does have a higher FP rate. In this study, we explore various CF durations ranging from 0ms to 27ms to assess the robustness of MAD-CNN for collision detection and determine an optimal CF duration for our model. Figure 8 illustrates the combined results across all stiffness levels.

As the duration of the continuous filter (CF) increases, the number of false positives (FP) decreases significantly. Notably, when using a large CF duration of 27ms, there are only 2 false positives observed. However, it is important to highlight that these two false positives occur when the manipulator is switched on, which can be easily avoided through pre-programming. One interesting finding is that the increase in CF duration does not lead to a dramatic rise in detection delay (DD) and detection failure number (DFn). The maximum increase in DD is only 3.9%, observed when using a 1ms CF duration. Additionally, even with a considerably longer CF duration of 27ms, the level of DD remains relatively stable at approximately 12.7ms.

On the other hand, in terms of DFn, MAD-CNN achieves perfect detection accuracy when using CF durations ranging from 0ms to 15ms. With a continuous increase in CF duration, there is an associated increase in DFn. Nevertheless, the model still maintains a decent level of detection accuracy, with only 6 detection failures out of 512 collisions (resulting in 98.8% detection accuracy), even when employing a significantly longer CF duration of 27ms. The findings indicate that MAD-CNN exhibits excellent collision sensitivity and demonstrates robustness when utilized in conjunction with continuous filters. In the subsequent section, we adopt a 15ms CF duration, which enables us to achieve a favorable performance across all three evaluation criteria.

### Performance Comparison to Existing Methods

In this section, we compare MAD-CNN with two existing learning-based approaches: MNN and the 1D CNN method. MNN has shown excellent performance in collision detection for the Doosan robot M0609, and it can potentially be fine-tuned for other robots of the same type. The 1D CNN method proposed by Park _et al_. represents an end-to-end learning-based technique for collision detection. We evaluate the three models using a continuous filter (CF) value of 15 ms to assess their sensitivity to collisions and examine the robustness of CF in the evaluation process. By conducting this comparative analysis, we aim to demonstrate the superiority of MAD-CNN in collision detection for collaborative robots with variable stiffness actuators. The evaluation focuses on key metrics such as detection failure number (DFn), detection delay (DD), and false positive number (FPn) to assess each model's sensitivity and robustness. The results will provide insights into MAD-CNN's effectiveness, showcasing its advantages over existing methods and highlighting its potential for real-world applications in collaborative robot environments.
Table 4 presents the results of the comparative analysis among MAD-CNN, MNN, and the 1D CNN method. MAD-CNN outperforms the other methods by successfully detecting all collisions with a minimal detection delay of 12.0503 ms. The 1D CNN method also shows reasonably good collision sensitivity, missing only 26 out of 516 collisions and exhibiting a detection delay of 23.5966 ms. However, MNN demonstrates the poorest performance across all evaluation criteria, likely due to insufficient training data. While MNN requires at least 1 hour of collision data and 2 hours of non-collision data for training, MAD-CNN was trained with only 4 minutes of collision data. The utilization of CF leads to a reduction in false positives (FPs) for all three methods. However, it also results in an increase in detection failure number (DFn) for MNN and a notable increase in both DFn and DD for the 1D CNN method. In contrast, MAD-CNN shows greater robustness when incorporating CF. Even with a large CF duration, MAD-CNN successfully detects all collisions and experiences only a 6.4% increase in DD. Additionally, MAD-CNN exhibits a substantial decrease in Fpn with the use of CF.

One remarkable finding is that despite being trained with a limited 4-minute collision dataset focused solely on the highest stiffness condition, MAD-CNN demonstrates robustness to stiffness changes. It achieves 100% detection accuracy and only a slight increase in detection delay when tested under the 3rd and 2nd stiffness conditions. Overall, these results demonstrate the superior performance and robustness of MAD-CNN compared to existing methods for collision detection in robots equipped with variable stiffness actuators. MAD-CNN's ability to achieve accurate collision detection with limited training data and its adaptability to different stiffness conditions make it a promising approach for real-world applications in collaborative robot environments.

Despite the excellent collision detection performance of MAD-CNN in robots with variable stiffness actuators, there are opportunities for future research in the following areas. Firstly, evaluating the efficacy of MAD-CNN in commercial robots equipped with multiple rigid joints would enhance its generalizability and applicability across a broader range of robotic systems. Additionally, exploring unsupervised learning methods such as autoencoders (AE) [22; 23] or generative adversarial networks (GAN) [24] could alleviate the reliance on labeled collision data during training. These directions hold promise for advancing collision detection methods for various robotic platforms.

\begin{table}
\begin{tabular}{|l|l||l||l|l|} \hline \hline \multirow{2}{*}{**Joints Stiffness**} & \multirow{2}{*}{**Methods**} & \multicolumn{2}{c|}{Collision (10mins)} & \multicolumn{2}{c|}{Collision free (15 mins)} \\ \cline{3-5}  & & DEn & DD(ms) & Fpn \\ \hline \multirow{5}{*}{Highest level} & MAD-CNN & 0/172 & 11.30\% & 183 \\ \cline{2-5}  & MAD-CNN w/ CF & 0/172 & 12.4404 & 14 \\ \cline{2-5}  & MNN & 18/172 & 54.5498 & 6 \\ \cline{2-5}  & MNN w/ CF & 144/172 & 42.2592 & 0 \\ \cline{2-5}  & 1D CNN & 4/172 & 22.3113 & 58 \\ \cline{2-5}  & ID CNN w/ CF & 11/172 & 22.98125 & 3 \\ \hline \multirow{5}{*}{3rd level} & MAD-CNN & 0/172 & 12.4093 & 261 \\ \cline{2-5}  & MNN & 0/172 & 13.1111 & 17 \\ \cline{2-5}  & MNN & 90/172 & 35.4512 & 737 \\ \cline{2-5}  & MNN w/ CF & 149/172 & 21.3478 & 29 \\ \cline{2-5}  & ID CNN & 6/172 & 24.6325 & 92 \\ \cline{2-5}  & ID CNN w/ CF & 12/172 & 24.8062 & 0 \\ \hline \multirow{5}{*}{2nd level} & MAD-CNN & 0/172 & 12.4319 & 137 \\ \cline{2-5}  & MAD-CNN w/ CF & 0/172 & 12.9053 & 1 \\ \cline{2-5}  & MNN & 16/17/172 & 68.7500 & 53 \\ \cline{2-5}  & MNN w/ CF & 17/172 & 2an & 0 \\ \cline{2-5}  & ID CNN & 16 & 23.8461 & 72 \\ \cline{2-5}  & ID CNN w/ CF & 28 & 24.2708 & 0 \\ \hline \multirow{5}{*}{Total} & MAD-CNN & 0/516 & 12.0503 & 581 \\ \cline{2-5}  & MAD-CNN w/ CF & 0/516 & 12.8189 & 32 \\ \cline{1-1} \cline{2-5}  & MNN & 275/516 & 52.917 & 796 \\ \cline{1-1} \cline{2-5}  & MNN w/ CF & 465/516 & 31.8035 & 29 \\ \cline{1-1} \cline{2-5}  & 1D CNN & 26/516 & 23.5966 & 222 \\ \cline{1-1} \cline{2-5}  & 1D CNN w/ CF & 51/516 & 24.0194 & 3 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Performance of Existing Methods and MAD-CNN
## 6 Conclusions

This paper introduces MAD-CNN, a new network structure designed for collision detection in robots with variable stiffness actuators. The proposed network incorporates a dual inductive bias mechanism and an attention module to enhance the sensitivity and robustness of collision detection. Remarkably, the network achieves high performance with minimal training data requirements. Only 4 minutes of collision data from the highest stiffness condition are needed for training. Experimental results demonstrate the network's robustness to stiffness changes, as it successfully detects collisions with minimal delay across various stiffness conditions, even when trained solely on data from a single stiffness condition. The superior performance of MAD-CNN makes it well suited for robots equipped with variable stiffness actuation, as well as for scenarios involving hard-to-collect and imbalanced collision data. Moreover, comparative analysis reveals the clear superiority of MAD-CNN over state-of-the-art learning-based models in terms of collision detection sensitivity, robustness, and data efficiency.

## Acknowledgments

This work was supported by Khalifa University of Science and Technology under Award No. RC1-2018-KUCARS and FSU-2021-019.
