# Robust Learning from Demonstration Based on GANs and Affine Transformation
## 1 Introduction  
Contemporary manufacturing endeavors are heavily focused on enhancing efficiency, with industrial robots garnering significant attention for their potential to revolutionize various industry sectors [1, 2]. These robots possess the capability to replace humans in numerous tasks [3], thereby alleviating workers from repetitive, hazardous, or physically taxing responsibilities [4, 5]. In collaborative environments, it is imperative for humans to have an intuitive means of programming robots to assist with tasks [6]. Learning from demonstration (LfD) or imitation learning (IL) has emerged as a pivotal technique, allowing robots to replicate tasks based on human demonstrations, thereby facilitating direct manual instruction for industrial robots [7, 8]. A fundamental objective of LfD is to enable learned movements to adapt seamlessly to diverse task environments. LfD is currently categorized into three mainstream algorithms. The first category is behavior cloning (BC), which trains policy networks and other machine learning algorithms to mimic expert behavior. However, BC faces challenges due to the discrepancy between the distribution of states generated by the trained policy and the distribution of states in the training data. This inconsistency can lead to suboptimal actions, especially in unfamiliar or novel scenarios, ultimately deviating from the correct trajectory. In sequential decision-making problems, this discrepancy causes errors to accumulate, resulting in trajectories deviating from the correct path. Therefore, while BC offers a simple learning process without the need for environment interaction, it suffers from limitations such as single-step decision-making, inability to decide on unfamiliar states, and error accumulation. Expert datasets are also limited, requiring continuous expansion to cover all possible states, which increases costs. Common BC algorithms used in collaborative robotics include dynamic movement primitives (DMP) [9; 10], Gaussian mixture regression (GMR) [11; 12], stable estimation of dynamical systems (SEDS) [13], and kernelized movement primitives (KMP) [14]. Inverse reinforcement learning (IRL) [15; 16] assumes that expert behavior is (approximately) optimal and aims to interpret it by reverse-engineering a reward function. This approach avoids the manual setting of a reward function by recovering it from expert trajectory data, allowing reinforcement learning to extract policies from this reward function. However, IRL demands substantial data to accurately deduce the reward function, making it computationally intensive. Additionally, its iterative nature in reinforcement learning processes can lead to slow training speeds and high time costs. Moreover, IRL may struggle to generalize to unseen states or environments, restricting its practical utility. Generative adversarial imitation learning (GAIL) [17; 18] aims to directly learn the policy from expert behavior without significant computational overheads associated with learning cost functions. By introducing generative adversarial networks (GANs) into IRL, GAIL leverages adversarial training to generate expert data distributions, improving the ability to imitate complex behaviors in large-scale, high-dimensional environments [19; 20]. However, GAIL may encounter issues like mode collapse [21] and distributional mismatches between generated and expert data, particularly in complex environments. As previously mentioned, approaches combining LfD and semantic information demand substantial computing resources that are often impractical for industrial environments. Traditional methods relying on clustering, model fitting, and regression necessitate meticulous tuning of hyperparameters [22], hindering the efficient generation of the target trajectory. Moreover, probability-based methods like the Gaussian mixture model (GMM) struggle with generalization when faced with new task requirements.