scieee AI-readable full text Open interactive document viewer

Real-time patient pose estimation on a smart walker

Palermo, Manuel de Castro

Abstract

Rehabilitation is important to improve quality of life for mobility impaired patients. Smart walkers are commonly used to provide residual motor skills recovery, based on repetitive and intensity-adapted training. These should embed automatic, objective and real-time tools for user-centered control and monitoring. Yet, present solutions have focused only on extracting few very specific metrics using dedicated sensors with no unified full-body approach. This dissertation proposes the creation of a general, real-time and robust full-body spatial pose estimation solution using visual information from two camera streams, with non-overlapping ROIs, mounted on the ASBGo smart walker used in patient rehabilitation. Human joint estimation is performed using a two-stage Neural Network framework, where keypoints are first detected in 2D image frames of both cameras, using a Fully Convolutional Network, and then lifted to 3D space relative to the walker, using a Fully Connected regression module. A custom acquisition method was also developed and used to obtain a dataset containing data from 14 healthy subjects, used for training and evaluating the proposed solution offline, which was then deployed and integrated on the real smart walker. An overall detection error of 3.73 pixels and 44.05mm were reported for each stage respectively, with an inference time of 26.6ms when deployed on the constrained hardware of the equipment, during normal use. The final solution was able to extract a compact body representation from inexpensive sensors, which can be used as a common base to calculate full patient gait and posture metrics, allow Human-Robot interaction applications and human-in-the loop control for personalized rehabilitation. Despite promising results, more data should be collected with impaired subjects, in order to assess the model’s true performance as a rehabilitation tool in real-world scenarios.

Full text

Manuel de Castro Palermo Real-Time Patient Pose Estimation on a Smart Walker Real-Time Patient Pose Estimation on a Smart Walker Manuel de Castro Palermo UMINHO I 2021 janeiro de 2021 Manuel de Castro Palermo Real-Time Patient Pose Estimation on a Smart Walker Master Dissertation Master Degree in Biomedical Engineering Medical Electronics Dissertation supervised by: Professora Doutora Cristina P. Santos janeiro de 2021 Direitos de Autor e Condições de Utilização do Trabalho por Terceiros Este é um trabalho académico que pode ser utilizado por terceiros desde que respeitadas as regras e boas práticas internacionalmente aceites, no que concerne aos direitos de autor e direitos conexos. Assim, o presente trabalho pode ser utilizado nos termos previstos na licença abaixo indicada. Caso o utilizador necessite de permissão para poder fazer um uso do trabalho em condições não previstas no licenciamento indicado, deverá contactar o autor, através do RepositóriUM da Universidade do Minho. Licença concedida aos utilizadores deste trabalho https://creativecommons.org/licenses/by-nc-nd/4.0/ ii Acknowledgments All the work carried out during the past semester would not be possible without the help, understanding and support from many people. First and foremost, I would like to express my deepest gratitude to my adviser Prof. Cristina Santos, who fostered a great learning environment with multiple opportunities to expand my horizons through valuable research connections. I am extremely grateful for her dedication, support and constant motivation. I am also thankful to Sara and Lucia, who were always available to help and discuss the research and presented suggestions that helped me develop this accomplishment. I am thankful to everyone in the lab for the good working environment created, with a special thanks to António Pereira, who was always available to discuss any idea, and to João André, who helped with all the data acquisition steps and was always available to help me solve walker related issues. I express my warm thank you to my girlfriend, Inês, for her support, dedication and patience during the last year. She motivated me to write my dissertation, while also providing much needed distractions. I’m also thankful to her parents for all the support this last year. Finally, and most importantly, I would like to thank my family, specially, my mother, my father and my sister, for all the love and support over the years. iii Statement of Integrity I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho. iv Abstract Rehabilitation is important to improve quality of life for mobility impaired patients. Smart walkers are commonly used to provide residual motor skills recovery, based on repetitive and intensity-adapted training. These should embed automatic, objective and real-time tools for user-centered control and monitoring. Yet, present solutions have focused only on extracting few very specific metrics using dedicated sensors with no unified full-body approach. This dissertation proposes the creation of a general, real-time and robust full-body spatial pose estimation solution using visual information from two camera streams, with non-overlapping ROIs, mounted on the ASBGo smart walker used in patient rehabilitation. Human joint estimation is performed using a two-stage Neural Network framework, where keypoints are first detected in 2D image frames of both cameras, using a Fully Convolutional Network, and then lifted to 3D space relative to the walker, using a Fully Connected regression module. A custom acquisition method was also developed and used to obtain a dataset containing data from 14 healthy subjects, used for training and evaluating the proposed solution offline, which was then deployed and integrated on the real smart walker. An overall detection error of 3.73 pixels and 44.05mm were reported for each stage respectively, with an inference time of 26.6ms when deployed on the constrained hardware of the equipment, during normal use. The final solution was able to extract a compact body representation from inexpensive sensors, which can be used as a common base to calculate full patient gait and posture metrics, allow Human-Robot interaction applications and human-in-the loop control for personalized rehabilitation. Despite promising results, more data should be collected with impaired subjects, in order to assess the model’s true performance as a rehabilitation tool in real-world scenarios. Keywords: Rehabilitation, smart walker, human pose estimation, computer vision, machine learning v Resumo A reabilitação é importante para melhorar a qualidade de vida dos pacientes com mobilidade reduzida. Os andarilhos inteligentes são utilizados para favorecer a recuperação de capacidades motoras com base na repetição de exercícios com intensidade adaptada. Estes devem incorporar ferramentas automáticas, objetivas e em tempo real para fornecer técnicas de controlo personalizadas e monitorização do paciente. No entanto, as soluções atuais concentram-se apenas em extrair algumas métricas muito específicas com sensores dedicados, sem haver uma abordagem geral de corpo inteiro. Esta dissertação propõe a criação de uma solução geral, rápida e robusta para detetar o corpo completo do utilizador no espaço, usando informação visual de duas câmaras, com ROIs não sobrepostas, montadas no andarilho inteligente (ASBGo) usado na reabilitação de pacientes. A deteção das juntas humanas é realizada através de uma rede neuronal em duas etapas, onde primeiro são detetados pontos-chave nas frames 2D de ambas as câmaras, usando uma rede totalmente convolucional, e estes depois são relacionados e projetados para o espaço 3D relativamente ao andarilho, usando um módulo de regressão. Um método de aquisição personalizado foi também desenvolvido e usado para obter um conjunto de dados com 14 sujeitos saudáveis, para teinar e avaliar a solução proposta offline , que depois foi integrada no sistema do andarilho real. Um erro de detecção médio de 3,73 pixels e 44,05mm foram relatados para cada etapa, respetivamente, com uma latência de 26,6ms quando usado no hardware limitado do equipamento durante utilização normal. O algorítmo é capaz de extrair uma representação compacta do corpo, a partir de sensores baratos, e que pode ser usada como uma base comum para calcular métricas de marcha e postura completas, assim como permitir aplicações de interação Humano-Robot e soluções de controlo human-in-the-loop para uma reabilitação personalizada. Apesar de resultados promissores, mais dados devem ser obtidos com pacientes, a fim de verificar o verdadeiro desempenho do modelo como ferramenta de reabilitação em cenários reais. Palavras-Chave: Reablitação, andarilho inteligente, deteção da postura humana, visão computador, aprendizagem máquina vi Contents Acknowledgments iii Abstract v Resumo vi List of Figures xiii List of Tables xv Acronyms xvi 1 Introduction 1 1.1 Motivation ...................................... 1 1.2 Problem Statement .................................. 2 1.3 Solution Overview ................................... 3 1.4 Objectives ...................................... 4 1.5 Solution Requirements ................................ 5 1.6 Contributions ..................................... 6 1.7 Dissertation Outline .................................. 7 2 Literature Review 9 2.1 Patient Monitoring in Smart Walkers .......................... 9 2.2 Feature Extraction using CNNs ............................ 11 2.3 Human Pose Estimation ............................... 13 2.3.1 Classical Approaches ............................. 13 2.3.2 Deep Learning ................................ 14 vii List of Tables 2.1 Summary of 2D HPE methods in the literature and respective performance in the MPII [57] dataset test split, commonly used as a general benchmark for most methods. (*) denotes methods which use depth information as input. ................ 16 2.2 Summary of 3D HPE methods in the literature and respective performance in the Human3.6m [64] dataset under Protocol1, which is commonly used as a general benchmark for most methods. (*) denotes methods which use depth information as input. . . 19 2.3 Summary table of popular 3D HPE datasets. ...................... 26 3.1 Metadata of the participant’s contained on the walker dataset. ............. 38 3.2 Proposed data for each of the splits. The training data was extended with the extra samples with higher variability. Number of samples were counted at the original 30Hz (in practice, only a third will be used). ......................... 40 5.1 Results summary of the 3D-Stage and comparisons against the different variants for regression from the 2D-Stage keypoints. The best results are highlighted in bold. . . . . 61 5.2 The default EfficientNet-lite0 backbone 2D-Stage performance in comparison with the common ResNet models. OpenPose is also compared in terms of latency for reference (values were taken from the paper), as it is a common baseline on real-time pose estimation. The best results in each metric are highlighted in bold. ............ 63 5.3 Importance of the refine module on the 2D-Stage accuracy and latency. Its effect is investigated by removing the refine module and obtaining the 2D keypoint locations from the keypoint heatmaps branch, and by further removing the parallel connection heatmap branch. The best results in each metric are highlighted in bold. ........ 64 xiv List of Tables 5.4 Default 3D-Stage lifting approach comparison with the 2D keypoint locations projection using the pixel depth and the camera Pinhole model (Projection_Raw), and by further processing using the residual correction neural network in the Projection_Residual method. The 2D keypoint location labels were used as input to the regression in all methods. The best results in each metric are highlighted in bold. ................... 65 5.5 Result summary of the default 3D-Stage and lifting variants when receiving as input the GT 2D keypoint locations. The default 3D-Stage error when regressing from the 2D-Stage predictions is shown as reference. The best results in each metric are highlighted in bold. 65 5.6 Result summary of the default 2D-Stage with and without pretraining on the NTU_RGBD dataset with further fine-tuning on the walker dataset. The best results in each metric are highlighted in bold. ................................ 67 5.7 3D results obtained using the default model with and without pretraining on the NTU_RGBD dataset with further fine-tuning on the walker dataset, from the 2D keypoint location predictions of the 2D-Stage and labels. .................... 67 5.8 2D-Stage results obtained using the temporal model with 4 sequential frames, compared to the default single frame version. .......................... 67 5.9 3D results obtained using the temporal model with 4 sequential frames, compared to the proposed single frame version, from the 2D keypoint location predictions of the 2D-Stage and labels. The best results in each metric are highlighted in bold. ........... 68 xv Acronyms CNN Convolutional Neural Network. 11,14,16,23,24,74,83 COM Center-of-Mass. 9,10 CPM Convolutional Pose Machines. 15,21 DL Deep learning. 1,3–7,9,14,16,22,26,49,81,82 ERF Effective Receptive Field. 15,41,44,74 FC Fully Connected. 3,14,16,18,20,23,45,49,50,55,56 FCN Fully Convolutional Network. 3,14,17,20,43,81 GNN Graph Neural Network. 18,20 GT Ground-Truth. 31,52,57,60,61,64,65,67,75,81 HPE Human Pose Estimation. 3–7,9,13,14,16–18,21–26,40,44,50,52,71,74,75,78,79,81, 82 IMU Inertial Measurement Unit. 13,32–34,39,73,82 LSTM Long Short-Term Memory. 19,20 MoCap Motion Capture. 2,4,6,16,22–25,31,33,82 MPJPE Mean Per-Joint Position Error. 52,59,64,65,68 NN Neural Network. 3,4,14,17,20,21,29,40,55,61,62,72,78,83 xvi Acronyms ONNX Open Neural Network Exchange. 47,78 PCK Percentage of Correct Keypoints. 52,60 ROS Robot Operating System. 4,29,47,54,68,77 SDK Software development kit. 22,25,26,51 SE Squeeze-and-Excitation. 11,12,47,78 SemGCN Semantic Graph Convolution Network. 18,54,65,76,78 SMPL Skinned Multi-Person Linear. 21,25,79 xvii Chapter 1 Introduction This dissertation presents the research carried out during the last semester in the scope of my Masters Degree in Biomedical Engineering at the Biomedical Robotic Devices Lab (BirdLab) included in the Center for Micro-Electro-Mechanical Systems (CMEMS), a research center of the Department of Industrial Electronics (DEI) in the University of Minho. The focus of this dissertation centers around the creation and deployment of an algorithm capable of automatically, and in real-time, extract and evaluate a person’s body configuration in space using visual information coming from two RGB+D cameras mounted on a smart walker equipment (ASBGo [1]) used in patient rehabilitation in hospital environments, in order to help physicians in diagnostics and allowing future Human-Robot interaction solutions. The research was inserted in the ” EML – Equipamento Multifuncional de auxílio técnico à Locomoção” , project which aims to assist in rehabilitation, especially in patients with gait impairments. The project was divided in three main phases, namely: i) the elaboration and execution of a protocol for data acquisition using the smart walker in order to create a dataset for gait/posture detection; ii) research and development of data driven algorithms based on Deep learning (DL) approaches using the collected data and their offline evaluation; iii) deployment and evaluation of the final solution on the smart walker. 1.1 Motivation Gait and posture disabilities are common [2], [3], and increasing due to the aging population and to the global incidence of cardiovascular and/or neurological disorders, such as cerebellar ataxia, cerebral 1 Chapter 1. Introduction palsy, Parkinson’s disease, among others [4]–[7]. Along with cognitive impairments, pathological subjects may present a lack of stability, affected motor coordination, poor balance, and muscle weakness, leading to an increased risk of falls and fall-related morbidity [1], [3], [8]. Consequently, the persons’ quality of life is highly jeopardized, causing social-economic consequences due to the increased institutionalization and dependence on others [1], [8]. Rehabilitation is traditionally conducted by physicians and therapists over long periods of time, demanding high physical effort from physiotherapists with challenges due to intra- and interclinician and patients variability, while being time consuming and prone to errors due to clinicians’ fatigue [3]. Roboticsbased rehabilitation is an evolving area that aims to improve the quality of life of motor-impaired people by providing residual motor skills recovery based on repetitive and intensity-adapted training. Along with assistive devices, smart walkers have been a popular choice in the context of gait rehabilitation [3], [9]. An automatic and complete spatio-temporal representation of the patients configuration in space, based on data gathered from built-in sensors, would be highly desirable in order to provide personalized care [10], [11], by allowing extraction of quantitative parameters to monitor and help physicians evaluate patient improvements, simultaneously serving as a basis for downstream human-robot interactions and user-centered control strategies, adjusting to the patient needs in real-time. 1.2 Problem Statement Gait monitoring and analysis has usually been accomplished accurately through expensive Motion Capture (MoCap) systems [12], requiring complex setups along with specific environments and workspaces, not practical for routine therapy sessions. Movement analysis using low-cost equipment, e.g. Kinect (Microsoft Corporation, New Mexico, United States), has been presented in the literature [13], with promising results, however, has been shown prone to errors especially in the feet joints and when dealing with non-trivial poses, unideal camera placement, occlusions or challenging light conditions [14], [15]. Available smart walker solutions for patient monitoring have focused on extracting narrow aspects, such as specific gait or stability parameters, using specialized hardware and classical software, presenting fundamental limitations when dealing with non-ideal conditions [1], [16], [17]. The ASBGo [1] smart walker was the focused platform throughout this dissertation, it has to assist the user performing rehabilitation, by automatically adjusting its velocity and direction, in order to achieve a personalized assistance, while monitoring the patient’s condition by extracting multiple gait and posture performance metrics. 2 Chapter 1. Introduction In order to do so, the system has to be able to detect and extract relevant keypoints’ positions in space and in real-time, from the visual information collected by two cameras, with complementing views, mounted on the walker, one pointed at the legs and another at the torso, and whose information needs to be fused in order to obtain a full-body representation of the patient. This is further complicated by the possibility of challenging light conditions (light saturation, high shadow contrasts and IR sunlight noise) and feet occlusions during walking. Currently, the ASBGo walker has a Human Pose Estimation (HPE) solution implemented, based on traditional computer vision methods (segmentation, blob/convex-hull detection), relying on raw depth projection of detected 2D keypoints to 3D space with no learning component, yielding average detection errors above 200mm without additional post-processing to correct bad detections, and with limited robustness in non-ideal conditions. Skeleton tracking solutions (e.g. Kinect) could have provided a relevant approach, however, given the cameras placement, off-the-shelf use performed poorly. These substandard results have prevented its routine use as a tool in rehabilitation sessions, thus requiring the design of a new improved solution. Recent studies involving vision-based DL techniques for HPE are showing great potential for locomotion and posture analysis [10], [18]. Besides capable of working from low-cost sensors, without the need of wearable markers/sensors nor complex setups, and in real-world unconstrained scenarios, these have shown good precision, robustness and flexibility, even in challenging conditions, given adequate training [11], [19]. Nevertheless, most approaches are not targeted to run in real-time on constrained devices, and also require large amounts of quality data to achieve the required performance. 1.3 Solution Overview Visual information from the two RGB+D cameras with non-overlapping ROIs mounted on the ASBGo walker were used to directly extract a concise body representation (skeleton) of the user, which can readily be applied to downstream tasks. A real-time, accurate pose estimation algorithm solution was developed, based on the use of a two stage Neural Network (NN), where the first detects the patient’s keypoints and limb locations on the RGB+D frames from both cameras, using a Fully Convolutional Network (FCN), while the second stage uses a Fully Connected (FC) module to relate and regress the detected 2D keypoints to 3D space relative to the walker. A low-pass filter is applied on top of the model predictions to improve temporal consistency. A custom mobile acquisition method was developed to collect visual data from the ASBGo walker 3 Chapter 1. Introduction cameras, synchronized with joint data coming from an accurate Inertial MoCap system, which was employed to create a HPE dataset involving subjects performing rehabilitation on the walker in real-world environments, to train and evaluate the model’s performance offline. Due to the limited number of samples in this dataset, along with the low pose variability present, transfer-learning techniques were used in order to increase performance, through the use of a pre-trained convolutional backbone and pre-training of the model on a larger dataset with similar data modalities as the ones present in the walker dataset, with a final fine-tuning in the obtained data. The trained model was finally deployed on the walker, through the creation of a custom Robot Operating System (ROS) package, which interfaces with the already implemented architecture. 1.4 Objectives This dissertation has the main goal of developing an accurate and non-invasive solution for real-time full body pose estimation, to be deployed on the ASBGo smart walker [1]. This work explores all steps, starting from data acquisition, model training, benchmarking, and, finally to its deployment on the walker. Recent developments in HPE using DL solutions were followed, as these have shown great empirical results, flexibility and robustness to conditions. The following Goals will thus need to be achieved: •Goal 1: Perform a review on methods for posture and gait evaluation using smart walkers. A brief summary of the techniques will be presented on Section 2.1. •Goal 2: Conduct an extensive literature review comparing methods for full-body HPE with a focus on DL based approaches. This will be resumed on a Literature Review featured on Section 2.3. •Goal 3: Devise a custom acquisition method to obtain patients’ joints spatial and kinematic data, temporally synchronized and spatially related to visual information coming from the walker’s RGB+D cameras, in a mobile fashion which mimics real utilization conditions outside of a control lab space. This method will be described on Section 3.2 and led to a workshop abstract oral presentation. •Goal 4: Create a custom dataset with data acquired from multiple subjects, using the mobile acquisition method, to develop and evaluate data driven algorithms ( e.g. NNs) offline. The data obtained will be displayed on Section 3.2.5 and led to a dataset paper under elaboration. 4 Chapter 1. Introduction •Goal 5: Develop an algorithm capable of extracting a compact representation of the user’s body accurately and in real-time, directly from two camera streams, with non-overlapping ROIs, mounted on the walker. This method should not only be accurate (where a detectione error bellow 75mm for each joint was aimed), but also capable of running in real-time (>19fps) when deployed on the constrained hardware of the walker. Some ideas will be explored on Sections 3.4 and 4.3 and led to a submitted journal paper. •Goal 6: Deploy and validate the solution on the real walker device. It must be integrated on the equipment, receiving inputs and publishing outputs from/to other modules, while meeting all the criteria specified, especially in terms of detection error and latency, without negatively impacting overall system performance, as multiple systems will be run concurrently during normal therapy session. All information related with this topic will be described on Section 3.7. The following Research Questions (RQ) are also expected to be answered: •RQ 1: How to obtain accurate joint data in real world environments synchronized both temporally and spatially with visual information from cameras? This RQ relates to Goal 3 and is addressed in Section 3.2. •RQ 2: Is it possible to have a DL approach capable of detecting the user’s body in real-time while running on a constrained device? This RQ is related to Goal 6 and is answered in Section 5.2. •RQ 3: Can body visual information from complementing cameras be combined to yield a full body representation? This RQ relates to Goal 5 and is answered in Section 5.1. •RQ 4: Is the depth information necessary or beneficial for the HPE task? This RQ is related to Goal 5 and addressed in Section 5.1. 1.5 Solution Requirements To be effectively used as a rehabilitation tool on the ASBGo walker, a HPE solution has to: • Be able to extract a low-dimensional representation of the human body, specifying the location of the following keypoints in space: wrists, elbows, shoulders, neck, middle of the spine, pelvis, hips, knees, heels, and toes of the feet. These were considered necessary for downstream tasks, specially the extraction of gait and posture metrics and can be represented as a kinematic skeleton model, following the literature [11]. 5 Chapter 1. Introduction • Obtain the body representation without the use of visual markers or wearables on the patient, as this is not practical when dealing with movement impaired subjects, thus resorting solely on visual information coming from the cameras. • Run in real-time with a sampling frequency above 19Hz (<53ms), as to not produce aliasing of any movement components during walking (although most body parts have lower spectral range and significant components are found bellow 3Hz) [20]. Moreover, this is solution must not impact overall system performance, on the constrained hardware of the walker, which must simultaneously run multiple concurrent processes during a rehabilitation session. • Present the lowest possible detection error, where a maximum error threshold of 75mm for each keypoint was targeted, which is half of the detection threshold value commonly reported in the literature [11], while also producing more anthropometrically plausible kinematics. 1.6 Contributions This dissertation’s main contribution was a full-body pose estimation solution based on DL, capable of running in real-time on the ASBGo smart walker, improving on the existing algorithm and empowering future solutions on this device. It contributes to knowledge with the following topics: • A survey on existing HPE methods, specially focused on DL based approaches. • A method for mobile acquisition of MoCap data synchronized with visual information, for real-world environments. • A multi-modal dataset for gait and posture analysis. • A DL solution for real-time full-body pose estimation from cameras with non-overlapping ROIs. Publications The developed work over the last semester led to the publication of 1 conference paper, 1 workshop abstract oral presentation. It also led to the submission of 1 book chapter and 1 journal paper, with 1 additional paper currently under elaboration. • João Andre, João M. Lopes, Manuel Palermo, Diogo Goncalves, Ana Matias, Fátima Pereira, José Afonso, Eurico Seabra, João Cerqueira and Cristina P. Santos, ” Markerless Gait Analysis 6 Chapter 2. Literature Review 2.3 Human Pose Estimation HPE is a task that aims to estimate a person’s limb configuration in space, by extracting a descriptive low-dimensional representation from sparse high-dimensional raw sensor data ( e.g. videos, inertial data, etc ...) [11]. This is a crucial base step for subsequent task in action or gesture recognition, human-robot interaction, intention understanding, video character animation, and human posture/gait analysis, which make use of a concise joint representation of the human body [40]. Traditionally, the detection of limb configurations for gait and posture analysis has been carried out with great precision with the use of motion capture setups, which use an array of distributed cameras around a subject equipped with reflective markers. This translates to a tracking and triangulation problem from multiple viewpoints and has served as the gold standard, with sub-millimeter detection error. However, its high costs and complexity make it hard to use in routine rehabilitation settings, as it requires elaborate setups, equipment and technicians to be used correctly and limits the acquisition space to a small controlled room [41]. Another motion capture alternative involves the use of inertial systems, combining a kinematic model of the human body structure and range of motion with multiple Inertial Measurement Unit (IMU) sensors placed on all limbs to determine the body configuration. This approach leads to accurate joint positions and kinematics and is not restricted in terms of acquisition volume, making it more suitable for real world environments. Nevertheless, it is still fairly expensive, requires the use of wearables, it is hard to relate to an external referential and real-world landmarks and is highly dependent on correct internal calibration, making it impractical for people with mobility problems [12], [42]. Recent research in the field has thus focused in the direction of performing body analysis from inexpensive consumer grade cameras, by employing computer vision techniques [11], [19], [43], as these are widely available, do not require the use of wearables or complex setups. However, accuracy has been limited by multiple challenging factors, namely, strong articulation and non-linearity of the human body, the presence of small and barely visible joints, different scale depending on the closeness to the camera, image blurring due to movement, presence of self or object occlusions, varying light conditions and different clothing appearance, to name a few [11]. 2.3.1 Classical Approaches Traditional HPE methods relied on generative template matching approaches, where body part visual priors are used. Sigal et al. [44] used eigen template detectors for head, upper arms and lower legs 13 Chapter 2. Literature Review proposals with temporal tracking. Felzenszwalb et al. [45], used the Pictorial Structures , based on energy minimization matching of parts, restricted by pairwise spatial constraints. Improvements to this approach were proposed by Yang et al. [46], by using a mixture of image features for the template matching, learning local appearances, spatial relations and co-occurrences, resulting in higher robustness to geometry and appearance variations. Pishchulin et al. [47] further improve on this by modeling higher order dependencies between multiple body parts. Ramakrishna et al. [48] moved away from the fixed tree-based spatial relationship constrains, given its limitations on capturing all the interactions between body parts, and proposed the Pose Machines , where multiple stages are used to sequentially refine keypoint locations’ confidence, based on stacked multi-level image and context features, used by a general learning model. The raising popularity of DL based approaches, especially focused on CNNs, revolutionized the field of HPE, as it allowed learning hierarchical image representations end-to-end and in a computationally tractable way. This in combination with the increase in number of publicly available datasets, led to breakthrough performance results. Readers are referred to the Literature Review by Gong et al. [49] for a deeper read on traditional approaches. 2.3.2 Deep Learning 2.3.2.1 2D Pose Estimation One of the earliest works to explore DL for the HPE problem was the DeepPose proposed by Toshev et al. [50]. A 7-layer CNN was used to directly extract relevant image features, followed by FC layers that regress a vector of body joint keypoints (xi,yi). These are refined using a coarse-to-fine multi-stage approach by higher resolution sub-images centered on the previous stage prediction as input to each new stage. The model outperformed previous classical methods in benchmarks, although it struggled to efficiently learn the direct mapping from the image space to the vector locations. In order to address the learning problems of the previous method, a heatmap detection based approach was proposed by Tompson et al. [51], where a multi resolution FCN architecture is used to regress per-pixel likelihoods of each keypoint being on the input image, resulting in nheatmaps. These were created using a Gaussian density function centered on each of the keypoint locations. This provides a dense training signal better suited to optimize the NNs, while also providing the detection confidence for the prediction and being more interpretable. The keypoint 2D locations can easily be extracted from this 14 Chapter 2. Literature Review representation by finding the maximum probability pixel location for each keypoint. The Convolutional Pose Machines (CPM) model proposed by Wei et al. [52] (Figure 2.2) improves over the heatmap method, by using a multi-stage architecture, where the first stage predictions are fed to subsequent refining stages, along with the image input. Large convolutional kernels are used in each stage in order to obtain an increasingly large Effective Receptive Field (ERF) to enable the network to learn long-range spatial dependencies and better tackle occlusions. An intermediate loss is applied at the outputs of every stage in order to combat the vanishing gradient problem and force the model to learn better intermediate features. Figure 2.2: Convolutional Pose Machine proposed by Wei et al. [52]. This model was improved in the OpenPose architecture proposed by Cao et al. [53]. The first stages predict Affinity-Maps between joint keypoints. In this representation introduced by the authors a vector for each pixel pointing from each keypoint to the next in the body kinematic tree is encoded in a similar way to the keypoint heatmaps. This not only provides initial limb localization, which is helpful in detecting the joint locations, but also allows multi-person pose estimation by running a bipartite matching post-processing algorithm to attribute detected keypoints to each person in a bottom-up fashion. Multiple architectural improvements were also performed, as to allow real-time inferencing, while maintaining accuracy, such as using lower resolution features extracted by a VGG backbone at each stage, instead of the full image, and using smaller kernel sizes. Bulat et al. [54] used a simpler part connection heatmap representation, where pixels only encode the limb location in order to provide context for subsequent stages, which regress the keypoint heatmaps. This lowered complexity, but is only suited for single-person pose estimation, unlike OpenPose . A different direction was taken by Newell et al. [55], in the Hourglass architecture, where a multi-stage 15 Chapter 2. Literature Review encoder-decoder architecture with skip connections [56] and residual modules [28] is used, in order to obtain rich multi-scale representations. Due to the large memory and processing requirements, the first convolution block downsamples the input image from the 256x256 resolution input to 64x64, which is used for all further layers and heatmap outputs. A summary of 2D detection methods is presented in Table 2.1, this also includes additional 2D improvements which will be presented on subsequent sections on this review. Table 2.1: Summary of 2D HPE methods in the literature and respective performance in the MPII [57] dataset test split, commonly used as a general benchmark for most methods. (*) denotes methods which use depth information as input. Method Year Description PCKh(%)↑ Pishchulin et al. [47] 2013 Body-parts template matching 44.1 Toshev et al. [50] 2014 Coarse-to-fine multi-stage regression - Tompson et al. [51] 2015 Coarse-to-fine heatmap detection 79.6 Wei et al. [52] 2016 Multi-stage heatmaps detection 88.5 Newell et al. [55] 2016 Multi-stage heatmaps detection 90.9 Bulat et al. [54] 2016 Part + keypoint heatmaps detection 89.7 Cao et al. [53] 2017 Fast Affinity + keypoint heatmaps detection 88.8 Sun et al. [58] 2017 Joints + bone vectors regression 86.4 Sun et al. [59] 2018 Heatmaps detection + integral regression 91.0 Groos et al. [60] 2020 Fast affinity + keypoint heatmaps detection 84.8 - 91.2 Pfister et al. [61] 2015 Sequential heatmaps detection - *Moccia et al. [18] 2020 Sequential heatmaps detection - *Martínez-González et al. [62] 2019 Fast heatmaps detection - 2.3.2.2 3D Pose Estimation 3D HPE has seen less progress, given the difficulty in obtaining large amounts of labelled, high quality 3D joint data, requiring the use of MoCap systems, resulting in data with low environmental variability in a small, controlled room. The recent introductions of some large scale datasets [63]–[65] with special mention to Human3.6m has brought much attention to the field, specially with approaches based on DL. Two approaches for 3D pose estimation are common: a direct method, where 3D keypoints are regressed from the input image, and a two-stage lifting approach, where detected 2D keypoints are regressed to 3D space by finding a corresponding depth for each. The first approach is able to fully leverage image cues to resolve ambiguities and occlusions, however, the high dimensionality and sparsity of the problem makes the optimization process harder. Li et al. [66] used a CNN, followed by a set of FC layers to directly regress 3D keypoints from an input image. The model was first pre-trained to detect the occurrence of joint keypoints on an image patch, 16 Chapter 2. Literature Review obtaining satisfactory results. This was improved by Tekin et al. [67] where 2D heatmaps obtained from a Hourglass model were used as additional inputs, combining them with input image cues, to regress the 3D keypoints, leading to better results over the direct regression from image features. Zhou et al. [68] regressed joint angles instead, combined with a human kinematic model to obtain the keypoints’ 3D locations through forward kinematics. The model was trained end-to-end with a loss between predicted and labeled 3D keypoint positions. This forced the production of anthropometrically valid solutions by imposing kinematic constraints, exploiting prior knowledge about the model’s structure, however, the high non-linearities associated with regressing joint angles, along with compounding errors along the kinematic chain and the need to create a new model for each application, has limited widespread adoption of the approach [58]. Pavlakos et al. [69] extends the Hourglass architecture to 3D, predicting Gaussian volumetric heatmaps, using a coarse-to-fine approach over the depth dimension, in a discretized space around the subjects, which is kept small (64x64x64) due to the high memory requirements. This is addressed by Nibali et al. [70], with marginalized 2D heatmaps (XY, YZ, XY) for each of the keypoints, with normalized subjects’ dimensions. Although good empirical results are achieved, heatmap based models are computationally expensive, given the multistage volumetric predictions, while also requiring the discretization of the volume around a fixed location, normally the pelvis joint in the case of HPE. A different approach was taken by Rogez et al. [71] with a Localization-Classification-Regression architecture based on image features obtained from a ResNet backbone. Firstly, a NN produces region proposals with subjects, each with a fixed set of 2D and 3D anchor poses, then a classifier selects the most plausible, which is then refined using a regression stage. Multiple region proposals for the same subjects are grouped and integrated for improved results. The VNect architecture proposed by Mehta et al. [19], shown in Figure 2.3, offers a real-time solution, by using a single stage FCN approach, which simultaneously predicts 2D keypoint heatmaps in image space, and root relative keypoint distance maps in 3D space, using extracted image features from a ResNet backbone. The NN predictions are improved by using a temporal filter in order to produce smoother outputs, and further improved with a least squares skeleton fitting post-processing, finally, the root joint (pelvis) location is transformed to camera space. This is further enhanced in [72] with an intermediate 3D limb encoding to account for invisible body keypoints, and by Shimada et al. [73] by combining a physicsbased optimiser that takes into account environment constraints and pose plausibility from a physics standpoint, taking as input joint kinematics and feet ground contact forces predicted by a NN model, in real-time. 17 Chapter 2. Literature Review Figure 2.3: Real-time 3D pose estimation method proposed by Mehta et al. [19]. On the other hand, lifting approaches benefit from advances in the 2D HPE literature and the 2D stage can be trained from 2D pose datasets containing high environmental variety, while allowing the use of a smaller 3D stage, easier and faster to optimize. Although less information is present to deal with pose ambiguities, better results have been obtained overall, however, the results are dependent on the 2D-Stage error. Chen et al. [74] formulate the 3D lifting as a nearest-neighbor matching problem given a large enough library of 3D poses. Moreno-Noguer et al. [75] represents poses as NxN matrices of Euclidean pairwise distances and formulates the problem as a regression from 2D to the 3D matrix, resolving ambiguities using pose priors. Zhao et al. [76] proposed using a set of FC layers to directly learn to regress the 2D keypoints to 3D space. This was further improved with the use of stacked residual FC layers by Martinez et al. [77], displayed in Figure 2.4, setting a simple baseline with strong empirical results. Figure 2.4: Residual Fully Connected module for 2D to 3D pose lifting proposed by Martinez et al. [77]. More recently, the use of Graph Neural Networks (GNNs) has gained great popularity, since these can be used directly in place of FC layers and introduce pose hierarchical structure information into the learning, leading to better representations. Zhao et al. [78] propose a Semantic Graph Convolution Network (SemGCN), which learns to capture local and global joint relationships, combined with contextual image information pooled from the backbone output features around each keypoint location. A summary of 3D detection methods is presented in Table 2.2, this also includes some general 3D improvements which will be presented on subsequent sections on this review. 18 Chapter 2. Literature Review Table 2.2: Summary of 3D HPE methods in the literature and respective performance in the Human3.6m [64] dataset under Protocol1, which is commonly used as a general benchmark for most methods. (*) denotes methods which use depth information as input. Method Year Description MPJPE(mm)↓ Li et al. [66] 2014 Detection + regression 132.2 Zhou et al. [68] 2016 Angles Regression + kinematic model 107.3 Mehta et al. [19] 2017 Heatmaps detection + time filter + skeleton fitting 80.5 Mehta et al. [72] 2019 Heatmaps detection + time filter + skeleton fitting 63.6 Shimada et al. [73] 2020 Heatmaps detection + feet contacts + physics model 97.4 Tekin et al. [67] 2017 2D Heatmaps + image regression 69.7 Pavlakos et al. [69] 2017 Volumetric heatmaps detection 71.9 Nibali et al. [70] 2019 Marginal heatmaps detection 55.4 Rogez et al. [71] 2019 Pose-anchors classification + regression refinement 61.2 Sun et al. [58] 2017 Joints + bone vectors regression 59.1 Sun et al. [59] 2018 Heatmaps detection + integral Regression 48.3 Chen et al. [74] 2017 Lifting as 3D pose library matching 82.7 Moreno-Noguer et al. [75] 2017 Distance matrix lifting 76.5 Zhao et al. [76] 2017 FC lifting - Martinez et al. [77] 2017 Residual FC lifting 62.9 Zhao et al. [78] 2019 Residual GNN lifting 57.6 Coskun et al. [79] 2017 Temporal LSTM-KF lifting 71.0 Rayat et al. [80] 2018 Temporal LSTM lifting 51.9 Dabral et al. [81] 2018 Temporal FC lifting 52.1 Pavllo et al. [82] 2019 Temporal CNN lifting 47.1 Liu et al. [83] 2020 Temporal CNN + GNN lifting 44.9 Varol et al. [84] 2018 Multi-task detection + SMPL regression 49.0 Kocabas et al. [85] 2020 Temporal GRU + CNN SMPL regression 65.6 *Martínez-González et al. [86] 2019 Keypoints depth projection + residual FC correction - *Shotton et al. [87] 2011 (Kinect) Pointcloud segmentation + clustering + tracking - 2.3.2.3 Temporal Pose Estimation Single frame predictions, when applied to video inputs, produce temporally incoherent results, due to independent error on each frame. One possible solution has been the use of sequential data to aggregate temporal information, also improving robustness to occlusions and noise, while easing pose ambiguities, for both 2D and 3D detections. Pfister et al. [61] predicts heatmaps for 15 frames in a given temporal neighborhood independently, each combined with corresponding optical flow map, which are then pooled with a temporal convolution to produce the current frame’s heatmap. Moccia et al. [18] used 3D spatio-temporal convolutions to simultaneously predict keypoint locations in three sequential frames with improved results over a single frame baseline, however, the simultaneous temporal and spatial prediction limits the temporal window used, given the memory and computational restraints. Rayat et al. [80] used a Long Short-Term Memory (LSTM) network to improve temporal consistency 19 Chapter 2. Literature Review of keypoint predictions from a 2D pose detector, especially in the presence of noisy estimates, with a sequence length of five frames, while Coskun et al. [79] used a Kalman-Filter whose internal state is predicted by LSTM networks for temporal regularization. Nevertheless, the training instabilities [88] and increased complexity associated with using backpropagation through time [89] and the high computational cost have limited recent application of recurrent methods, in favour of temporal convolutions, which have shown good empirical results with simpler architectures [90]. Dabral et al. [81] refine multiple (20 by default) keypoint predictions coming from a single frame 3D pose estimation stage with a simple temporal module composed of FC layers receiving all frames concatenated as a single vector. This was shown to outperform LSTM based approaches, which fail to reason over long sequences, while being harder to optimize. Pavllo et al. [82] instead, lifted sequences of 2D keypoint data using a FCN with dilated 1D temporal convolutions over the span of 251 frames, showing that larger temporal windows can lead to improvements. Liu et al. [83] improve on this by combining the temporal convolutions with a local and global attention GNN for temporal and spatial awareness (Figure 2.5). Figure 2.5: Graph Attention Spatio-temporal Convolutional Network proposed by Liu et al. [83] Temporal NNs have given great results, however, are not as straightforward to implement for real applications. Mehta et al. [19] instead, applied temporal filtering [91] on top of their 2D and 3D single frame predictions, in order to obtain temporally stable results in real-time, although introducing some lag. 2.3.2.4 General Improvements Many improvements have been proposed to decrease the detection error, by adding or augmenting components on existing architectures: Sun et al. [59] unified heatmap and localization-regression based methods by using the soft-argmax operator, which instead of taking the maximum value in the heatmap, integrates all locations in the 20 Chapter 2. Literature Review heatmap weighted by their probabilities (normalized from likelihoods), allowing end-to-end training with both the regression and detection benefits, decreasing quantization errors, removing the need for postprocessing and improving training stability and speed, with only a small increase in complexity. Additionally, the combination of a heatmap and a keypoint regression loss was shown to decrease detection error compared to either approach on its own. Multi-objective learning and the use of complementing losses have been explored with good results by forcing the NNs to learn better and more generalizable features, complementary to the pose estimation objective. Sun et al. [58] proposed the use of a bone vector regression loss, which forces reasoning about limb connection structure, while Dabral et al. [81] formulated a loss objective exponentially penalizing impossible joint angles and different limb lengths of corresponding left-right sides of the body. Varol et al. [84] predict 2D and 3D keypoints, along with pixel- and voxel-wise body part segmentation maps and Skinned Multi-Person Linear (SMPL) parameters, giving a dense supervision over the complete body structure, shape and kinematics, at the cost of increased complexity, specially in the labelling needed for training. Pre-training on multiple HPE large scale datasets, especially containing higher variability, with subsequent fine-tuning on the target data is a popular approach to improve performance [11], [63], [92], by forcing the model to first produce general features with less chance of over-fitting, this is necessary when the target dataset is relatively small, but is even helpful when using large datasets, and even across different tasks, as is the case of pre-training on 2D datasets for 3D estimation tasks used in most 3D image regression methods. The use of adversarial training has recently been explored [11], [85] by adding additional discriminator terms to penalize implausible poses, kinematics and motion sequences, leading to improved results, at the cost of much higher training costs and complexity, although only the generator is needed at inference time. Most accurate methods rely on large NNs, which exploit vast amounts of training data to produce accurate results, unfortunately not directed for real-time applications on constrained hardware, where lower research attention has been given. Groos et al. [60] proposes improvements to the OpenPose architecture for real-time inference on a constrained device’s CPU, by replacing the VGG backbone by a family of EfficientNet backbones and mobile convolutional blocks are used for all layers, thus making it faster and more accurate, while offering the selection of accuracy/latency trade-offs for the target hardware constraints. Martínez-González et al. [62] proposed the use of lightweight CPMs variant using MobileNet convolutional modules trained on a mixture of real and synthetic data with knowledge distillation techniques, where out- 21 Chapter 2. Literature Review put and intermediate feature supervision is used as additional training signal for the lightweight student network in order to produce similar features as a strong trained teacher baseline, resulting in an almost 10x decrease in inference time, but with similar detection error. Many approaches exist in the HPE literature, and would be impossible to describe all methods in a short introduction, the readers are thus referred to the review of Chen et al. [11] for general concepts and approaches, and to Ji et al. [93] for a focus on 3D detection, both using DL approaches. 2.3.3 HPE with Depth The Kinect showed the first widely used system of HPE, based on its skeleton tracking Software development kit (SDK), designed initially for gaming and virtual reality applications, but later finding use in multiple other areas, from robotics to rehabilitation [13], [43]. The Kinect camera, not only acquires RGB visual information, but also depth, by using an infrared light sensor to project an array of points with a pattern, which reflect on objects and are picked up by an infrared camera sensor, which triangulates the location of pixel groups [43] to deduce their position from the sensor. The depth information eases the HPE problem by simplifying background and floor removal steps in order to segment the user, helps in dealing with ambiguous poses by depth reasoning and obtain better camera relative locations. The Kinect skeleton detection algorithm works directly on the depth frames in a two-step approach: i) all body depth pixels are classified into each of the selected body parts using a Random Decision Forest classifier trained on a large dataset (>300K samples) of real and synthetic MoCap data; ii) joint location proposals are found by using a mean shift with a weighted Gaussian kernel to find the centroid locations with highest probability density, as well as providing the detection confidence, iii) a learned distance offset is applied in order to push the detected location on the surface, to the true joint positions; iv) predictions are fitted to a skeleton model by considering both temporal continuity and prior knowledge from skeletal train data [43], [87]. The algorithm is summarized in Figure 2.6 and is capable of running at 5ms per frames on the Microsoft XBox 360 GPU, given the efficient parallelization of the random forest classifier, although higher latency is reported on CPU, with >20ms, using multiple optimizations and parallelization. Additionally, background subtraction is expected to have been performed on the input data. 22 Chapter 3 Materials and Methods The next chapter specifies all the material (Section 3.1) used in the making of this dissertation, followed by the methods applied and developed: i) data acquisition protocols, as well as data preparation steps to create a usable dataset and its description (Section 3.2)ii), dataset pre-processing to obtain samples to train and evaluate NN based models (Section 3.3)iii) architecture of the proposed model (Section 3.4); iii) losses involved in training the model (Section 3.5); post-processing steps applied (Section 3.6); and finally, its deployment on the ASBGo smart walker (Section 3.7). 3.1 Materials ASBGo Smart Walker All the algorithmic solutions being created will target the ASBGo smart walker used in rehabilitation [1] and shown in Figure 3.1. It is equipped with an Intel NUC-6i7KYK (Intel Corporation, The United States) mini-computer, running an Ubunto 18.04 OS with the ROS1 (Melodic Morenia) software on top, and is responsible for all the high level algorithms and GUI, while communicating with multiple sensors used for status, patient and environment monitoring, using the ROS messaging interface. The computer does not contain hardware accelerators (e.g GPU), normally used to speed up NNs execution, and during rehabilitation sessions it is tasked with running multiple processes concurrently, namely all sensor data acquisition and status reports, GUI, motor control logic, external commands processing and security features, having to keep responsive at all times for their correct functioning and patient safety. These processing constraints will thus have to be taken into consideration when developing any solution for the ASBGo walker, while keeping in mind the latency specifications in Section 1.5. 29 Chapter 3. Materials and Methods Figure 3.1: Hardware on the ASBGo smart walker: Posture (A) and Gait (C) analysis RGB+D cameras; touch screen (B); height adjusting columns (D); high level computer (Intel NUC-6i7KYK) (E); motors and motorized wheels (F); sonar array (surface) and low-level hardware modules (inside) (G); patient driving handles (H); balance support handles (I); removable support harness (J); forearm support with force sensors (K); emergency stop button (L); wooden table (M). The 2 Orbbec Astra (Orbbec 3D Technology International Inc. The United States) RGB+D cameras are used to monitor the patients and are mounted on the front of the walker as shown in Figure 3.1, in a configuration with complementing non-overlapping ROIs, displayed in Figure 3.2a. During normal utilization, the upper camera (posture) only visualizes the upper part of the body, while the bottom camera (gait) only visualizes the legs and feet. These work similarly to the Kinect sensor described in Section 2.3.3, obtaining RGB and also Depth information with a resolution of 640x480 pixels at 30fps. The depth sensor has a range of [0,10]m (errors increase with the distance from the sensor. Both can be described using the Pinhole camera model [103], used to relate points in 3D space and a 2D image plane using a perspective projection . Figure 3.2b describes the transformation between world and image points for the camera referential used, located on an arbitrary referential relative to a world reference. Note that from a geometric viewpoint, the standard image plane can be replaced by a virtual image plane located in front of the focal plane [103]. 30 Chapter 3. Materials and Methods (a) (b) Figure 3.2: a) Field of vision from the walker’s posture (blue) and gait (green) cameras. b) The Pinhole Camera Model with a virtual image plane, used to model each of the cameras, and the referential conventions used throughout this dissertation. Adapted from https://kornia.readthedocs.io The transformation is described by Equation 3.1, where Mis a 3D point in space with coordinates [X,Y,Z]Texpressed in a Euclidean coordinate system; mis the projection of the 3D point Monto the image plane with coordinates [u,v]Tand expressed in pixel units; Cis the principal point offset with coordinates [u0,v0]Tat the origin of the image plane; Kis the camera calibration matrix, also referred as the intrinsic parameters matrix; fx,fyare the focal lengths expressed in pixel units, these posses a negative value since the image referential frame is inverted relative to the camera frame; [R|T]is the extrinsic transformation matrix from an arbitrary world referential to the camera referential, in world units, and is composed of a rotation matrix Rand a translation vector t. m=K[R|t]M      u v 1      =      −fx0u0 0−fyv0 0 0 1           r11 r12 r13 t1 r21 r22 r23 t2 r31 r32 r33 t3              X Y Z 1         (3.1) Xsens The Xsens MTw Awinda (Xsens Technologies B.V., The Netherlands) inertial MoCap system was used in order to obtain accurate joint positional and kinematic data from subjects using the walker, which will serve as Ground-Truth (GT) for training and evaluating any model developed. It is composed of 17 31 Chapter 3. Materials and Methods wearable IMU sensors, which communicate over wireless with a base module connected to a computer running the proprietary Xsens MVN software. This computer records the incoming data, while also driving a biomechanical model (MVN BIOMECH)(Figure 3.3c) from which can be extracted1not only joint kinematic and dynamic information, but also relevant keypoint and limb positions and orientations in space. The equipment has been used in clinical practices [104] and is validated against a gold standard [12]. An additional IMU sensor supported by the system (called prop ) was also used and placed on top of the walker’s posture camera (Figure 3.3b), which is necessary for the dataset preparation later on. The placement of the sensors on one of the subjects can be seen in Figure 3.3a. (a) (b) (c) Figure 3.3: a) Xsens MVN Awinda IMU sensors placed on a user; b) Prop sensor placed on top of the posture camera of the walker; c) Xsens skeleton model and joints (image adapted from the Xsens user manual). Training Hardware The computational resources available to train the models offline were limited to a free Google Colab instance 2with the following hardware specifications: GPU: 1x Nvidia Tesla T4 (16GB VRAM); CPU: Xeon Processor @2.3Ghz (1 core, 2 threads). RAM: 12.6 GB; Disk: 33 GB; This instance is also limited to 8H of continuous use, time after which it gets recycled. 1The full set of exported data can be consulted on the user manual: https://www.xsens.com/hubfs/Downloads/ usermanual/MVN_User_Manual.pdf 2https://colab.research.google.com/ 32 Chapter 3. Materials and Methods 3.2 Data Acquisition A custom dataset was created in order to train and validate all the algorithms, it relates camera visual information coming from the walker’s 2 RGB+D cameras with accurate joint data coming from the Xsens inertial MoCap system, using a custom acquisition setup. It contains data from 14 healthy participants 3 performing gait rehabilitation with the walker, over 27 trials each averaging around 10s. 3.2.1 Mobile Acquisition Setup All data was acquired using a mobile acquisition setup, which was placed on the walker (Figure 3.4), this allows performing the acquisition outside of a controlled laboratory space, replicating the normal environment conditions which will be encountered during normal usage of the equipment, namely: dynamic backgrounds, non-ideal light conditions and presence of other humans. The setup is composed of: i) the ASBGo smart walker, which was responsible for recording the visual information from its 2 embedded RGB+D cameras, and also to send the hardware trigger to start recording on other equipment when a session trial was initiated; ii) the Xsens recording equipment, which was placed on top of the walker tray. This includes the MTw Awinda recording base, which receives the signal from the IMU sensors and the hardware trigger to start recording, and a laptop running the MVN Analyse software to records and processes the Xsens data; iii) the Xsens inertial sensors placed on the users. Figure 3.4: Mobile acquisition setup. A laptop running the Xsens MVN software, along with the acquisition base, are placed on the walker tray, which moves with the walker. The patient is equipped with the Xsens sensors, which are hidden bellow a layer of clothing. 3Acquisition from healthy and gait impaired subjects was planned, but the latter was not possible due to restrictions associated with the COVID-19 pandemic 33 Chapter 3. Materials and Methods 3.2.2 Acquisition Protocol Each subject followed a protocol which involved walking with the ASBGo walker in 3 sequences, over a length of 10m (walking forward, cornering left, cornering right), at 3 different speeds (0.3, 0.5, 0.7 m/s), consistent with people with motor disabilities [105]. Each trial (sequence/speed) was repeated 3 times, for better statistical significance during movement evaluation, consistent with rehabilitation protocols, but in different locations, in order to maximize environment variability (backgrounds, lighting, etc ...). Before starting the trials, metadata such as age, gender, weight and anthropometric limb data was collected from the participants and introduced into the Xsens MVN software. They were then instructed to wear the Xsens IMU sensors on the head, shoulders, chest, arms, forearms, wrist, waist, thighs, shanks, and feet and secured with a strap, according to the manufacturer’s guidelines4(Figure 3.3a). Additionally, the participants were asked to wear long clothes on top of the sensors so they were not visible by the cameras as this could bias the model during training. Then frames for extrinsic calibration of the walker’s camera referentials were obtained and finally, the Xsens system was calibrated in order to initialize the biomechanical model. Each trial proceeded as follows: i) the walker was placed on the starting line of each trial location (these were measured and drawn on the floor in the beginning); ii) the user was placed in front of the walker, and asked to assume the N-Pose , in order to reset the Xsens internal referentials; iii) the subject was asked to grab both of the walker handles; iv) the rehabilitation session started with a remote controller (which was used to guide the walker), at the same time starting the cameras recording and the Xsens MVN software, through hardware trigger; v) the subjects walked normally until reaching the end line; vi) the recording was stopped and the walker moved to the next trial starting position, repeating the process. 3.2.3 Extrinsic Calibration A set of referential transformations between selected points in the walker were necessary for the data processing, however, since the walker is still in prototype phase, the camera’s position on the walker are still not fixed and were prone to unwanted changes in position, therefore extrinsic calibration was performed before the trials of each subject. First, a referential transformation between the posture and the gait cameras was obtained, this was performed by using a checkerboard visible from both cameras and performing stereo calibration (Figure 3.5b), however since both cameras only overlap about 3 meters away from the walker and on a narrow 4https://bit.ly/31iUaA8 34 Chapter 3. Materials and Methods strip of the image, the default stereo calibration methods performed poorly. For this reason, an alternative method was used, which worked by detecting the checkerboard corners in both frames, then projecting those points to 3D and then numerically finding the affine transform with lowest re-projection error. This method was validated with an optical system using visual markers (Optitrack V120:Trio, NaturalPoint, Inc., The United States), with an average translation error of 1.9cm. Secondly, a translation was found between the posture camera and the tip of each of the walker handles. This was obtained by using a stick with an ArUco marker whose tip was placed on the desired handle position and the marker rotated over multiple frames (Figure 3.5a). The tip position relative to the posture camera was then found by solving a system of equations for the center of a sphere created. (a) (b) Figure 3.5: a) Sample frames used for extrinsic calibration between the posture camera and the walker’s handles, using a stick with an ArUco marker with the tip placed on each handle (the yellow circle marks the projected 3D points calculated in the image frames, and the ArUco referential calculated using OpenCV is also shown). b) Sample frames for the posture and gait cameras when performing the extrinsic calibration, using a checkerboard between them. Only a small percentage of the frames overlap and only for objects relatively far. 3.2.4 Data Preparation The data obtained from the Xsens is temporally synchronized and spatially correlated with the camera streams with the processing steps described next. These can be summarized on the diagram in Figure 3.6. 35 Chapter 3. Materials and Methods Figure 3.6: High level diagram of the processing steps applied to the raw data in order to obtain a usable dataset. Data obtained from the Xsens and RGB+D cameras is temporally aligned using respective timestamps, and then aligned spatially using the extrinsic calibration and the prop sensor. The data samples from the Xsens and both of the walker RGB+D cameras were synchronized offline in time using timestamps saved during data recording for each of the modalities, in addition to the hardware trigger sent by the walker to the Xsens base to start the data acquisition. This process also sub-samples the Xsens skeleton data to 30Hz to match the samples from the camera streams (no filtering was performed since no high frequency components were present in the signal and components relevant for walking are found bellow 3Hz [20]). The Xsens uses a stationary world frame, where the user walks around. In contrast, from the walker cameras’ perspective, the user’s position while walking along with the walker, is more or less stationary. To relate skeleton information in space with the camera’s referentials a set of transformations needs to be applied for each timestep: i) first, the root joint is centered in the origin of the referential, making it stationary in relation to the camera; ii) then, a referential rotation is applied, which turns the referential to a camera-like, where the z-axis has the meaning of ”depth from camera” instead of ”up”; iii) next, a rotation is applied, which orients the skeleton referential to the posture camera’s referential. This rotation was obtained by placing an additional Xsens sensor on top of the posture camera during acquisition; iv) finally a translation is applied, which places the wrists of the skeleton in the position of the tip of the corresponding walker handles (in the posture camera’s referential). The offset was obtained through the extrinsic calibration. The skeleton normalization process is summarized in Figure 3.7. 36 Chapter 3. Materials and Methods Figure 3.7: Transformations to spatially align the Xsens skeleton data from a world referential to the walker’s posture camera referential. Data is shown in 3D space along with the 3D pointcloud for reference. With the skeleton aligned in 3D space with the posture camera, it is possible to obtain 2D keypoint positions in the camera image frame by projecting each of the points to 2D using Pinhole camera model. This process was used to obtain 2D keypoint labels for the RGB and Depth image frames for both cameras. It should be noted that, before projecting the gait camera’s information, the extrinsic transformation, from the posture to the gait camera referential, needs to be applied. Since the dataset contains the depth information, it is straightforward to obtain a fused colored pointcloud with data from both cameras. This involves projecting the depth (and, optionally, the corresponding color) frames to 3D space using the camera intrinsic parameters for each of the cameras, then applying a referential transformation to put the gait data pointcloud in the posture camera referential. 3.2.5 Dataset The dataset contains a total of 166K frames of synchronized data sampled at 30Hz, which amounts to 92min of total recording time. This data is composed5of the RGB frames and registered Depth 5Additionally it is also possible to access sensors raw data: free acceleration, magnetic field, and orientation; and data obtained from the Xsens software’s biomechanical model: segments’ orientation, velocity, acceleration, and angular velocity and acceleration; and joints’ angle, however this data was not used in this study. 37 Chapter 3. Materials and Methods frames from both cameras, the Xsens Skeleton keypoints in 3D space and the projected Skeleton keypoints in 2D space for each of the cameras, and, optionally, the merged Pointcloud. A sample of data for each data type, compared to the real world , can be seen in Figure 3.8): Figure 3.8: Outside view of the walker taken from a smartphone (leftmost image) and samples of data of each modality contained in the walker dataset (from left to right): RGB frame overlaid with projected 2D skeleton; and Depth frame overlaid with projected 2D skeleton; merged pointcloud overlaid with 3D skeleton (data from the gait camera is transformed, through an extrinsic transformation, to the posture camera’s referential). The data distribution of the participants contained on the dataset is summarized in Table 3.1. Table 3.1: Metadata of the participant’s contained on the walker dataset. Participant ID Gender (M/F) Age (years) Body mass (kg) Body height (cm) Num. of Samples 00 M 23 63 180 12993 01 F 24 51 151 11244 02 M 22 89 185 12558 03 F 28 70 159 11895 04 F 27 53 157 11793 05 M 30 68 172 9375 06 M 28 75 185 12849 07 M 24 86 170 12399 08 M 24 73 170 10872 09 M 26 84 175 9699 10 M 23 64 172 12990 11 M 26 64 175 11952 12 M 26 74 182 12900 13 F 24 63 171 12261 Total: (10 M, 4 F) 25.4 (±2.31) 69.7 (±11.4) 172 (±10.2) 165780 An additional set of trials were obtained from 4 of the subjects (with IDs: 03, 10, 11, 12), who were 38 Chapter 3. Materials and Methods detection accuracy and robustness [54]. 3.4.2 3D-Stage The second stage of the model follows a lifting approach, which takes the 2D keypoint detections from first stage and regresses the 3D keypoint positions in space using stacked residual FC modules proposed by Martinez et al. [77]. Initially, a normalization is applied to the 2D keypoint locations, which converts them from the pixel location (u,v) to normalized pixel space (unorm vnorm), while maintaining the image aspect ratio, using the formula on Equation 3.2. This increases training stability and generalization to different input frame resolutions. Additionally, the depth information at each pixel location was also given, which helps to resolve ambiguities and ease the learning problem of point projection, however, it might make the model more susceptible to depth data noise. This version used only 256 features per layer, since the original 1024 features were considered excessive for this problem.   unorm vnorm  =2 W×  u v  −  1 H W  (3.2) It should also be noted that the depth information contains a discontinuity since two different cameras were used for the upper and lower body joints. The model has to learn to deal with this discontinuity by constructing an internal extrinsic representation. The detection could have benefited from using the segment lengths information, predicting only the joint angles instead, which would be especially helpful in penalizing bad angles in shorter limbs ( e.g. feet). However, this has been shown to give inferior results, given the higher non-linearity [58], and thus, discarded over the positional approach. 3.5 Losses The 2D stage of the model was trained using the integral loss proposed by Sun et al. [59], which minimizes the MAE between predicted 2D keypoint locations (Equation 3.3) and corresponding labels in image space, combined with heatmap regularization through MSE loss, which is applied to both keypoint (branch + refined) and connection heatmaps (Equation 3.4). According to the authors, slightly better results could be achieved by first training only with the regularization heatmap loss, in order to obtain better defined Gaussian maps, and then fine-tuning with the full loss for decreased positional error. Nevertheless, 45 Chapter 3. Materials and Methods in order to reduce training times due to the limited hardware/time available, only the complete loss was used for training. L(Kp2D,Kp0 2D)=1 CKp CKp X i |Kp2D(i)−Kp0 2D(i)|(3.3) L(hmap,hmap0)=1 CHW CHW X i (hmap(i)−hmap0(i))2(3.4) The 3D stage was trained with a Log-Cosh loss between 3D keypoint positions and corresponding labels (Equation 3.5), while keeping 2D stage layers frozen. This loss combines the outlier robustness of the MAE loss with the diminished update size for small error of the MSE loss. This choice is supported by Gonzalez et al. [86], which use the similar Smooth MAE loss with superior results than the standard MSE/MAE losses. L(Kp3D,Kp0 3D)=1 CKp CKp X i log(cosh(Kp3D(i)−Kp0 3D(i))) (3.5) 3.6 Data Post-Processing The predictions produced by the complete model, although coherent (if trained properly) at each frame, contain no temporal information, resulting in high frequency positional jittering, when applied over a sequence of frames, producing not only visually unpleasant feedback, but also incorrect joint kinematics, which might be incompatible with downstream applications. In order to correct this, a similar approach to Mehta et al. [19] was taken, by running a first order low-pass filter (One-Euro-Filter) [91] as a postprocessing step on top of the model predictions. This filter was specially designed for high responsiveness and low computational cost, in real-time applications, displaying good empirical results, despite its simplicity, even when compared to complex model-based alternatives ( e.g. Kalman Filters). Its main feature is the use of a cutoff frequency, which adapts to the input signal, decreasing for slow movements, in order to reduce jitter, or increasing for faster signals to reduce lag. The filter was applied to both the 2D and 3D keypoint outputs produced by the complete model, however, internally, the 3D-Stage still uses the unfiltered 2D predictions, since the introduction of lag here was undesirable, as it would result in cumulative amount of lag in the processed 3D output. Two parameters were set empirically for the filter, namely the minimum allowed cutoff frequency (fcmin) and the adaptive cutoff rate (β). Values of fc2D min = 1.0/β2D= 0.1were set for the 2D-Stage 46 Chapter 3. Materials and Methods and fc3D min = 1.5/β3D= 0.15 for the 3D-Stage, respectively, balancing a reduction of prediction noise, while maintaining responsiveness and higher frequency dynamics. 3.7 Model Deployment After offline training, the model was exported from the Python/Pytorch [109] environment used for training, to ONNX 7, which is an open source and widely supported framework focused on model inferencing for production. This allows the model to be used with minimal dependencies in different programming environments, simultaneously offering multiple optimization tools to decrease run-time latency. The exported model was then transferred to the walker, where it was loaded using the ONNXRuntime8 library’s C++ API (default CPU build). This library provides multiple tools for, not only loading and running the models, but also to perform general and hardware specific run-time optimizations: pre-computing of constant values/tensors, removal of redundant nodes necessary during training ( e.g. dropout, identity, etc ...), common node fusion into single operations ( e.g. convolution + batch normalization + ReLU can be applied as a single operation), data layout and memory access pattern optimizations. AROS wrapper package was created to interface the deployed model with the existing software running on the walker. It subscribes the camera RGB+D streams being published by both of the walker’s cameras, processes the data following the pre-processing described in Section 3.3, runs inference using the model, obtaining keypoint predictions, both in 2D and in 3D spaces, along with the detection confidence and publishes this information to the system, where other packages can use it. Some attention was also given to the operations supported by the inference engine, which were not as general as the ones on the training environment. This implied dropping the full EfficientNet backbone, in favor of the lite variants, given the bad support for the SE modules and Swish activation functions. 7https://github.com/onnx/onnx 8https://github.com/microsoft/onnxruntime 47 Chapter 4 Experimental Protocol The following chapter specifies all the implementation details involved in actually training (Section 4.1) and evaluating (Section 4.2) the models proposed, while exploring some alternative approaches which were also considered (Section 4.3). 4.1 Implementation Details All models in this chapter were developed offline, with the collected data, using the Pytorch [109]DL library on a Python environment, and trained on a Google Colab instance (3.1). Reasonable hyper-parameters for training were found empirically and kept constant for all the combinations of models tried. The AdamW [110] optimizer was selected with an initial learning rate of 2e-3 which was decayed to 1e-5 over 30 epochs using a cosine-annealing schedule [111]. A batch size of 16 and 32 were respectively used to train the 2D and 3D stages of the model. Gradient clipping [88] with a range of [-0.2, 0.2] was applied during training for all models. This helps to prevent very high gradient updates specially on the first batches of training which could destroy some of the pre-trained weights, while also being overall beneficial to prevent possible exploding gradients caused by outlier predictions. All convolutional and FC layers, expect for the outputs, were followed by batch normalization [112] and a ReLu non-linearity [39], following the general DL literature. At the end of the training the best model was selected according to the validation loss. Models were trained in 2 separate steps. First, only the 2D-Stage was trained, using as input the image and depth frames and producing as outputs the intermediate 2D features: keypoint locations in image space, the keypoint heatmaps and the connection heatmaps. The 3D-Stage of the model was then 49 Chapter 4. Experimental Protocol trained in a second step, by using the 2D features produced by the 2D-Stage, which was kept frozen, and outputting the 3D keypoint positions. A final fine-tuning training was performed with the full model end-to-end but this did not seem to improve performance while showing signs of increased over-fitting, so this step was not performed by default. Regularization Random train-time data augmentation was applied in order to increase visual variability in the training set, which aims to decrease over-fitting due to the limited number of samples, for the image frames. This included common operations like noise insertion, information erasing, kernel blurring, color inversion, color equalization, random brightness and contrast [113]. However, the depth frames cannot be augmented with most of these operations as it would produce incorrect depth information, so here only information erasing in the form of dropout was applied. Occlusion specific augmentation was also applied following the method of Sárándi et al. [114] which adds random occlusion objects from the Pascal Voc challenge [115] to the image frames, while the depth pixels occluded were dropped. Additionally, when training only the 2D-Stage, slight affine transformations (shift, scale, rotate) were applied in order to decrease over-fitting to frequent keypoint locations found on the walker dataset, and although this produces slight incoherence depth values, it yielded better detection results overall. Additional train-time regularization was applied to most layers of the model in the form of dropout [116], with percentage of 50% for all the FC layers and spatial-dropout [51] with a probability of 20% for the convolutional layers. A weight decay parameter [117] with a value of 1e-5 was also added. Transfer Learning Given the relatively small amount of training data (compared to HPE benchmarks), and specially its low variability, transfer learning techniques were used in order to improve performance: First, the backbone weights were initialized to the weights of models pre-trained on the general object classification benchmark -ImageNet [26] to great accuracy using large amounts of computational resources, which trains the network to detect and produce general features, which were shown [27] to correlate to increased performance on new domains. A backbone trained on general human pose detection datasets would have been preferable, however no suitable option was found for the chosen backbone. Next, a large HPE pre-training dataset was considered in order to first develop the algorithms created while also serving as a base to later fine-tune on the data collected with the walker. It requires a choice which not only has to contain compatible modalities, namely RGB and Depth data synchronized with 50 Chapter 4. Experimental Protocol skeleton keypoint data, but also: i) feature multiple sequential video frames, as opposed to single pictures, since a temporal component should be investigated for the final application; ii) feature only a single subject performing activities since the walker will always focus only on the patient using it; iii) it should not contain visual markers which could bias the model when detecting the limbs; and iv) should contain feet data, as opposed to most datasets which only consider the ankle joint [53], as it is necessary for complete gait analysis [1]. None of the pretraining dataset options (Sections 2.3.5) were considered completely satisfactory. From the ones identified, the NTU_RGBD [98] dataset was selected. Despite the fact that it has lower accuracy joint data and relatively lower pose variations, it contained RGB and Depth information synchronized with the desired skeleton joint configuration and without visual markers and a large amount of samples collected in real-world environments. Some processing was performed in order to filter some bad or unfit trials, namely using only sequences marked as containing a single participant, removing erroneous sequences (for example ”dressing a coat” or ”tying shoes”) which were captured incorrectly and would produce bad labels for training, as well as samples from a camera placed sideways to the subjects due to bad labels from body occlusions. For each of the frames, the bounding-box around the subject was selected 1in order to make it appear more similar to the custom data acquired from the walker. Due to the computational resources available, only a small subset of this dataset was used, which amounts to 150k filtered frames of data sampled at 30Hz. Although this dataset contains people completely visible on a single camera (unlike in the walker setup) and the skeleton data is not too accurate since it comes from the Kinect skeleton tracking SDK, it was still considered that it could be beneficial as an initialization step. Samples of this data are shown in Figure 4.1. A different dataset with higher degree of pose variability would have been preferred, however none of these contained all the modalities which were considered important, namely the RGB+Depth frames without visual markers and skeleton data with complete feet information. The keypoints from this dataset were selected and reorganized in order to correspond to the selected keypoints of the processed walker dataset. 1The cropping was performed by fitting a rectangle with the desired dimensions around the subjects’ labeled 2D keypoints in the frame 51 Chapter 4. Experimental Protocol Figure 4.1: Samples of data in the NTU_RGBD dataset used for pre-training the models (from left to right): Image, depth, stacked keypoint heatmaps and stacked connection heatmaps. While training the models on new datasets, all the backbone weights were kept constant as training the full backbone would lead to loss of generability and potentially to over-fitting to the train set due to its higher capacity, with the exception of the fine-tuning step on the walker dataset, where the last few layers of the backbone were also trained. 4.2 Performance Metrics The models were evaluated using commonly metrics in the HPE literature [11], [46], [57], [93]: Mean Per-Joint Position Error (MPJPE) Average Euclidean distance between a GT position and a predicted position for each of the keypoints is calculated after performing root joint alignment (in this case the pelvis). This metrics evaluates the relative body configuration of limbs relative to the root and is the most common metric for HPE. It will also receive the most focus through this dissertation, since most applications use root-relative joint positions. Procrustes-Aligned-MPJPE (PA_MPJPE) Similar to MPJPE but Procrustes analysis is performed on the predicted keypoints instead of just aligning roots. This method applies a rotation, scaling and translation which best matches both skeletons, ignoring existing affine errors and focusing only on the normalized relative pose configuration. This was computed only for the 3D space. Absolute-MPJPE (A_MPJPE) Similar to MPJPE but uses absolute positional values (without performing the root alignment). This metric can be calculated for 3D (metric units) and for 2D (pixels units). The latter is commonly just referred to as MPJPE_2D. Percentage of Predicted Keypoints Percentage of Correct Keypoints (PCK) whose distance to target is bellow a certain threshold. A threshold of 75mm was selected for all 3D tests following the 52 Chapter 4. Experimental Protocol problem specifications (Section 1.5). This metric was also evaluated in 2D where a threshold of 6 pixels was selected (it should be noted that in this case the value will depend on the image frame resolution, which was maintained constant in all tests: (128, 224)) and can be seen in Figure 4.2. The threshold was set by trial and error. This metric evaluates the percentage of keypoints which are near the correct location, removing penalization from predicting slightly different locations which are still in a valid region. A version with Procrustes alignment (PA_PCK) and absolute values (A_PCK) were also computed. Figure 4.2: PCK radius threshold of 6 pixels selected. Values inside the circles, for each keypoint, are considered correctly detected. Inference Time (Latency) was evaluated since all models will run on constrained hardware which needs to process data in real-time. This metric was evaluated on a Nvidia Tesla T4 GPU available on Google Colab and on a laptop’s Intel i7 - 4720HQ CPU. It refers to the time necessary to load the inputs into the device and do a forward pass for a single data sample. The results were obtained by running inference on all the test samples, which amounts to roughly 12k samples. Model Complexity (#Params) provides a count of the tunable parameters present on the model and is a standard metric to evaluate its learning capacity, while also correlating with latency. Qualitative Visualization, provides a fast and intuitive way to analyse the model’s performance relative to the labels. The outputs from the 2D-Stage are visualized using both the stacked keypoint and connection heatmaps and the keypoint locations and connections, overlaid on the input image frames using OpenCV. The outputs from the 3D-Stage were visualized using a 3D OpenGL visualizer which renders the keypoints and respective connections, and optionally the pointcloud. 3D keypoint trajectory plots were also used, over the anatomical planes for a deeper analysis in some cases. When deployed on the walker, 53 Chapter 4. Experimental Protocol the 3D visualizer is replaced with the RViz2package contained in the ROS installation on the system. 4.3 Model Variants Alternative versions of both stages were also explored, based on ideas presented in the literature, and in search of the best model configuration, while respecting the requirements, as follows. These mostly focused on the 3D-Stage. 4.3.1 2D-Stage Split Stream An alternative to the default 2D-Stage (Section 3.4.1) was tried, with a simplified version of the architecture proposed by Hazirbas et al. [118]. Two separate backbones are used to process the depth and RGB information, given the different modality properties which should be interpreted differently, extracting richer features since they do not have to be combined in the initial convolutional layer like in the default method. The multi-resolution features from both encoders are passed as skip connections to the two decoder branches. Nevertheless, given the double amount of layers in the backbones this method is computationally more expensive, although with higher learning capacity. 4.3.2 3D-Stage Baseline The baseline method uses the original model proposed by Martinez et al. [77], which is similar to the default 3D-Stage method described in section 3.4.2. However, it does not receive the depth information as input to perform the lifting, using only the 2D keypoint locations. The original 1024 channels per layer were used in this case. Semantic Graph Convolution Networks The SemGCN proposed by Zhao et al. [78] was tried, with the addition of the depth information for each keypoint as input. This module exploits the hierarchical joint structure of the skeleton by using state- of-art graph convolutions which aggregate information along connected joints. The non-local layers used on 2https://github.com/ros-visualization/rviz 54 Chapter 5. Results mance was encountered for all models. Table 5.1: Results summary of the 3D-Stage and comparisons against the different variants for regression from the 2D-Stage keypoints. The best results are highlighted in bold. Method MPJPE(mm) PA_MPJPE(mm) PCK@75(%) GPU latency(ms) CPU latency(ms) #Params 2D-Stage + Default 3D-Stage 44.05 ± 0.39 33.35 ± 0.29 83.03 ± 0.48 13.43 ± 0.03 38.93 ± 0.13 1.34M + Baseline 45.80 ± 0.40 34.78 ± 0.31 81.31 ± 0.5 14.68 ± 0.04 41.28 ± 0.10 5.34M + SemGCN 45.85 ± 0.42 34.80 ± 0.31 81.45 ± 0.51 19.21 ± 0.03 43.86 ± 0.15 1.31M + Projection_Residual 48.35 ± 0.44 36.76 ± 0.39 79.88 ± 0.49 14.50 ± 0.02 39.18 ± 0.12 1.34M 5.1.3 Temporal Filter The proposed model produces visually reasonable results at each frame, however, since the model has no information about previous predictions, when applied to a video sequence, it produces temporally incoherent results in the form of position jitter in the area around the keypoint location, visible both in the 2D and 3D predictions. The application of the One-Euro-Filter described in Section 3.6 is capable of countering this. Keypoint positions obtained from the raw NN model prediction and with the temporal filter post-processing are compared in the sagittal plane over one gait cycle in Figure 5.4 and to the GT Xsens data. The filter is entirely capable of running in real-time, with a processing time of 0.1ms, removing high frequency noise from the single frame model predictions, which would otherwise produce wrong joint dynamics (as can be visualized in the zoomed region). However, it attenuates some natural higher frequency dynamics. 5.1.4 Benchmarking and Ablation Studies Multiple ablation studies were conducted by removing certain components of the proposed solution, to try to identify the contribution of each for the overall results, the findings are described on the next section, together with a comparison benchmarking of the alternative model variants explored in Section 4.3 Input Modalities The proposed model is not too dependent on any of the two input modalities (image, depth). It is robust to corruption of one of the input frames, giving reasonable predictions by focusing on information 61 Chapter 5. Results from the other, even though not being explicitly trained to do so, examples of this can be seen in Figure 5.5. Figure 5.5: Results obtained when removing information from image (upper panel) and depth (lower panel) inputs. The image / depth inputs for each experiments are grouped in the left side, while the corresponding model predictions (keypoint heatmaps, connection heatmaps, 2D keypoints, 3D keypoints) are grouped in the right. 2D outputs were overlaid on the image input. 3D GT keypoints keypoints are shown overlaid with higher transparency. The model appears to be more affected by corruption of the depth input, giving low confidence detections on the heatmaps with also higher degree of keypoint error in the 2D space. Nevertheless, even without the depth information, the it is still capable of regressing the positions of the 3D keypoints. On the other hand, it seems to be less affected by corruption in the input image, as the heatmap predictions still display a well defined shape, with high detection confidence. Nevertheless, in both cases, a higher degree of position jittering over multiple frames is reported from the raw NN predictions, which can be reduced to some extent by the temporal filter. 2D Backbones The chosen EfficientNet-lite0 backbone performance was analysed against the more commonly used ResNet architecture in Table 5.2, in terms of accuracy and run-time performance. Moreover, the Split- Stream variation (Section 4.3.1) was also compared. Since a significant portion of the processing power is spent on the 2D-Stage, it is necessary to not only select an accurate architecture, but also take into consideration its latency, especially targeting the CPU. 62 Chapter 5. Results The commonly used OpenPose [53], was also considered for the 2D stage, as it boasts good performance with real-time inference, which was found to be true when running the model on the GPU. However, this option was quickly dropped after checking the latency on the CPU, where the authors point to a latency around 10s to process a single frame, making this option unacceptable for the purpose of this work. Table 5.2: The default EfficientNet-lite0 backbone 2D-Stage performance in comparison with the common ResNet models. OpenPose is also compared in terms of latency for reference (values were taken from the paper), as it is a common baseline on real-time pose estimation. The best results in each metric are highlighted in bold. Method MPJPE_2D(px) PCK_2D@6(%) GPU latency(ms) CPU latency(ms) #Params Default 3.73 ± 0.04 85.27 ± 0.59 11.97 ± 0.03 37.56 ± 0.13 1.05M ResNet50 3.66 ± 0.04 86.93 ± 0.56 15.27 ± 0.04 238.89 ± 0.66 26.8M ResNet18 3.88 ± 0.05 84.65 ± 0.61 11.88 ± 0.03 94.70 ± 0.35 12.1M SplitStream 3.75 ± 0.06 86.45 ± 0.57 17.45 ± 0.07 115.78 ± 0.38 1.9M OpenPose[53] - - ≈36.00 ≈10396.00 - All models achieved a similar detection error around 3.75 pixels, with slightly better results for the ResNet50 backbone (3.66 MPJPE_2D). However, it displayed a significantly larger latency (238.9ms), being 6.36x slower when processing in CPU compared to the default EfficientNet-lite0 option (37.56ms), which displayed the best computation time in the CPU, being faster than the light ResNet18 (94.7ms) by 2.5x while slightly more accurate. The SplitStream architecture displayed comparable detection performance to the default option, although with much higher latency (115.78ms). Refine module The addition of the refine module was evaluated for the default 2D-Stage in terms of 2D detection error and latency. Additionally, since only the keypoint heatmaps are necessary to extract the keypoint locations, which can be extracted directly from the heatmap branch in the case where the refine module is not used, it is possible to completely ignore the computation of the connections branch in order to increase run-time performance. The Table 5.3 compares the detection results of using or not the refine module on the default 2D-Stage and after entirely removing the connections branch. 63 Chapter 5. Results Table 5.3: Importance of the refine module on the 2D-Stage accuracy and latency. Its effect is investigated by removing the refine module and obtaining the 2D keypoint locations from the keypoint heatmaps branch, and by further removing the parallel connection heatmap branch. The best results in each metric are highlighted in bold. Method MPJPE_2D(px) PCK_2D@6(%) GPU latency(ms) CPU latency(ms) #Params Default 2D-Stage 3.73 ± 0.04 85.27 ± 0.59 11.97 ± 0.03 37.56 ± 0.13 1.05M - Refine Module 4.37 ± 0.10 81.92 ± 0.71 11.02 ± 0.02 31.90 ± 0.10 1.01M - Connections Branch 4.37 ± 0.10 81.92 ± 0.71 9.07 ± 0.04 25.89 ± 0.07 0.93M Removing the refine module yields a 17% increase in the MPJPE error which is traded for an also 17% decrease in latency, which is improved further by 45% after removing the connection branch altogether. Projection residual Figure 5.6 depicts the results obtained from directly projecting the 2D keypoint locations with the depth information to 3D space using the camera Pinhole model with the camera parameters (a method similar to the current solution found in the walker) to obtain the 3D keypoint locations (5.6a), as well as the results obtained after applying the residual learned correction (5.6b) described in Section 4.3.2. (a) (b) Figure 5.6: a) 3D skeleton obtained through keypoint depth projection using the camera Pinhole model (the leg/feet keypoints were transformed to the posture camera’s referential using the known extrinsic transformation). b) The skeleton obtained after the residual correction step of the Projection_Residual method. The errors obtained are further compared to the default 3D-Stage, in Table 5.4, where 2D GT keypoints from the Xsens are used instead of those predicted by the 2D-Stage, in order to obtain a clearer comparison of only the 3D regression error. 64 Chapter 5. Results Table 5.4: Default 3D-Stage lifting approach comparison with the 2D keypoint locations projection using the pixel depth and the camera Pinhole model (Projection_Raw), and by further processing using the residual correction neural network in the Projection_Residual method. The 2D keypoint location labels were used as input to the regression in all methods. The best results in each metric are highlighted in bold. Method MPJPE(mm) PA_MPJPE(mm) PCK@75(%) CPU latency(ms) #Params Default 3D-Stage 36.65 ± 0.28 28.11 ± 0.24 90.64 ± 0.34 1.03 ± 0.0 0.29M Projection_Raw 226.0 ± 4.82 179.97 ± 3.11 21.84 ± 0.33 1.13 ± 0.0 0 Projection_Residual 43.42 ± 0.41 33.56 ± 0.37 84.72 ± 0.45 2.27 ± 0.0 0.29M The raw projection method displays a larger error, above 200mm, with only 21.8% of predictions having an error bellow the desired threshold of 75mm. The residual correction is capable of improving the detection substantially, to an error around 43.4mm with a 84.7% of keypoints within the detection threshold, although, still higher than the lifting approaches. 3D-Stage Only The results from the 3D-Stage (and variants - Section 4.3.2) were evaluated independently from the errors of the 2D-Stage. By using the 2D location labels as input for the regression, these should provide the maximum performance achievable given a ”perfect” 2D-Stage and allowing a comparison with less noise. The results are also compared to the default complete model in Table 5.5. Table 5.5: Result summary of the default 3D-Stage and lifting variants when receiving as input the GT 2D keypoint locations. The default 3D-Stage error when regressing from the 2D-Stage predictions is shown as reference. The best results in each metric are highlighted in bold. Method MPJPE(mm) PA_MPJPE(mm) PCK@75(%) CPU latency(ms) #Params 2D-Stage + Default 3D-Stage 44.05 ± 0.39 33.35 ± 0.29 83.03 ± 0.48 38.93 ± 0.13 1.34M 2D-GT + Default 3D-Stage 36.65 ± 0.28 28.11 ± 0.24 90.64 ± 0.34 1.03 ± 0.0 0.29M + Baseline 36.66 ± 0.28 26.91 ± 0.23 90.75 ± 0.34 3.98 ± 0.0 4.29M + SemGCN 35.22 ± 0.28 26.25 ± 0.25 92.59 ± 0.34 4.38 ± 0.0 0.27M + Projection_Residual 43.42 ± 0.41 33.56 ± 0.37 84.72 ± 0.45 2.27 ± 0.0 0.29M In general, all lifting methods displayed a similar level of performance (around 36mm MPJPE) with a low latency time (<4.38ms). The SemGCN variant obtained overall the best results, while the projection residual approach obtained once again the largest error. An almost 8mm higher MPJPE (36.65mm) was obtained when lifting from the 2D-Stage keypoints, compared to using the 2D GT keypoints (44.05mm). 65 Chapter 5. Results The error for the default 3D-Stage was analysed further on the Boxplots in Figure 5.7 for each keypoint. Figure 5.7: Boxplot error for each individual keypoint, across all test frames, with absolute values relative to the camera (lower plot) and after root joint alignment (upper plot), for the default 3D-Stage model (extreme outliers were removed for better visibility). The dashed line marks the 75mm threshold imposed. Although the leg and feet keypoints are in most cases detected on a different image reference frame from the torso keypoints, given that the image frames were obtained from different cameras, the lifting models are capable of internally finding a way to relate the information without the need of explicitly 66 Chapter 5. Results providing the extrinsic transformation between camera frames and presenting it in the posture’s camera referential. Pre-Training The effect of the pre-training on the NTU_RGBD dataset for 10 epochs with subsequent fine-tuning on the walker dataset for 20 epochs, was compared to the performance obtained from just training on the walker dataset for 30 epochs. The results are evaluated for the 2D-Stage, only 3D-Stage and the complete model and are resumed in Tables 5.6 and 5.7. Table 5.6: Result summary of the default 2D-Stage with and without pretraining on the NTU_RGBD dataset with further fine-tuning on the walker dataset. The best results in each metric are highlighted in bold. Method MPJPE_2D(px) PCK_2D@6(%) Default 2D-Stage 3.73 ± 0.04 85.27 ± 0.59 - Pretraining 3.83 ± 0.04 84.12 ± 0.61 Table 5.7: 3D results obtained using the default model with and without pretraining on the NTU_RGBD dataset with further fine-tuning on the walker dataset, from the 2D keypoint location predictions of the 2D-Stage and labels. Method MPJPE(mm) PA_MPJPE(mm) PCK@75(%) Default Only 3D-Stage 36.65 ± 0.28 28.11 ± 0.24 90.64 ± 0.34 - Pretrain 39.66 ± 0.31 30.00 ± 0.41 88.20 ± 0.37 Default Complete Model 44.05 ± 0.39 33.35 ± 0.29 83.03 ± 0.48 - Pretrain 45.79 ± 0.40 33.90 ± 0.30 81.63 ± 0.49 Slightly better results were obtained by first pre-training the models, resulting in a lower average error of 0.1 pixels in the 2D-Stage, and 1.74mm for the complete model. Temporal Model The results obtained using the spatio-temporal stages described in Section 4.3.3 were compared next, starting with the 2D-Stage in Table 5.8 and the 3D-Stage (from 2D keypoint predictions and GT) in Table 5.9 Table 5.8: 2D-Stage results obtained using the temporal model with 4 sequential frames, compared to the default single frame version. Method MPJPE_2D(px) PCK_2D@6(%) GPU latency(ms) CPU latency(ms) #Params Single(1 frame) 3.73 ± 0.04 85.27 ± 0.59 11.97 ± 0.03 37.56 ± 0.13 1.05M Sequential(4 frames) 4.13 ± 0.06 83.41 ± 0.63 51.13 ± 0.05 554.08 ± 2.07 1.40M 67 Chapter 5. Results The 2D spatio-temporal model obtained slightly worse detection results, with a 2D MPJPE of 4.13 pixels, while being noticeable slower to compute, specially on the CPU, taking 554ms to process 4 frames, compared to the single frame counterpart. Table 5.9: 3D results obtained using the temporal model with 4 sequential frames, compared to the proposed single frame version, from the 2D keypoint location predictions of the 2D-Stage and labels. The best results in each metric are highlighted in bold. Method MPJPE(mm) PA_MPJPE(mm) PCK@75(%) GPU latency(ms) CPU latency(ms) #Params 2D-Stage + Single(1 frame) 44.05 ± 0.39 33.35 ± 0.29 83.03 ± 0.48 13.43 ± 0.03 38.93 ± 0.13 1.34M + Sequential(4 frames) 46.72 ± 0.56 34.93 ± 0.41 82.61 ± 0.51 52.50 ± 0.06 554.86 ± 2.45 1.98M 2D-GT + Single(1 frame) 36.65 ± 0.28 28.11 ± 0.24 90.64 ± 0.34 1.31 ± 0.00 1.03 ± 0.0 0.29M + Sequential(4 frames) 36.49 ± 0.29 28.79 ± 0.23 91.01 ± 0.36 1.77 ± 0.00 1.60 ± 0.0 0.58M The 3D-Stage yielded similar performance to the default single frame version, being marginally worse when using the predictions from the 2D-Stage, given the slightly worse results obtained by the sequential 2D-Stage. The latency of the temporal 3D-Stage is slightly higher than the single frame model but it is overall faster since 4 frames are processed simultaneously. Additionally, the sequential predictions yield temporally coherent results with no jittering when applied to video streams, without requiring the post-processing temporal filter introduced in the single frame counterpart, while introducing no lag. 5.2 Walker Deployed The complete default model was exported and optimized using the ONNXRuntime library. This increased the run-time performance in the CPU, from the original 38.9ms on the Pytorch environment used for training to 23.1ms after applying all available optimizations with an additional 3.5ms to pre-process the input frames for the model, while keeping the same detection error. When running the solution integrated on the ROS environment, during normal utilization of walker, the latency was higher, averaging around 40ms, with higher variability, ranging from 25ms to 70ms due to all other processes being run concurrently on the constrained system. Some constant lag (around 400ms) was also noticed when publishing the detected keypoints’ information for other modules given the asynchronous nature of the underlying ROS system in the equipment. The deployed model on the functioning walker was evaluated qualitatively during normal use through multiple observations about its performance, as follows: 68 Chapter 5. Results During normal walking the model performs well, being capable of detecting the 2D keypoint locations (Figure 5.8a) with good accuracy and correctly regressing the 3D keypoint locations producing a coherent output (Figure 5.8b). Only a visual evaluation is considered, both in terms of positional offset in space relative to the walker and the subjects pose. (a) (b) Figure 5.8: Predictions obtained from the model running on the smart walker, in 2D (a) and 3D (b) spaces. Connections between the hips and legs are not rendered in 2D due to the discontinuity between camera frames. The 3D visualization used the RViz package from the ROS environment to render the 3D keypoint locations relative to the walker. The posture camera’s frame of reference is also displayed. The model performs sub-optimally when confronted with body configurations which lie outside the normal training distribution, for example when walking on the sides of the walker, bringing the feet high above the ground, complete feet occlusion, to name a few. The produced output in 3D space shows clear signs of over-fitting on some keypoints, namely the wrists, which are always predicted to be in the walker handles as long as some reasonable 2D prediction has been made. The hips are always facing forward, even if the user is rotated. 69 Chapter 6. Discussion specially in the CPU, which made them unpractical for this application. This could have been alleviated by the use of separable temporal convolutions following the work by Tran et al. [120]. When processing on a GPU, the temporal model achieves similar run-time to the single frame version, taking 4.5x longer to simultaneously predict 4 frames, making it a more reasonable solution. 6.3 Deployment The model worked as expected on the smart walker (Figure 5.8b), running in real-time while displaying similar detection performance (qualitatively speaking) compared to the dataset test samples, when dealing with common walking situations used for training. However, the performance degraded when presented with situations outside the training distribution, emphasising the need to fully benchmark deployed solutions for real usage, and outside of a limited dataset and exploring its limitations. The produced output in 3D space shows clear signs of over-fitting on some keypoints: i) specially the wrists, always predicted to be in the walker handles as long as some reasonable 2D prediction was made, which is expected, since their positions were almost stationary in the dataset, resulting in a majority of cases where model would just predict almost constant positions, on the 3D-Stage (the geometric augmentations in the 2D-Stage training mitigate this problem) , even if the hands were moved; ii) The hip predictions will always be facing front direction, even if the subject rotates in reality, as the collected data only contemplates samples with people facing the walker directly while walking normally; iii) The feet are always predicted to be close to the ground, as during the trials, the subjects feet are never far from the ground; iv) The feet orientation angles display a limited range, facing mostly forward, as during normal walking, the feet do not deviate much from this direction. Nevertheless, these problems are not verified during usage of the walker, with people walking normally. These limitations could be corrected by training with data with higher positional variability on all keypoints, as proposed earlier. Since a patient is always grabbing the walker handles, the wrist keypoints could be ignored on our model, slightly reducing the computations. But wrist predictions by the 2D-Stage were maintained as they can be used as a safety measure to confirm the handles are being grabbed, by looking at the detection confidence on the 2D-Stage, which would drop considerably when the patient moved them away. When running the pose estimation solution as the only process on the walker equipment, its latency was slightly lower than on the laptop used to benchmark the models with (-2ms on average). However, increased latency and constant lag were reported when running the full solution on the equipment during normal usage, due to the asynchronous nature of the underlying ROS software and all other processes 77 Chapter 6. Discussion being run concurrently on the constrained system. This means that much faster results would not be possible by solely decreasing the NN model latency, but would require an update to the hardware capabilities and/or underlying software used. Some model ideas had to be changed or dropped entirely, as these were not correctly supported by the ONNX framework (and also most alternatives available), and thus not fit for the deployment scheme used. This included the use of: i) SE attention blocks proposed by Hu et al. [33] for the 2D-Stage, tried initially with promising results in terms of performance with minimal effect on latency; ii) EfficientNet (non-lite) versions, which also used the SE modules; iii) SemGCN [78] modules for the 2D to 3D lifting; Lower latency could have been achieved by compiling the library from source for the target hardware, using specific execution providers, which take advantage of hardware instruction sets to accelerate performance. In this case, the OpenVino 1execution provider by Intel™ could have been used. However, since the walker is still in prototype phase, the more general default provider was preferred. Moreover, quantization techniques [121] were considered for deployment. These change computations from the standard float32 down to int8 precision (or even lower), reducing both memory and computing requirements at a slight decrease in accuracy. However, since latency of the final model was already within the requirements imposed, they were not investigated further. 6.4 Limitations All model training was done on a Google Colab instance (Section 3.1), which offers reasonably powerfull hardware, but introduces multiple problems. Namely, the impossibility to use large scale datasets due to the disk size restrictions and the necessity to manually resume/relaunch training after the time limits. Nevertheless, a working and satisfactory prototype was created, which can be trained/developed further given more data and longer training times. Assuming that the subject’s hands were always placed on the walker handles limited the pool of movements available for analysis, but is consistent with its use by patients in gait rehabilitation, for balance and stability purposes. Alternatively, visual markers could have been placed on both wrists to determine the position offset at all frames. However, the added complexity (i.e. extra setup/processing steps, additional hardware) was deemed unreasonable for the target application. The dataset also contains relatively low variability in terms of poses and their locations on the image frames, limiting its application to general HPE problems. Data augmentation techniques were applied 1https://docs.openvinotoolkit.org/latest/index.html 78 Chapter 6. Discussion to the 2D-Stage to decrease visually and positional overfitting to the common keypoint locations on the image frames, while also collecting an additional 19k frames with irregular walking data which brought some improvements. But nevertheless were not sufficient to combat model overfitting to overwhelming amount of low-variability keypoint locations during walking, which made it unreasonable to explore more complex models and fully train the 2D-Stage, as it would easily overfit. A solution for this problem would involve pretraining each stage or the full model on one of the general HPE datasets discussed earlier [64], [65] and then refine the last few layers on the custom walker dataset. Compared to other walker solutions which are based on depth distance triangulation directly related to physical quantities obtained from the sensors, the use of deep learning approaches offers weaker guarantees about the produced measurements. This happens since the system could just hallucinate predictions inside the data distribution and which, on average, minimize the detection errors. Additional information could have been used in a multi-task setting, in order to simultaneously improve detection performance and also make the model extract additional useful features. Examples include body part segmentation masks and SMPL parameters [84], feet-floor contacts/forces [73] or keypoint occlusions and gait phase events. These could be obtained from a trained model with low additional overhead by adding new output heads which used the existing intermediate features, but would require obtaining the associated labels for training. Gait and Posture metrics were not explored on this work, since the ASBGo already implements these modules, upon receiving the 3D locations of the detected body joints as input. Thus, the focus was given to obtaining the lowest possible detection error, which will ultimately also lead to more accurate metrics. Patient anthropometric information was not used by the models, although it was obtained for each of the subjects as part of metadata in the acquisition protocol and could also be obtained and saved by the clinicians during patient rehabilitation. Thus, it could have been used to constrain the optimization space during the training process [78] or as a post processing step of model-based kinematic fitting in order to decrease detection error and increase robustness [19], producing only anthropometrically valid outputs. Since the backbones were pre-trained on the ImageNet dataset [26] using colored RGB frames, accuracy improvements could be achieved by also feeding RGB frames to this model. Additionally some literature proposes the colorization to the depth maps [122] or extraction of extended features (HHA) [118], before feeding it to the pre-trained backbone. All these approaches could have improved results to some extent, but were not explored due to the added complexity to the project and the additional processing overhead involved. Solutions based on pointcloud data were not explored in this work given the focus on neural network 79 Chapter 6. Discussion approaches which are not as developed for this type of data (especially for latency concerns). However, these provide a natural solution to fuse information from both cameras and work directly in 3D space, which could be used to predict skeleton keypoints using standard techniques similarly to the Kinect skeleton tracking or novel, for example, by using point graph neural networks [123], [124]. 80 Chapter 7 Conclusions A novel full-body pose estimation solution for the ASBGo smart walker was developed. It was able to extract a compact body representation directly from two camera streams in real-time and can readily be used for downstream tasks in Human-Robot interaction applications and Human-in-the-loop control while allowing easy patient monitoring through full-body posture and gait metrics extraction. An extensive review of the literature on HPE, with special focus on DL methods, contributed to understanding, not only, which approaches could yield low detection errors, but also those which could actually be explored given the real-time requirements and hardware limitations. A custom acquisition method was developed in order to provide GT joint data, synchronized with the walker’s cameras. It was created a dataset of 14 subjects performing rehabilitation, each performing 27 trials over 10m, resulting in a dataset of 166k samples used to train and evaluate the DL models offline. A high focus was given to developing methods which can run in real-time. A two-staged approach was favored, running at 25fps (40ms) on the constrained hardware of the walker during normal utilization in a rehabilitation session. First stage focuses on the harder problem of 2D detection by using a fast FCN detector to locate the subject’s keypoints on the image, with an average error of 3.73 pixels. Next, a subsequent residual regression module at the second stage, is responsible to infer each of the keypoints’ depth relative to the walker cameras, where an average error of 44.05mm was reported. Temporal consistency was achieved through the application of a One-Euro-Filter, although introducing some lag on the system. The performance respected all the problem specifications imposed while significantly outperforming the currently implemented solution. Multiple ablation studies were conducted, to try to understand which components were relevant to the final model’s performance. It was concluded that: the use of an accurate and fast feature extraction 81 Chapter 7. Conclusions backbone is quite important in order to simultaneously obtain good results at low latency; the use of an iterative refining architecture is useful for improving results specially in terms of robustness; the dataset used for pretraining did not improve results noticeably pointing out to its inadequacy for the problem, mainly due to lack of movement variability and labeling noise contained. Some alternative ideas were also benchmarked in comparison to the proposed method, by following literature suggestions and in search of the best model. However, no improvements over the simpler baseline deployed were found, possibly due to performance saturation on the dataset. Promising results were obtained on healthy subjects. However more data, with also higher variability is required to train the proposed model to its full potential. Firstly by pretraining on extensive pose estimation datasets, and then with an extended walker dataset also contemplating impaired subjects, in order to access its true performance as a rehabilitation tool in real-world scenarios. The work here presented enables answering the addressed Research Questions (RQs): RQ 1: How to obtain accurate joint data in real world environments synchronized both temporally and spatially with visual information from cameras? A mobile acquisition system was proposed, which combined the use of an inertial MoCap system to obtain accurate joint data, which is synchronized in time using hardware trigger and offline timestamp-alignment, and in space by applying a rotation based on the camera orientation (obtained from an extra IMU sensor) and a translation to place the desired skeleton 3D position keypoints on a visual marker’s position relative to the camera. RQ 2: Is it possible to have a DL approach capable of detecting the user’s body in realtime while running on a constrained device? Results shown that a solution entirely based on DL methods can be developed to run in real-time while showing good HPE performance, with a careful selection of modules used. RQ 3: Can body visual information from complementing cameras be combined to yield a full body representation? Three distinct ways of combining information from complementing cameras were reported with success through this thesis, namely: explicit extrinsic transformation between 3D camera referentials, obtained through stereo calibration; implicitly learning the extrinsic transformation between different referentials from data, given a stationary configuration, as used in the default 3D-Stage; concatenation of image frames fed the 2D-Stage, creating a full image from where spatial relationships can be taken. RQ 4: Is the depth information necessary or beneficial for the HPE task? Empirical results shown that the depth information is not required for 3D HPE task, at least on the dataset investigated. The alternative Baseline approach which received no depth as input, produced similar results to the one with 82 Chapter 7. Conclusions depth, both in terms of root-relative and camera-relative errors. In the case of the 2D detection task, the detection is possible from only image inputs, as evidenced in the literature. Nevertheless, it was shown that a combination of depth and image inputs can increase robustness to environmental conditions, by focusing on the less corrupted channel data. 7.1 Future Work Several improvements were identified along this work, tackling different points. First, it is concerned with the need of more data considering more subjects, bigger variability and the inclusion of pathological gait. An extension to the dataset is already planned, featuring a larger amount of irregular poses, using the same acquisition setup, and with impaired gait of patients during normal rehabilitation sessions. This will yield (after processing using the described method) all the labels necessary for further training the model and allow its evaluation in clinical scenarios. The temporal One-Euro-Filter was capable of removing most of the sequential jittering obtained by the raw predictions of the single frame model with minimal effects in latency. Nevertheless, it introduces some lag which is not ideal for real-time applications. On the other hand, the spatio-temporal CNNs produced smooth temporal outputs without introducing lag, however, their use was limited by the higher latency, specially in the 2D-Stage. An ideal solution to resolve both issues could pass through the combination of a single frame 2D-Stage with a temporal 3D-Stage like in [81], obtaining a reasonably low latency with temporal coherence and without the introducing lag. The combination of a kinematic model with the raw predictions from the NN model should also be investigated as a way to introduce prior knowledge and improve robustness, by only allowing the production of anthropomorphically valid solutions. This could be introduced as an additional learned component [68], an optimization constraint [58], or as a post-processing step [73]. Finally, a multitude of spatio-temporal metrics can easily be extracted from the 3D skeleton keypoints representation provided by this model, over-time, on subsequent modules, from full body joint kinematics (angles, velocities, accelerations) to gait parameters, such as the, step length, cadence, foot orientation. These were already calculated on the ASBGo walker from the previous detection algorithm. It would thus be interesting to compare metrics obtained from sessions using the new detection approach. 83 References [1] R. Moreira, J. Alves, A. Matias, and C. P. Santos, “Smart and Assistive Walker – ASBGo: Rehabilitation Robotics: A Smart– Walker to Assist Ataxic Patients,” in Robotics in Healthcare. Advances in Experimental Medicine and Biology. Springer Nature Switzerland AG, 2019, pp. 37–68, ISBN: 9783319326696. DOI: 10.1007/978-3-319-32669-6. [2] W. H. Organization, World Report on Disability . World Health Organization, 2011, ISBN: 9789241564182. [3] T. Mikolajczyk, I. Ciobanu, D. I. Badea, A. Iliescu, S. Pizzamiglio, T. Schauer, T. Seel, P. L. Seiciu, D. L. Turner, and M. Berteanu, “Advanced technology for gait rehabilitation: An overview,” Advances in Mechanical Engineering , vol. 10, no. 7, pp. 1–19, 2018, ISSN: 16878140. DOI: 10.1177/1687814018783627. [4] F. Miller and S. Bachrach, Cerebral Palsy: A Complete Guide for Caregiving , ser. A Johns Hopkins Press Health Book. Johns Hopkins University Press, 2006, ISBN: 9780801883552. [Online]. Available: https://books.google.pt/books?id=tvGpPwAACAAJ. [5] J. Jonsdottir and M. Ferrarin, “Gait disorders in persons after stroke,” in Handbook of Human Motion . Cham: Springer International Publishing, 2017, pp. 1–11, ISBN: 978-3-319-30808-1. DOI: 10.1007/978-3-319-30808-1_61-1. [Online]. Available: https://doi.org/10. 1007/978-3-319-30808-1_61-1. [6] W. Johnson, O. Onuma, M. Owolabi, and S. Sachdev, “Stroke: A global response is needed,” Bulletin of the World Health Organization , vol. 94, no. 9, 634A–635A, 2016, ISSN: 15640604. DOI: 10.2471/BLT.16.181636. [7] M. Chang, W. Mou, C. Liao, and L. Fu, “Design and implementation of an active robotic walker for parkinson’s patients,” in 2012 Proceedings of SICE Annual Conference (SICE) , 2012, pp. 2068– 2073. 85 References [8] J. Olesen, A. Gustavsson, M. Svensson, H. U. Wittchen, and B. Jönsson, “The economic cost of brain disorders in europe,” European Journal of Neurology , vol. 19, no. 1, pp. 155–162, 2012, ISSN: 14681331. DOI: 10.1111/j.1468-1331.2011.03590.x. [9] M. M. Martins, C. P. Santos, A. Frizera-Neto, and R. Ceres, “Assistive mobility devices focusing on smart walkers: Classification and review,” Robotics and Autonomous Systems , vol. 60, no. 4, pp. 548–562, 2012, ISSN: 0921-8890. DOI: https://doi.org/10.1016/j.robot. 2011 . 11 . 015. [Online]. Available: http : / / www . sciencedirect . com / science / article/pii/S0921889011002181. [10] Ł. Kidzin�ski, B. Yang, J. Hicks, A. Rajagopal, S. Delp, and M. Schwartz, “Deep neural networks enable quantitative movement analysis using single-camera videos,” Nature Communications , vol. 11, no. 1, 2020, ISSN: 2041-1723. DOI: 10.1038/s41467-020-17807-z. [11] Y. Chen, Y. Tian, and M. He, “Monocular human pose estimation: A survey of deep learning-based methods,” Computer Vision and Image Understanding , vol. 192, p. 102 897, 2020, ISSN: 1077- 3142. DOI: https://doi.org/10.1016/j.cviu.2019.102897. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S1077314219301778. [12] T. Cloete and C. Scheffer, “Benchmarking of a full-body inertial motion capture system for clinical gait analysis,” Conference proceedings : ... Annual International Conference of the IEEE Engineering in Medicine and Biology Society. IEEE Engineering in Medicine and Biology Society. Conference , vol. 2008, pp. 4579–82, 2008. DOI: 10.1109/IEMBS.2008.4650232. [13] M. Gabel, R. Gilad-Bachrach, E. Renshaw, and A. Schuster, “Full body gait analysis with kinect,” 2012 Annual International Conference of the IEEE Engineering in Medicine and Biology Society , pp. 1964–1967, 2012. [14] S. Springer and G. Yogev Seligmann, “Validity of the kinect for gait assessment: A focused review,” Sensors , vol. 16, no. 2, p. 194, 2016. [15] A. Pfister, A. West, S. Bronner, and A. Noah, “Comparative abilities of microsoft kinect and vicon 3d motion capture for gait analysis,” Journal of medical engineering & technology , vol. 38, pp. 1– 7, 2014. DOI: 10.3109/03091902.2014.909540. [16] A. F. Neto, A. Elias, C. Cifuentes, C. Rodriguez, T. Bastos, and R. Carelli, “Smart walkers: Advanced robotic human walking-aid systems,” in Intelligent Assistive Robots , Springer, 2015, pp. 103–131. 86 References [77] J. Martinez, R. Hossain, J. Romero, and J. J. Little, “A simple yet effective baseline for 3d human pose estimation,” in Proceedings of the IEEE International Conference on Computer Vision , 2017, pp. 2640–2649. [78] L. Zhao, X. Peng, Y. Tian, M. Kapadia, and D. N. Metaxas, “Semantic graph convolutional networks for 3d human pose regression,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition , 2019, pp. 3425–3435. [79] H. Coskun, F. Achilles, R. DiPietro, N. Navab, and F. Tombari, “Long short-term memory kalman filters: Recurrent neural estimators for pose regularization,” in Proceedings of the IEEE International Conference on Computer Vision , 2017, pp. 5524–5532. [80] M. Rayat Imtiaz Hossain and J. J. Little, “Exploiting temporal information for 3d human pose estimation,” in Proceedings of the European Conference on Computer Vision (ECCV) , 2018, pp. 68– 84. [81] R. Dabral, A. Mundhada, U. Kusupati, S. Afaque, A. Sharma, and A. Jain, “Learning 3d human pose from structure and motion,” in Proceedings of the European Conference on Computer Vision (ECCV) , 2018, pp. 668–683. [82] D. Pavllo, C. Feichtenhofer, D. Grangier, and M. Auli, “3d human pose estimation in video with temporal convolutions and semi-supervised training,” en, 32nd IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2019); Conference Location: Long Beach, CA, USA; Conference Date: June 16-20, 2019, Piscataway, NJ: IEEE, 2019, pp. 7745–7754. DOI: 10. 1109/CVPR.2019.00794. [83] J. Liu, Y. Guang, and J. Rojas, “Gast-net: Graph attention spatio-temporal convolutional networks for 3d human pose estimation in video,” arXiv preprint arXiv:2003.14179 , 2020. [84] G. Varol, D. Ceylan, B. Russell, J. Yang, E. Yumer, I. Laptev, and C. Schmid, “Bodynet: Volumetric inference of 3d human body shapes,” in Proceedings of the European Conference on Computer Vision (ECCV) , 2018, pp. 20–36. [85] M. Kocabas, N. Athanasiou, and M. J. Black, “Vibe: Video inference for human body pose and shape estimation,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , 2020, pp. 5253–5263. [86] A. Martı�nez-González, M. Villamizar, O. Canévet, and J.-M. Odobez, “Residual pose: A decoupled approach for depth-based 3d human pose estimation,” in IEEE/RSJ International Conference on Intelligent Robots and Systems , 2020. 93 References [87] J. Shotton, A. Fitzgibbon, M. Cook, T. Sharp, M. Finocchio, R. Moore, A. Kipman, and A. Blake, “Real-time human pose recognition in parts from single depth images,” in CVPR 2011 , ser. CVPR 2011, 2011, pp. 1297–1304. DOI: 10.1109/CVPR.2011.5995316. [Online]. Available: https://doi.org/10.1109/CVPR.2011.5995316. [88] R. Pascanu, T. Mikolov, and Y. Bengio, “On the difficulty of training recurrent neural networks,” in International conference on machine learning , 2013, pp. 1310–1318. [89] P. J. Werbos, “Backpropagation through time: What it does and how to do it,” Proceedings of the IEEE , vol. 78, no. 10, pp. 1550–1560, 1990. DOI: 10.1109/5.58337. [90] S. Bai, J. Z. Kolter, and V. Koltun, “An empirical evaluation of generic convolutional and recurrent networks for sequence modeling,” arXiv preprint arXiv:1803.01271 , 2018. [91] G. Casiez, N. Roussel, and D. Vogel, “1€ filter: A simple speed-based low-pass filter for noisy input in interactive systems,” in Proceedings of the SIGCHI Conference on Human Factors in Computing Systems , 2012, pp. 2527–2530. [92] G. Varol, J. Romero, X. Martin, N. Mahmood, M. J. Black, I. Laptev, and C. Schmid, “Learning from synthetic humans,” in CVPR , 2017. [93] X. Ji, Q. Fang, J. Dong, Q. Shuai, W. Jiang, and X. Zhou, “A survey on monocular 3d human pose estimation,” Virtual Reality & Intelligent Hardware , vol. 2, no. 6, pp. 471–500, 2020, ISSN: 2096- 5796. DOI: https://doi.org/10.1016/j.vrih.2020.04.005. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S2096579620300887. [94] Š. Obdržálek, G. Kurillo, F. Ofli, R. Bajcsy, E. Seto, H. Jimison, and M. Pavel, “Accuracy and robustness of kinect pose estimation in the context of coaching of elderly population,” in 2012 Annual International Conference of the IEEE Engineering in Medicine and Biology Society , IEEE, 2012, pp. 1188–1193. [95] M. Eltoukhy, C. Kuenze, J. Oh, M. Jacopetti, S. Wooten, and J. Signorile, “Microsoft kinect can distinguish differences in over-ground gait between older persons with and without parkinson’s disease,” Medical engineering & physics , vol. 44, pp. 1–7, 2017, ISSN: 1350-4533. DOI: 10. 1016/j.medengphy.2017.03.007. [Online]. Available: https://doi.org/10.1016/ j.medengphy.2017.03.007. 94 References [96] F. Achilles, A.-E. Ichim, H. Coskun, F. Tombari, S. Noachtar, and N. Navab, “Patient mocap: Human pose estimation under blanket occlusion for hospital monitoring applications,” in Medical Image Computing and Computer-Assisted Intervention (MICCAI 2016) , S. Ourselin, L. Joskowicz, M. R. Sabuncu, G. Unal, and W. Wells, Eds., Cham: Springer International Publishing, 2016, pp. 491–499, ISBN: 978-3-319-46720-7. [97] L. Sigal, A. Balan, and M. J. Black, “HumanEva: Synchronized video and motion capture dataset and baseline algorithm for evaluation of articulated human motion,” International Journal of Computer Vision , vol. 87, no. 1, pp. 4–27, 2010. [98] A. Shahroudy, J. Liu, T.-T. Ng, and G. Wang, “Ntu rgb+d: A large scale dataset for 3d human activity analysis,” in IEEE Conference on Computer Vision and Pattern Recognition , 2016. [99] F. Ofli, R. Chaudhry, G. Kurillo, R. Vidal, and R. Bajcsy, “Berkeley mhad: A comprehensive multimodal human action database,” in 2013 IEEE Workshop on Applications of Computer Vision (WACV) , 2013, pp. 53–60. DOI: 10.1109/WACV.2013.6474999. [100] M. Loper, N. Mahmood, J. Romero, G. Pons-Moll, and M. J. Black, “Smpl: A skinned multiperson linear model,” ACM Trans. Graph. , vol. 34, no. 6, 2015, ISSN: 0730-0301. DOI: 10. 1145/2816795.2818013. [Online]. Available: https://doi.org/10.1145/2816795. 2818013. [101] M. Fabbri, F. Lanzi, S. Calderara, A. Palazzi, R. Vezzani, and R. Cucchiara, “Learning to detect and track visible and occluded body joints in a virtual world,” in European Conference on Computer Vision (ECCV) , 2018. [102] J. F. Nunes, P. M. Moreira, and J. M. R. Tavares, “Benchmark rgb-d gait datasets: A systematic review,” in ECCOMAS Thematic Conference on Computational Vision and Medical Image Processing , Springer, 2019, pp. 366–372. [103] G. Xu and Z. Zhang, Epipolar Geometry in Stereo, Motion, and Object Recognition: A Unified Approach . USA: Kluwer Academic Publishers, 1996, ISBN: 0792341996. [104] M. Al-Amri, K. Nicholas, K. Button, V. Sparkes, L. Sheeran, and J. L. Davies, “Inertial measurement units for clinical movement analysis: Reliability and concurrent validity,” Sensors (Switzerland) , vol. 18, no. 3, pp. 1–29, 2018, ISSN: 14248220. DOI: 10.3390/s18030719. 95 References [105] C. Beaman, C. Peterson, R. Neptune, and S. Kautz, “Differences in self-selected and fastestcomfortable walking in post-stroke hemiparetic persons,” Gait & Posture , vol. 31, no. 3, pp. 311– 316, 2010, ISSN: 0966-6362. DOI: https://doi.org/10.1016/j.gaitpost.2009. 11.011. [Online]. Available: http://www.sciencedirect.com/science/article/ pii/S0966636209006638. [106] L.-C. Chen, Y. Zhu, G. Papandreou, F. Schroff, and H. Adam, “Encoder-decoder with atrous separable convolution for semantic image segmentation,” in Proceedings of the European conference on computer vision (ECCV) , 2018, pp. 801–818. [107] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focal loss for dense object detection,” in Proceedings of the IEEE international conference on computer vision , 2017, pp. 2980–2988. [108] X. Du, T. Kurmann, P. Chang, M. Allan, S. Ourselin, R. Sznitman, J. D. Kelly, and D. Stoyanov, “Articulated multi-instrument 2-d pose estimation using fully convolutional networks,” IEEE Transactions on Medical Imaging , vol. 37, no. 5, pp. 1276–1287, 2018. DOI: 10.1109/TMI.2017. 2787672. [109] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala, “Pytorch: An imperative style, high-performance deep learning library,” in Advances in Neural Information Processing Systems 32 , H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. Fox, and R. Garnett, Eds., Curran Associates, Inc., 2019, pp. 8024–8035. [Online]. Available: http://papers.neurips.cc/paper/ 9015-pytorch-an-imperative-style-high-performance-deep-learning- library.pdf. [110] I. Loshchilov and F. Hutter, “Decoupled weight decay regularization,” arXiv preprint arXiv:1711.05101 , 2017. [111] ——, “SGDR: stochastic gradient descent with restarts,” CoRR , vol. abs/1608.03983, 2016. arXiv: 1608.03983. [Online]. Available: http://arxiv.org/abs/1608.03983. [112] S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” in Proceedings of the 32nd International Conference on Machine Learning , F. Bach and D. Blei, Eds., ser. Proceedings of Machine Learning Research, vol. 37, Lille, France: PMLR, 2015, pp. 448–456. [Online]. Available: http://proceedings.mlr.press/v37/ ioffe15.html. 96 References [113] C. Shorten and T. Khoshgoftaar, “A survey on image data augmentation for deep learning,” Journal of Big Data , vol. 6, pp. 1–48, 2019. [114] I. Sárándi, T. Linder, K. O. Arras, and B. Leibe, “How robust is 3d human pose estimation to occlusion?” In IROS Workshop - Robotic Co-workers 4.0 , 2018. [115] M. Everingham, L. Gool, C. K. Williams, J. Winn, and A. Zisserman, “The pascal visual object classes (voc) challenge,” International Journal of Computer Vision , vol. 88, pp. 303–338, 2009. [116] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov, “Dropout: A simple way to prevent neural networks from overfitting,” Journal of Machine Learning Research , vol. 15, no. 56, pp. 1929–1958, 2014. [Online]. Available: http : / / jmlr . org / papers / v15 / srivastava14a.html. [117] A. Krogh and J. A. Hertz, “A simple weight decay can improve generalization,” in Advances in Neural Information Processing Systems 4 , J. E. Moody, S. J. Hanson, and R. P. Lippmann, Eds., Morgan-Kaufmann, 1992, pp. 950–957. [Online]. Available: http://papers.nips.cc/ paper/563-a-simple-weight-decay-can-improve-generalization.pdf. [118] C. Hazirbas, L. Ma, C. Domokos, and D. Cremers, “Fusenet: Incorporating depth into semantic segmentation via fusion-based cnn architecture,” in ACCV , 2016. [119] X. Wang, R. Girshick, A. Gupta, and K. He, “Non-local neural networks,” in Proceedings of the IEEE conference on computer vision and pattern recognition , 2018, pp. 7794–7803. [120] D. Tran, H. Wang, L. Torresani, J. Ray, Y. LeCun, and M. Paluri, “A closer look at spatiotemporal convolutions for action recognition,” in Proceedings of the IEEE conference on Computer Vision and Pattern Recognition , 2018, pp. 6450–6459. [121] Y. Guo, “A survey on methods and theories of quantized neural networks,” arXiv preprint arXiv:1808.04752 , 2018. [122] M. Schwarz, H. Schulz, and S. Behnke, “Rgb-d object recognition and pose estimation based on pre-trained convolutional neural network features,” in 2015 IEEE International Conference on Robotics and Automation (ICRA) , 2015, pp. 1329–1335. DOI: 10.1109/ICRA.2015. 7139363. [123] C. R. Qi, L. Yi, H. Su, and L. J. Guibas, “Pointnet++: Deep hierarchical feature learning on point sets in a metric space,” Advances in neural information processing systems , vol. 30, pp. 5099– 5108, 2017. 97 References [124] H. Jiang, J. Cai, and J. Zheng, “Skeleton-aware 3d human shape reconstruction from point clouds,” in Proceedings of the IEEE International Conference on Computer Vision , 2019, pp. 5431–5441. 98