dynamic analysis of swimmers during training

84
Dynamic Analysis of Swimmers During Training An Inertial Measurement Unit (IMU) Approach Eduardo Filipe Ramos F´ elix Thesis to obtain the Master of Science Degree in Electrical and Computer Engineering Advisors: Prof. Paulo Lu´ ıs Serras Lobato Correia Prof. Hugo Humberto Pl ´ acido da Silva Examination Committee Chairperson: Prof./Dr. Jos´ e Eduardo Charters Ribeiro da Cunha Sanguino Advisor: Prof./Dr. Hugo Humberto Pl ´ acido da Silva Members of the Committee: Prof./Dr. Nuno Manuel Garcia dos Santos November 2018

Upload: others

Post on 25-May-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dynamic Analysis of Swimmers During Training

Dynamic Analysis of Swimmers During Training

An Inertial Measurement Unit (IMU) Approach

Eduardo Filipe Ramos Felix

Thesis to obtain the Master of Science Degree in

Electrical and Computer Engineering

Advisors

Prof Paulo Luıs Serras Lobato CorreiaProf Hugo Humberto Placido da Silva

Examination CommitteeChairperson ProfDr Jose Eduardo Charters Ribeiro da Cunha Sanguino

Advisor ProfDr Hugo Humberto Placido da SilvaMembers of the Committee ProfDr Nuno Manuel Garcia dos Santos

November 2018

DeclarationI declare that this document is an original work of my own authorship and that it fulfills all the require-ments of the Code of Conduct and Good Practices of the Universidade de Lisboa

Acknowledgments

First of all I would like to thank my supervisors who have been tireless throughout the entire developmentof the thesis All the provided suggestions help support and constant availability for doubts clarificationwere crucial in the development of this work I would also like to thank Instituto de Telecomunicacoes(IT) for the project funding

Secondly I would like to thank Professors Jan Cabri and Bjoslashrn Harald from the Norwegian School ofSport Sciences as well as Professora Ana Conceicao from Escola Superior de Desporto de Rio Maiorfor the suggestions availability and help in carrying out the work

Thirdly I would like to thank the athletes from the Alhandra Sporting Clube whom promptly madethemselves available to collaborate in the accomplishment of this work and in the respective data collec-tion I would especially like to thank Pedro Leitao and Rafael Ribeiro for the idea and suggestions andto Luis Pedro Ferreira for the constant availability and help provided in the several tests carried out

Fourthly I want to thank Pedro Sousa Francisco Lourenco Miguel Silva Samuel Arcadinho PedroPereira Rui Santos and Loic Foulon for the friendship companionship and help during these 5 years ofInstituto Superior Tecnico I also want to thank Pedro Carvalho Luıs Ferreira and Sofia Hipolito for thebreak moments and unconditional friendship they have given me

Fifth I would like to thank my family who have always encouraged and supported me throughoutthese 23 years

In the sixth and final place I would like to thank Mariana To the best thing Tecnico has given me forthe unconditional and crucial love support care and for always believing in me and making me believetoo a huge thanks

i

Abstract

The emerging and continuous technology progress leads to its widespread use in the most diverseareas One such case is sports The heart rate monitoring vests the in-field positioning monitoringthe goal-line or video-referee technology are some examples of approaches used nowadays in footballpractice In case of tennis rugby or volleyball the rdquohawk eyerdquo is also a very useful commonly usedtechnological progress Thus this thesis consisted in the development of a convenient practical andlow cost system (prototype and data analysis system) that uses inertial signals applied to the practice ofswimming In order to help athlete and coach in swimmerrsquos performance evaluation and improvementseveral performance indicators have been extracted The obtained results are quite positive An 100accuracy in turn recognition (turns and stops) a precision of 100 in the recognition of backstrokestyle and a precision of 8960 in the three remaining swimming techniques (butterfly breaststroke andcrawl) could be reported Real swimming data were collected from different athletes in order to developa representative database Also a real-time communication between device and coach as well as amemory card based data recording module have been approached

Keywords athlete coach sports engineering swimming inertial measurement unit

iii

Abstract

O contınuo e emergente progresso da tecnologia conduz a uma vasta disseminacao nas mais diversasrestantes areas Um desses casos e o desporto Monitorizacao de posicionamento no campo as-sim como de batimento cardıaco tecnologia de linha de golo ou vıdeo-arbitro sao alguns exemplos deabordagens bastantes usadas na practica do futebol nos dias que correm Por outro lado no caso dotenis voleibol ou rugby a tecnologia de rdquoolho de falcaordquo representa um progresso tecnologico bastanteutil e utilizado ajudando na preservacao da verdade desportiva Assim esta tese consistiu no desen-volvimento de um sistema (prototipo + algoritmo processamento dos dados) conveniente practico ede baixo custo baseado na aquisicao de sinais inerciais aplicado a practica da natacao Extraıram-sevarias features que sao uteis a atleta e treinador na avaliacao e posterior progresso de performancedo nadador Os resultados obtidos sao bastante positivos Reporta-se uma precisao de 100 no re-conhecimento de voltas (viragens e paragens) uma precisao de 100 no reconhecimento do estilo decostas e uma precisao de 8960 no que toca as tres restantes tecnicas de nado (mariposa brucos ecrawl) Recolheram-se dados reais de diferentes atletas de forma a desenvolver uma base de dadosrepresentativa e estudou-se nao so a possibilidade de comunicacao em tempo real com o treinadorcomo tambem se implementou no dispositivo utilizado um modulo de gravacao dos dados recolhidosbaseado num cartao de memoria

Keywords atleta treinador engenharia do desporto natacao unidade inercial de medida

v

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 2: Dynamic Analysis of Swimmers During Training

DeclarationI declare that this document is an original work of my own authorship and that it fulfills all the require-ments of the Code of Conduct and Good Practices of the Universidade de Lisboa

Acknowledgments

First of all I would like to thank my supervisors who have been tireless throughout the entire developmentof the thesis All the provided suggestions help support and constant availability for doubts clarificationwere crucial in the development of this work I would also like to thank Instituto de Telecomunicacoes(IT) for the project funding

Secondly I would like to thank Professors Jan Cabri and Bjoslashrn Harald from the Norwegian School ofSport Sciences as well as Professora Ana Conceicao from Escola Superior de Desporto de Rio Maiorfor the suggestions availability and help in carrying out the work

Thirdly I would like to thank the athletes from the Alhandra Sporting Clube whom promptly madethemselves available to collaborate in the accomplishment of this work and in the respective data collec-tion I would especially like to thank Pedro Leitao and Rafael Ribeiro for the idea and suggestions andto Luis Pedro Ferreira for the constant availability and help provided in the several tests carried out

Fourthly I want to thank Pedro Sousa Francisco Lourenco Miguel Silva Samuel Arcadinho PedroPereira Rui Santos and Loic Foulon for the friendship companionship and help during these 5 years ofInstituto Superior Tecnico I also want to thank Pedro Carvalho Luıs Ferreira and Sofia Hipolito for thebreak moments and unconditional friendship they have given me

Fifth I would like to thank my family who have always encouraged and supported me throughoutthese 23 years

In the sixth and final place I would like to thank Mariana To the best thing Tecnico has given me forthe unconditional and crucial love support care and for always believing in me and making me believetoo a huge thanks

i

Abstract

The emerging and continuous technology progress leads to its widespread use in the most diverseareas One such case is sports The heart rate monitoring vests the in-field positioning monitoringthe goal-line or video-referee technology are some examples of approaches used nowadays in footballpractice In case of tennis rugby or volleyball the rdquohawk eyerdquo is also a very useful commonly usedtechnological progress Thus this thesis consisted in the development of a convenient practical andlow cost system (prototype and data analysis system) that uses inertial signals applied to the practice ofswimming In order to help athlete and coach in swimmerrsquos performance evaluation and improvementseveral performance indicators have been extracted The obtained results are quite positive An 100accuracy in turn recognition (turns and stops) a precision of 100 in the recognition of backstrokestyle and a precision of 8960 in the three remaining swimming techniques (butterfly breaststroke andcrawl) could be reported Real swimming data were collected from different athletes in order to developa representative database Also a real-time communication between device and coach as well as amemory card based data recording module have been approached

Keywords athlete coach sports engineering swimming inertial measurement unit

iii

Abstract

O contınuo e emergente progresso da tecnologia conduz a uma vasta disseminacao nas mais diversasrestantes areas Um desses casos e o desporto Monitorizacao de posicionamento no campo as-sim como de batimento cardıaco tecnologia de linha de golo ou vıdeo-arbitro sao alguns exemplos deabordagens bastantes usadas na practica do futebol nos dias que correm Por outro lado no caso dotenis voleibol ou rugby a tecnologia de rdquoolho de falcaordquo representa um progresso tecnologico bastanteutil e utilizado ajudando na preservacao da verdade desportiva Assim esta tese consistiu no desen-volvimento de um sistema (prototipo + algoritmo processamento dos dados) conveniente practico ede baixo custo baseado na aquisicao de sinais inerciais aplicado a practica da natacao Extraıram-sevarias features que sao uteis a atleta e treinador na avaliacao e posterior progresso de performancedo nadador Os resultados obtidos sao bastante positivos Reporta-se uma precisao de 100 no re-conhecimento de voltas (viragens e paragens) uma precisao de 100 no reconhecimento do estilo decostas e uma precisao de 8960 no que toca as tres restantes tecnicas de nado (mariposa brucos ecrawl) Recolheram-se dados reais de diferentes atletas de forma a desenvolver uma base de dadosrepresentativa e estudou-se nao so a possibilidade de comunicacao em tempo real com o treinadorcomo tambem se implementou no dispositivo utilizado um modulo de gravacao dos dados recolhidosbaseado num cartao de memoria

Keywords atleta treinador engenharia do desporto natacao unidade inercial de medida

v

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 3: Dynamic Analysis of Swimmers During Training

Acknowledgments

First of all I would like to thank my supervisors who have been tireless throughout the entire developmentof the thesis All the provided suggestions help support and constant availability for doubts clarificationwere crucial in the development of this work I would also like to thank Instituto de Telecomunicacoes(IT) for the project funding

Secondly I would like to thank Professors Jan Cabri and Bjoslashrn Harald from the Norwegian School ofSport Sciences as well as Professora Ana Conceicao from Escola Superior de Desporto de Rio Maiorfor the suggestions availability and help in carrying out the work

Thirdly I would like to thank the athletes from the Alhandra Sporting Clube whom promptly madethemselves available to collaborate in the accomplishment of this work and in the respective data collec-tion I would especially like to thank Pedro Leitao and Rafael Ribeiro for the idea and suggestions andto Luis Pedro Ferreira for the constant availability and help provided in the several tests carried out

Fourthly I want to thank Pedro Sousa Francisco Lourenco Miguel Silva Samuel Arcadinho PedroPereira Rui Santos and Loic Foulon for the friendship companionship and help during these 5 years ofInstituto Superior Tecnico I also want to thank Pedro Carvalho Luıs Ferreira and Sofia Hipolito for thebreak moments and unconditional friendship they have given me

Fifth I would like to thank my family who have always encouraged and supported me throughoutthese 23 years

In the sixth and final place I would like to thank Mariana To the best thing Tecnico has given me forthe unconditional and crucial love support care and for always believing in me and making me believetoo a huge thanks

i

Abstract

The emerging and continuous technology progress leads to its widespread use in the most diverseareas One such case is sports The heart rate monitoring vests the in-field positioning monitoringthe goal-line or video-referee technology are some examples of approaches used nowadays in footballpractice In case of tennis rugby or volleyball the rdquohawk eyerdquo is also a very useful commonly usedtechnological progress Thus this thesis consisted in the development of a convenient practical andlow cost system (prototype and data analysis system) that uses inertial signals applied to the practice ofswimming In order to help athlete and coach in swimmerrsquos performance evaluation and improvementseveral performance indicators have been extracted The obtained results are quite positive An 100accuracy in turn recognition (turns and stops) a precision of 100 in the recognition of backstrokestyle and a precision of 8960 in the three remaining swimming techniques (butterfly breaststroke andcrawl) could be reported Real swimming data were collected from different athletes in order to developa representative database Also a real-time communication between device and coach as well as amemory card based data recording module have been approached

Keywords athlete coach sports engineering swimming inertial measurement unit

iii

Abstract

O contınuo e emergente progresso da tecnologia conduz a uma vasta disseminacao nas mais diversasrestantes areas Um desses casos e o desporto Monitorizacao de posicionamento no campo as-sim como de batimento cardıaco tecnologia de linha de golo ou vıdeo-arbitro sao alguns exemplos deabordagens bastantes usadas na practica do futebol nos dias que correm Por outro lado no caso dotenis voleibol ou rugby a tecnologia de rdquoolho de falcaordquo representa um progresso tecnologico bastanteutil e utilizado ajudando na preservacao da verdade desportiva Assim esta tese consistiu no desen-volvimento de um sistema (prototipo + algoritmo processamento dos dados) conveniente practico ede baixo custo baseado na aquisicao de sinais inerciais aplicado a practica da natacao Extraıram-sevarias features que sao uteis a atleta e treinador na avaliacao e posterior progresso de performancedo nadador Os resultados obtidos sao bastante positivos Reporta-se uma precisao de 100 no re-conhecimento de voltas (viragens e paragens) uma precisao de 100 no reconhecimento do estilo decostas e uma precisao de 8960 no que toca as tres restantes tecnicas de nado (mariposa brucos ecrawl) Recolheram-se dados reais de diferentes atletas de forma a desenvolver uma base de dadosrepresentativa e estudou-se nao so a possibilidade de comunicacao em tempo real com o treinadorcomo tambem se implementou no dispositivo utilizado um modulo de gravacao dos dados recolhidosbaseado num cartao de memoria

Keywords atleta treinador engenharia do desporto natacao unidade inercial de medida

v

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 4: Dynamic Analysis of Swimmers During Training

Abstract

The emerging and continuous technology progress leads to its widespread use in the most diverseareas One such case is sports The heart rate monitoring vests the in-field positioning monitoringthe goal-line or video-referee technology are some examples of approaches used nowadays in footballpractice In case of tennis rugby or volleyball the rdquohawk eyerdquo is also a very useful commonly usedtechnological progress Thus this thesis consisted in the development of a convenient practical andlow cost system (prototype and data analysis system) that uses inertial signals applied to the practice ofswimming In order to help athlete and coach in swimmerrsquos performance evaluation and improvementseveral performance indicators have been extracted The obtained results are quite positive An 100accuracy in turn recognition (turns and stops) a precision of 100 in the recognition of backstrokestyle and a precision of 8960 in the three remaining swimming techniques (butterfly breaststroke andcrawl) could be reported Real swimming data were collected from different athletes in order to developa representative database Also a real-time communication between device and coach as well as amemory card based data recording module have been approached

Keywords athlete coach sports engineering swimming inertial measurement unit

iii

Abstract

O contınuo e emergente progresso da tecnologia conduz a uma vasta disseminacao nas mais diversasrestantes areas Um desses casos e o desporto Monitorizacao de posicionamento no campo as-sim como de batimento cardıaco tecnologia de linha de golo ou vıdeo-arbitro sao alguns exemplos deabordagens bastantes usadas na practica do futebol nos dias que correm Por outro lado no caso dotenis voleibol ou rugby a tecnologia de rdquoolho de falcaordquo representa um progresso tecnologico bastanteutil e utilizado ajudando na preservacao da verdade desportiva Assim esta tese consistiu no desen-volvimento de um sistema (prototipo + algoritmo processamento dos dados) conveniente practico ede baixo custo baseado na aquisicao de sinais inerciais aplicado a practica da natacao Extraıram-sevarias features que sao uteis a atleta e treinador na avaliacao e posterior progresso de performancedo nadador Os resultados obtidos sao bastante positivos Reporta-se uma precisao de 100 no re-conhecimento de voltas (viragens e paragens) uma precisao de 100 no reconhecimento do estilo decostas e uma precisao de 8960 no que toca as tres restantes tecnicas de nado (mariposa brucos ecrawl) Recolheram-se dados reais de diferentes atletas de forma a desenvolver uma base de dadosrepresentativa e estudou-se nao so a possibilidade de comunicacao em tempo real com o treinadorcomo tambem se implementou no dispositivo utilizado um modulo de gravacao dos dados recolhidosbaseado num cartao de memoria

Keywords atleta treinador engenharia do desporto natacao unidade inercial de medida

v

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 5: Dynamic Analysis of Swimmers During Training

Abstract

O contınuo e emergente progresso da tecnologia conduz a uma vasta disseminacao nas mais diversasrestantes areas Um desses casos e o desporto Monitorizacao de posicionamento no campo as-sim como de batimento cardıaco tecnologia de linha de golo ou vıdeo-arbitro sao alguns exemplos deabordagens bastantes usadas na practica do futebol nos dias que correm Por outro lado no caso dotenis voleibol ou rugby a tecnologia de rdquoolho de falcaordquo representa um progresso tecnologico bastanteutil e utilizado ajudando na preservacao da verdade desportiva Assim esta tese consistiu no desen-volvimento de um sistema (prototipo + algoritmo processamento dos dados) conveniente practico ede baixo custo baseado na aquisicao de sinais inerciais aplicado a practica da natacao Extraıram-sevarias features que sao uteis a atleta e treinador na avaliacao e posterior progresso de performancedo nadador Os resultados obtidos sao bastante positivos Reporta-se uma precisao de 100 no re-conhecimento de voltas (viragens e paragens) uma precisao de 100 no reconhecimento do estilo decostas e uma precisao de 8960 no que toca as tres restantes tecnicas de nado (mariposa brucos ecrawl) Recolheram-se dados reais de diferentes atletas de forma a desenvolver uma base de dadosrepresentativa e estudou-se nao so a possibilidade de comunicacao em tempo real com o treinadorcomo tambem se implementou no dispositivo utilizado um modulo de gravacao dos dados recolhidosbaseado num cartao de memoria

Keywords atleta treinador engenharia do desporto natacao unidade inercial de medida

v

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 6: Dynamic Analysis of Swimmers During Training

Contents

List of Tables xi

List of Figures xiii

1 Introduction 111 Fundamentals of Swimming 1

111 Frontcrawl 1112 Backstroke 2113 Breaststroke 3114 Butterfly 3

12 Context and Motivation 413 Objectives 514 Main Contributions 515 Structure 6

2 State of the art 721 Swimming Segments 7

211 Starts 7212 Turns 9213 Free Swimming 10214 Finishes 10

22 Video-Based Approaches 10221 Available Systems 11222 Main Specifications 14

23 Inertial Sensing Approaches 15231 Performance Features 15232 Sensor Placement 22233 Inertial-Based Commercial Systems 23

3 Proposed Approach 2531 Device and Adaptations 26

311 BITalino R-IoT 26312 System Adaptations 29

32 Data Acquisiton 32321 Body Positioning 32322 Database 32

33 IMU Data Analysis System 33331 Performance Indicators 34

vii

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 7: Dynamic Analysis of Swimmers During Training

332 Turns and Stops Identification 36333 Stroke Technique Estimation 39334 Stroke Count 41

4 Results 4741 Real-Time Communication 4742 Data Logging 4843 IMU Data Analysis System 49

431 Turns and Stops Identification 50432 Stroke Technique Classifiers 50433 Stroke Count 55

5 Conclusions and Further Work 5951 Discussion 5952 Future Work 60

Bibliography 61

viii

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 8: Dynamic Analysis of Swimmers During Training

x

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 9: Dynamic Analysis of Swimmers During Training

List of Tables

21 Official swimming races 1022 Motion capture cameras specifications 1423 Stroke rate error for a lower back mounted IMU 1924 Feature extraction feasibility 2225 IMU devices and provided features 23

31 BITalino OSC message data 2832 Characterization of the population enrolled in this study 33

41 Turns and stops confusion matrix 5042 SVM classification results 5243 Neural Network classification results using Gradient Descent 5444 Neural Network classification results using Gradient Descent with Momentum 54

xi

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 10: Dynamic Analysis of Swimmers During Training

List of Figures

11 Typical swimming strokesrsquo patterns 1

21 Types of starts 822 Start phases 923 Qualisys motion system 1224 Endless Pools Tank 1325 Vicon tracking heat map simulation 1526 Frontcrawl Y-axis accelerometer and gyroscope signals 1727 Typical pattern of a complete leg stroke 2028 Euler angles 21

31 BITalino R-IoT 2632 SparkFun OpenLog 3133 Device placement on the athletersquos body 3234 IMU data analysis system architecture 3435 Example of an athletersquos body pitch during the preliminary experience 3636 Proposed system architecture for turns and stops identification 3737 Long stop illustration 3738 Pitch and heading signals with outlier backstroke to breaststroke turn representation 3939 Proposed system architecture for stroke estimation 40310 Proposed system architecture for the arm stroke counting for non-symmetrical swimming

techniques 41311 Example of an athletersquos body roll during the preliminary experience 42312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-

niques 43313 Pitch signal in symmetric stroke techniques 45314 Roll signal for one lap of frontcrawl stroke illustrating an outlier 46

41 OSC packet loss rate 4842 Preliminary test in dry condition 4943 Stroke estimation dataset 5144 Accuracy plot for frontcrawl 5545 Accuracy plot for backstroke 5646 Accuracy plots for breaststroke evaluated under different metrics 5647 Accuracy plots for breaststroke evaluated under different metrics 57

xiii

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 11: Dynamic Analysis of Swimmers During Training

xv

Chapter 1

Introduction

Swimming is one of the best known and oldest sports in the world It emerged as a competitive sportin the early 1800s in England and it is an Olympic sport since the first edition of the modern OlympicGames in 1986 in Athens Since then and in order to make the sport more competitive several studieshave been carried out over the years leading to the identification of multiple technical changes to theswimming modalities we know today

In this first chapter the basics of swimming are addressed and explained in particular the severalphases that compose these four techniques are approached Also a brief introduction to this work isperformed namely the way in which the topic arose as well as its context and contribution to sportsnowadays The objectives of the dissertation will also be exposed and finally a brief presentation ofeach section that constitute it is carried out

11 Fundamentals of Swimming

Nowadays swimming is made up of four official techniquesstroke styles These techniques are but-terfly (Section 114) backstroke (Section 112) breaststroke (Section 113) and frontcrawl (Section111) These techniquesrsquo stroke has several steps which will be discussed and explained in detail in thefollowing sections Figure 11 shows the stroke patterns associated with each of these stroke styles

(a) Frontcrawl (b) Backstroke (c) Breaststroke (d) Butterfly

Figure 11 Typical swimming strokesrsquo patterns for each of the four competitive strokes extracted from[1]

111 Frontcrawl

This is the fastest and most efficient swimming technique because of this it is swum in the freestyleevents where swimmers can choose any stroke technique Throughout the stroke the legs beat alter-

1

nately and continuously It has several phases [2] [3]

bull Recovery Recovery stroke phase It is the only phase where the athletersquos arm is out of the waterIt is important for the athlete to keep his elbow high during recovery not only to ensure that the armdoes not swing out to the side but also to balance the body in order to maintain a hydrodynamicposition and avoid creating a drag force source

bull Reach and Entry Hand entry into the water keeping the elbow bent and always higher thanthe hand The entrance should be done smoothly the fingertips enter first with the athletersquosthumb turned down and the palm of the hand slightly tilted out After the handrsquos entry a slip andconsequent rotation of the body is performed

bull Catch As soon as the elbow is extended the catch phase of the stroke begins At this stage theelbow bends again and the wrist sinks so that the fingertips point to the poolrsquos floor

bull Insweep Also known as the pull phase Keeping the elbow high the goal is for the athlete to graba large quantity of water by making an S pattern with the hand It is very important that during thismovement the hand never exceeds the center line of the body in order not to decompensate thestroke and consequently increase the drag

bull Upsweep Also known as the push phase This phase represents the end of the stroke The goalis for the athlete to finish the stroke by pushing the water hard so that the recovery phase startsin a simpler way The hand should pass the hips and get out of the water next to the body

112 Backstroke

It is the only technique whose start is made in the water It is compared to the movement of a kayakwhere the head and body represent the boat the arms represent the oars and the legs a propeller Inthis style it is necessary for the body to remain firm and stable The legs have an alternating beating suchas in the frontcrawl Also as in previous technique there are several steps that define the backstroke[2] [3]

bull Entry and Catch The most important and hard to manage phase the stroke The catch deter-mines the efficiency and consecutive propulsion of the stroke The sooner and more water theswimmer manages to grab the more efficient his stroke will be Once the athletersquos hand is fullysubmerged (after the recovery phase) the catch phase begins The arm is fully extended and thebody rotates approximately 30 degrees to the catch arm side At this stage the fingertips point tothe side and the palm of the hand is facing the feet At no time should the hand turn to the bottomof the pool at this early stage of the stroke

bull Pull After the catch phase both the forearm and the palm of the hand must maintain the pressureexerted on the water to maximize the propulsion of the body At this stage the goal is to pull thewater keeping the elbow and the hand in the same plane pulling with the entire body (not just thearm) The lats pecs and even the core should be involved in the pull

bull Finish Represents the underwater end of the stroke At this stage the arm should extend bypushing the water towards the feet At the end of the stroke the palm of the hand is facing thebottom of the pool This phase is not so much to aid in the athlete propulsion but to help in therotation of the body while the catch of the opposite arm is occurring

2

bull Recovery Connection between the propulsive phases of the stroke This is the only phase of thestroke that happens out of the water and the only one that is not propulsive It is important thatthe arm goes out of the water next to the body to start the recovery The athletersquos arm should alsobe relaxed and controlled The thumb should point downward during the recovery phase

113 Breaststroke

Although it is known to less experienced swimmers as the easiest technique it is known to competitionathletes as the most difficult one The goal is to use the body and core to move forward The key elementof this technique is the kick a strong kick greatly increases the athletersquos speed The kick pull and goodtiming are all important components of a fast breaststroke In this technique both the arms and the legsalways have a symmetrical behavior Below are the various phases that make up this technical strokestyle [2] [3]

bull Out Sweep The beginning of the stroke At this stage both arms are fully stretched about 15 cmbelow the water surface By turning the wrists the athlete should have at the end of this phasethe palms of the hands turned out at an angle of approximately 45 degrees with the water surfacein order to start the catch phase

bull Catch At this stage the athlete rdquograbsrdquo the water by placing his hands within 5 cm of the surfaceof the water and gradually changing their pitch Thumbs point down This change causes theupper body of the athlete to rise

bull Down Sweep After the catching phase and keeping the elbows high the aim is for the hands toassume a circular motion by moving out and down At the end of this phase the hands are at thedeepest point of the stroke

bull In Sweep The hands continue the circular movement initiated in the previous phase but this timemoving inwards circling around the elbows Gradually during this and the previous phase thehandsrsquo pitch change from the outside and downwards to inwards and upwards in order to raisethe trunk and allow the next phase to begin recovery

bull Recovery Once the hands are close together and near the chest the athlete should move themforward smoothly At this stage hand palms may be pointing up or down it is up to the discretionand preference of each athlete At this stage the trunk gradually descends and at the end of thisphase it is again submerged

Between the stroke recovery phase and the beginning of one more stroke with the out sweep onethere is a very important glide moment A single kick occurs also during each stroke cycle Today allbreaststrokers use the whip kick a technique where the athletesrsquo feet are rotated outward downwardand then inward in a circular path This technique is much more efficient than the frog technique (thepreviously used one) The stroke final moment coincides with the strike final moment so that the glidemoment is made with the body fully stretched in order to reduce drag

114 Butterfly

The most spectacular technique in swimming it is also considered the most difficult one for the lessexperienced swimmers It is performed with an undulatory body movement As in the breaststroketechnique both arms and legs have a symmetrical behavior Two leg kicks are performed for eachstroke sequence The kick is performed simultaneously by moving the legs up and down as if from a

3

dolphin movement To be well swum the kick frequency has to be constant and the athlete adapts thestroke movement to it The butterfly stroke phases are [2] [3]

bull Entry The entrance in the water is made with the elbows very high and with the arms well forwardThe body is then pulled down and the athletersquos neck flexes in order to reduce the drag As theshoulders sink into the water the hips rise in order to reproduce the undulating motion previouslyreferred The hands should angle at 45 degrees with the palms pointing outwards

bull Outsweep and Catch At the beginning of this phase the arms have reached forward the trunkis angled downward the hips are elevated and the legs are up near the surface The head andtrunk have travelled downward while the lower limbs rise like a pendulum during this phase Withthe shoulders internally rotated the hands sweep outward until the catch position During theoutsweep phase the hands point to the side At the end of the outsweep phase the hands arethen in a strong position to start the catch i e to move the hands backward in order to generatea propulsive force during the next phase

bull Insweep The insweep phase in this technique is similar to the frontcrawl insweep phase exceptfor the absence of body rotation in this case Since there is no rotation (the limbs move sym-metrically) the hands pass farther from the body midline The torque produced by both arms iscanceled by balancing the body not letting it rotate As in the frontcrawl at this stage the elbowhas to be high and flexed Also at this stage both hands are supposed to come from the outsideto inside to start the upsweep phase

bull Upsweep Underwater final stroke phase It represents a strong backward push that also bringsthe hands toward the surface It is important that this phase is strong since it is the phase thatraises the trunk and removes the upper limbs from the water For this reason the hands need toundergo a progressive acceleration throughout this phase While in frontcrawl the limbsrsquo withdrawalis quite helped by the body rotation in this technique it is totally performed through the propulsiongiven at this stage of the stroke since there is no body rotation It is therefore important to keepthe elbow high during this phase and push the water backwards instead of upwards

bull Release and Recovery At this stage the upper limbs are drawn out of the water and broughtforward This is where breathing takes place It is important not to over-lift the trunk at this stagein order not to increase drag It is also important to completely remove the limbs from the waterso as not to sweep it during recovery The swimmerrsquos efforts should be directed toward horizontalmotion rather than pulling the upper body upward

As for leg kick timing one of the kicks is given in the entry phase and the other is given duringthe upsweep phase in order to help with the water limbs withdrawal and the posterior recovery phaseinitiation Breathing should not be performed at every single stroke in order to maximize performanceand minimize fatigue

12 Context and Motivation

With the burgeoning growth of technology nowadays and the inevitable increase in competitivenessin any kind of sport the combination of these two worlds has become practically unavoidable overthe recent years Technological evidence can now be found in any sport we choose to practice or justobserve Starting with football itrsquos becoming increasingly common the use of heart rate monitoring vestsand in-field positioning monitoring in daily practice as well as the goal-line or video-referee technology in

4

official matches In the case of tennis rugby or volleyball rdquohawk eyerdquo technology is very used nowadaysIn the case of running rdquosmartrdquo watches and their bands which contain among other components aheart rate meter are used these watches are also able to give information to the athlete and coachabout the athletersquos rhythm throughout the workout pace differences support difference between left andright foot (in order to prevent possible injury) and several other features Thus since swimming is oneof the most popular sports in the world technologies that help athletes and coaches in their daily workhave started to emerge a few years ago

Although it is a somewhat underdeveloped area there are some devices already available thatpromise as previously mentioned to help athlete and coach improving sports performance and in-jury prevention Thus there are two sub-categories of currently used devices video-based ones (mostcommon) and wearable devices based on biosignal datainertial signals Both have their advantagesand disadvantages as would be expected In order to help coach and athlete in their daily training lo-gistic issues to provide maximum comfort to the athlete with a reasonable budget and for a number ofother reasons that will be presented in the following text in this dissertation a wearable device based oninertial signals is used

13 Objectives

This dissertation has the objective of developing a devicersquos prototype that collects inertial signals froma swimmer as well as the feature extraction algorithms in order to help athletes and coaches in dailytraining allowing not only a faster evolution but also the prevention of injuries associated with strokingtechnical errors As such the goal is to analyze the current state-of-the-art about technology applied toswimming and the consequent proposal of an innovative system that will fill gaps that may exist In orderfor the main objectives of this thesis to be fulfilled certain secondary objectives are set An innovativeidea that fills the needs of clubs and athletes a prototype development the necessary adaptation to theaquatic environment the programming of a post-processing algorithm to handle the collected data theconsequent tests to the developed system and the recent technology developments and improvementsare therefore established as necessary secondary objectives

14 Main Contributions

In light of the existing state-of-the-art the work developed in the scope of this dissertation includes thefollowing technical and scientific contributions

bull Development of a firmware for the BITalino R-IoT device to enable data logging

bull Identification of an experimental setup and materials suitable for unconstrained IMU data acquisi-tion in swimmers

bull Creation of a database of real-world data with ground truth annotations

bull Data processing pipeline for turn and stroke analysis

bull Introduction of trunk elevation as a new feature in the field of swimming engineering

bull Evaluation of attitude data Euler angles based on IMU signals as computed by the SebastianMadgwick algorithm in swimming analysis

bull Application of neural networks to the problem of stroke style recognition

5

15 Structure

In this chapter an introduction to the thesis context and motivation (Section 12) objectives (Section13) main contributions (Section 14) and structure (Section 15) as well as a brief explanation aboutthe four official techniques that constitute swimming (Section 11) were presented In Chapter 2 the fourdifferent swimming segments (Section 21) are initially discussed and briefly explained then the currentstate-of-the-art in this sports engineering area is presented This second part of Chapter 2 is divided intotwo main groups video approaches (Section 22) and inertial measurement approaches (Section 23)in both cases the advantages and disadvantages of each of these analysis methods will be explainedIn Chapter 3 a new data acquisition system is proposed in order to perform the athletersquos performanceindicators extraction This chapter will cover among others the used device as well as its characteristics(Section 31) both the hardware and software adaptations in order for the device to work in the aquaticenvironment (Section 32) and the collected data post-processing algorithm (Section 33) In Chapter 4the device performance and the post-processing algorithm results are addressed and explained Finallyin Chapter 5 the discussion future work and main conclusions derived from this work will be addressed

6

Chapter 2

State of the art

In this section the current state of the art in the area of swimming monitoring systems is presentedThus some of the most lab used techniques as well as some commercially available devices are dis-cussed

There are two broad categories of techniques used for swimming analysis video techniques andtechniques based on inertial signals In Section 22 the existing video-based capturing techniques willbe presented as well as their advantages and disadvantages while Section 23 will present devicesthat use techniques based on inertial sensing to improve performance and prevent injuries in this sportWe will be able to see from these sections that most of the available resources are based on video ap-proaches However the latest advances in the development of microelectromechanical systems (MEMS)facilitate the development and improvement of inertial systems that are much more practical efficientand informative Section 21 presents a technical approach to the different segments that constituteswimming in order to introduce the technical terms used in the context of this dissertation

21 Swimming Segments

In order to facilitate the study of an athletersquos technique and according to the variables typically analyzedswimming can be divided into four main segments notably the starts (Section 211) turns (Section212) free swimming (Section 213) and finishes (Section 214)

When well analyzed and studied all these segments can be improved in order to maximize theathletersquos performance These segments can then be divided into three categories of analysis temporalkinematic and kinetic The temporal analysis relates to lap time start time (reaction) rotation time(turning) wall contact time among others kinematic analysis is related to stroke length stroke rateswim velocity acceleration among others finally the kinetic analysis takes into account the horizontalimpulse at wall push-off (after a turn) peak impact force among others [1]

211 Starts

The start segment begins at the block and ends when the swimmer re-surfaces and starts swimminguntil the 15 metersrsquo mark [4] This segment in terms of phases is the most complex of the four since itcomprises five phases

bull Block Phase This phase begins at the start sound signal Depending on the athlete the strokeand the race to be swum this start can be done in several ways since there are 4 different typesof jumps grab track swing and back starts

7

The grab track and swing starts are used in crawl backstroke and breaststroke styles while theback start is only used when the athlete is going to swim backstroke In turn nowadays the swingstart (or conventional start) is used only in cases where the athlete is swimming a relay race andhe is not the first element of it it means that the swing start is only performed when the athleteis the second third or fourth element of the relay This is an early technique (50-60 years old)where swimmers donrsquot put their hands on the edge of the block both upper limbs are suspendedand are used to take stock after the starting sound signal This way since in this technique thehands are not supported on the block the reaction time will be much higher than the observedin the other two types of jumps (grab and track) however this type allows the athlete to have thelongest flight time This is why it is used in relays as referred before where reaction time is nota problem (since athletes see their colleague and know when to start) [4] Finally grab and trackstarts are used in the individual crawl backstroke and breaststroke events as well as in the firstjump of the relay events and depend on the preference of each athlete The track technique wasborrowed from athletics with swimmers putting one foot on the front edge of the block Oppositelyon the grab technique swimmers put both feet on the front edge of the block [4] According to theauthors of [5] there is not one type of start that is reportedly better than the other Through severalperformance indicators drawn from 23 studentsrsquo jumps they could show that when well trainedboth jumps are equally efficient Figure 21 represents the different types of starts

The block phase ends as soon as the athletersquos toes leave the block which leads us to the nextphase the flight one

(a) Track start 1 (b) Grab start 2

(c) Back start 3 (d) Swing start 4

Figure 21 Types of starts

bull Flight Phase Starts when the block phase ends ie when the athletersquos toes leave the block andends as soon as he touches with his hands on the water The goal is that the exerted force on the

1httpwwwzimbiocomphotosMichael+Phelps2012+Olympic+Swimming+Team+Trials+Day+3e0XCBcWtvwh2httpswwwgettyimagesptdetailfotografia-de-notC3ADciasian-thorpe-dives-off-the-starting-block

-in-the-fotografia-de-notC3ADcias5397298553httpscdnswimswamcomwp-contentuploads201608Shane-Ryan-ECH-by-Peter-Sukenik-wwwpetersukenik

com-10116jpg4httpscdn-s3sicomstylesmarquee_large_2xs3imagesmichael-phelps-usa-swimming-freestyle-relay-gold-medal

jpg

8

block can be maximized so that the athlete enters as far as possible into the water As mentionedin the previous point this flight time is directly related with the jump technique

bull Entry Phase Starts when the swimmerrsquos fingertips touch the water and ends when his body isfully immersed This is the shortest phase of the five that constitute the start segment

bull Glide Phase Starts when the athletersquos body is fully immersed and ends at the beginning of theunderwater legs propulsion

bull Leg Kicking Phase Starts at the beggining of the underwater legs propulsion and ends whenthe athlete emerges from the water and starts swimming Some non-experienced athletes ignorethis phase by starting the swimming phase immediately after the end of the gliding phase It ismandatory according to FINA (International Swimming Federation) rules that the athlete emergesbefore the 15 meters mark

bull Swimming Phase Starts when the athlete begins stroking and ends when he reaches the 15meters mark Sometimes this phase may not exist if the athlete extends the leg kicking phase tothis mark

Figure 22 illustrates the previously described phases that constitute the start segment

Figure 22 Start phases extracted from [6]

212 Turns

The turn segment begins at the athletersquos approach to the wall and ends when he moves away from itafter each lap Formally this segment is known as the 5 meters that precede the wall and the 5 metersafter the wall [1] Depending on the race there are 3 types of well-known turns

bull Flip Turn This turn is also know as tumble turn and it is commonly used in backstroke andfreestyle modalities This technique involves several phases the approach - time used by theswimmer to prepare the turn starts 5 meters before the wall and lasts until the forward somersaultbegins with the arms by the swimmerrsquos sides rotation - the flip movement starts in the end ofthe approach and ends as soon as the athlete finishes the flip and touches the wall wall contact- impulsion exerted through the contact of the athletersquos feet with the wall giving rise to the glidephase underwater glide - starts as soon as the athletesrsquo toes leave the wall finishes when he isabout to start stroking and consists on a simultaneous leg kicking curling with the hands togetherand fully extended and stroke preparation phases - where the athlete prepares to start swimmingusing usually a strong propulsion generated at the legs (underwater kicking) [2]

bull Open Turn This turn can also be named pivot turn and is the most used turning motion in thebreaststroke and butterfly modalities It is initiated with a simultaneous two-hand touch keepingthe shoulders parallel to the water surface Then depending on the stroke being swum the un-derwater glide phase and the stroke preparation phases are done in different ways If the modalityis breaststroke the underwater phases consist on a glide a pullndashpush of hands to hips a dolphinkick and finally an arm recovery to overhead with a breaststroke kick before surfacing Supposing

9

the modality is butterfly the underwater phases consist both on a simultaneous leg kicking curlingas mentioned in the previous type of turn [2]

bull Backwards Flip Turn This technique is used by a few athletes when changing from backstroketo breaststroke in the specific medley individual race This technique involves a hand touch on thewall a reverse flip and finally a wall push-off since after the backflip turn the athlete is correctlypositioned to start swimming breaststroke [2]

213 Free Swimming

As referred in Section 11 there are four different stroke techniques distributed through five types ofraces which in turn are distributed for different distances Table 21 lists the various races as well asits allowed distances in both pool types SC stands for short-course pool (25 meters) in turn LC meanslong-course pool also called Olympic-size pool (50 meters) The relay races must be performed by 4participants and in the specific case of mixed relays the composition must contain two men and twowomen In turn medley races follow a mandatory technique order in the case of individual races theathlete has to swim butterfly backstroke breaststroke and frontcrawl in the case of relaysrsquo races theorder changes to backstroke breaststroke butterfly and frontcrawl

Table 21 Official swimming races along with its distances on both poolsrsquo types SC stands for short-couse LC stands for long-course

50 m 100 m 200 m 400 m 800 m 1500 mFreestyle SC LC SC LC SC LC SC LC SC LC SC LCBackstroke SC LC SC LC SC LCBreaststroke SC LC SC LC SC LCButterfly SC LC SC LC SC LCIndividual Medley SC SC LC SC LCFreestyle Relays SC SC LC SC LCMedley Relay SC SC LCMixed Relays SC LC

214 Finishes

The finish time is measured from the time the head passes the 5 meter mark until the hand is on thewall Depending on the race there are two types of finishes the one-handed finishes (freestyle andbackstroke techniques) and the two-handed finishes (breastroke and butterfly techniques)

22 Video-Based Approaches

Video approaches are the most widely used techniques by athletes and coaches around the world tocorrect technical errors and monitor some of the essential parameters for good swimming practice Ifwe consider a simple setup (only a typical camera for instance) it is possible to see why this is themost used technique today in a comfortable and fast way it is possible for example with the usage of amobile phone (out of water recordings) or an action cam (underwater recordings) to record any athletein any environment for further analysis Existing approaches include waterproof cameras which can beused to obtain underwater images

Obviously this is an approach with multiple limitations Since the camera is not calibrated the imageis not stabilized and in most cases it is only possible to get one viewpoint of the athlete However when

10

considering a more complex setup (eg SwimPro SwimRight Qualisys Oqus or analogous systems)the possibilities widen There are several techniques for capturing underwater images a camera can bewaterproofed [7] a transparent underwater window can be used (in this case requiring a suitable pool)[8] or a periscope system for capturing images can also be employed [9] One aspect to be taken intoaccount is the number of cameras to be used the larger the number of cameras to record the athletefrom different angles the more complex the setup becomes and consequently the greater the timespent in the synchronization and data processing will be required

As far as data processing is concerned there are two ways to do it manually and automaticallyIn either case the athlete may need to wear specific clothing with visual markers or alternatively usethese visual markers directly on the skin so that the digitizing process can be performed This processconsists of a frame-by-frame analysis of the footage video in order to localize the visual markers placedon the athletersquos body taken from various angles so that it is possible to perform a reconstruction of theathletersquos movement to analyze his swimming technique and extract relevant features for himself and thecoach As previously mentioned this process can be executed either manually or automatically Whendone manually it is a very time-consuming process in order to get an idea using a single camera thetime needed for digitizing 3 starting jumps of 10 athletes is approximately 7 and a half hours since ittakes about 15 minutes to digitize each dive from each athlete [10] Another of the aspects that hindersthe process either manual or automatic is water turbulence as the foambubbles that form when anathlete is swimming make it difficult to visualize the markers applied on the athletersquos body Refractionand reflection of light can also result in image distortion making digitization almost impossible too andleading to the need for practically perfect conditions for the analysis of each of the athletes Still anotheraspect to take into account is the drag introduced by these visual markers (whether they are glued onthe athletersquos skin or in a suit) that consequently either limits the athletersquos movements or disturbs himleading to a reality misrepresentation (given that the obtained features are just an approximation)

221 Available Systems

The human assisted digitization process is done in several sports where video techniques are quiteuseful Although not practical they are still widely used techniques As such some companies havedeveloped and commercialize software that serves this purpose In this section some of these currentlyavailable options will be presented and discussed

Among the most used systems in this area are Qualisys [11] Vicon [12] Natural Point [13] Dartfish[14] and ImagePro [15]

Qualisys is a human motion recognition system used for several purposes such as sports humanbiomechanics engineering entertainment (video games) or animal biomechanics In the specific case ofsports this company has worked with athletes of athletics cycling golf swimming among others Qual-isys developed waterproof cameras combining footage from inside and outside the water They also useactive filtering processes in order to minimize reflections and refractions occurring in the aquatic envi-ronment Data collected through this system is handled by their Visual3D software The company claimsthat the markers used by them are easy to identify and therefore this is done automatically so that thereis no loss of time in the digitization process Figure 23 includes two images Figure 23a shows somecameras that constitute a typical setup of this type of system whereas Figure 23b shows an athleteequipped with the necessary visual markers Observing both figures it can be concluded that althoughbeing a reliable approach well-regarded system and admitting that the automatic markers recognitionworks well as advertised it is not a practical approach Futhermore once assembled changing thissetup from pool to pool between workout sessions if necessary is not an easy task On the athletersquosperspective it is also quite weary as the process involved in placing the markers is time consuming

11

Futhermore these markers are also uncomfortable changing the natural athletersquos movements and aspreviously mentioned cause an aditional drag in the water

(a) Underwater setup

(b) Qualisys visualmarkers placed on an

athlete

Figure 23 Qualisys swimming motion system [11]

Vicon is perhaps the most well-known and most-used system in the area of performance evalua-tion of high-level athletes In fact this system has countless other applications besides the athletesrsquoperformance evaluation Although this company commercializes not only the software that handles theacquired data but also the hardware setup for data acquisiton in this particular section only the soft-ware made available and the way the system works are discussed Through several cameras mountedin a laboratory or in a field (for example) this system can map the movement of an athlete using visualmarkers The cameras mounted around the athlete detect and follow the markers so that live or laterthe three-dimensional reconstruction of the movement can be carried out The service provided by thecompany is very personalized and depending on the rdquoroomrdquo environment to set up the equipmentthey advise the number of cameras and the type of camera to purchase and install the software to useamong others Since the cameras provided by this company are not waterproofed in a swimming poolit becomes somewhat complex to mount a setup of this type unless we are using an rdquoendless poolrdquotank as illustrated in Figure 24 These tanks are not very common and are mainly used for technicalcorrections by the coach Still and assuming there are no cameras inside the pooltank since part ofthe body is underwater and due to all the previously mentioned problems it becomes quite hard to trackthe visual markers on the athletersquos body during the exercice This system is widely used in other sportssuch as football or tennis to correct the athletesrsquo movements In swimming it becomes as it has beenseen impractical and inefficient

In turn Natural Point systems are also widely used Although they do not report swimming as oneof the sports where their system could be applied they claim to hold the most accurate human motionsystem in the world Aurand et al [17] carried out a study of this system behavior in a large volume ofspace (gt 100 m3) where the other systems allegedly produce greater errors This study turns out to bequite interesting since the swimming pool is also a large volumetric rdquoroomrdquo In this case Aurand et al[17] used a volume of 135 m3 and 41 cameras to track motion The results obtained are in fact positiveafter spline interpolation of the data these developers found that 97 of the capture area had an errorbelow 200 microm When the same analysis was performed using only half (21) of the cameras 91 of thecapture area was below 200 microm of error Therefore the authors report that the OptiTrack optical motion

12

Figure 24 Endless Pools Tank [16]

capture system is very precise serving the desired purpose

Another of the widely used software although with much less features is Dartfish This softwarelocates and follows visual markers giving the position values of each one in a two dimensional spaceThis company claims that the software they sell helps coach and athlete in sports like football tennisbasketball baseball swimming skiing athletics among others They say that without a very complexsetup like the ones described above it is possible to import videos from any camera so that they canbe analyzed and accessed in any location through the application that is also available This is a muchcheaper alternative to the Vicon system since it does not involve the purchase of a complex setup andspecialized cameras On the other hand it carries out a less detailed analysis since it is only performedin two dimensions

The authors of [18] compared the two systems in order to verify the Dartifish use feasibility in detri-ment of Vicon For that purpose they collected data using 10 Vicon infrared cameras (MX cameras)4 digital Basler cameras (DV cameras) and a Vicon synchronizer in order to synchronize between MXand DV cameras The aim would be to prove that Dartish could fairly accurately deliver the location ofthe markers in a laboratory environment For this they decided to compare values such as knee jointangle knee joint moment ankle joint angle and ankle joint moment To perform the data processingthey used the NEXUS software provided by Vicon to perform the 3D motion reconstruction and usedDartfish ProSuite 55 to perform the two-dimensional analysis

Regarding the results the authors showed that the magnitude of the differences in marker positionswas between -10 and 20 mm They also revealed that the difference on the horizontal axis was lessthan the difference on the vertical axis During the Dartfish review process the authors noticed thatthis software always attempted to track a moving marker In cases where the marker was static thesoftware floated around the region where it really was (increasing the error) Regarding the knee anglethe difference between the two systems was 47 while the difference in ankle angle was 131 forthe left ankle and 191 for the right ankle Still the authors recognized potential in the software testedstating that the momentum calculations were very similar to the calculations made by the Vicon systemand that they were associated with many estimations that in a future work should be measured directlyThey further state that the quality of the Dartfish is superior if less visual markers are used indicatingthat only the markers strictly necessary for the movement analysis should be used and these should beplaced at the center of mass of the athletersquos limbs

13

Although Vicon and Qualisys are highly regarded another software used to analyse the videosrecorded by coaches of various sports is ImagePro Plus This software developed by Media Cyber-netics is considered by the developers as an image analysis platform and it is mainly used for medicalimage analysis Like Dartfish the software supports a wide variety of digital cameras and memorycards The authors report that ImagePro Plus tracks moving objects as they move in time and space likecells organisms or visual markers using correlation tracking when image segmentation is difficult or notpossible [15] This process of tracking moving objects can be done either manually or automatically

Quite a few other well known motion capture systems like BTS Bioengineering [19] Swimming Tech-nology Research (STR) [20] Motion Analysis [21] codamotion [22] or Ariel Performance Analysis Sys-tem [23] could have been referenced however they operate in an analogous way to that of the previouslyrefered examples

222 Main Specifications

In this section some of the marketed cameras that perform human motion recognition using visual mark-ers are briefly presented including the camera specifications pricing and the number needed to assem-ble a swimming analysis system

Table 22 shows three of the most reputable brands of swimming analysis cameras as well as theirtechnical specifications and price Through an analysis of the table it is concluded that the Natural Pointcamera is within the three presented the one that offers a lower image resolution with a cost of $15000for each of its equipment On the other hand while the best resolution is achieved with the Qualisyscamera the higher prices are seen in the Vicon cameras A comparison between the Natural Point andVicon cameras was performed by Thewlis et al [24] in 2013 who concluded that when tracking thesame scene the Natural Point system has an overall lower performance than the Vicon system

Table 22 Motion capture cameras specifications [25]

Specification Vicon Qualisys Natural PointCamera model MX-F20 Oqus 7+ Optitrack Flex V100R2Lenses 6x416mm 54x4216mm 12x45mmSensor type CMOS CMOS CMOSSensor dimensions 1600x1280 4096x3072 640x480Price $15000 - $250000 $20000 $15000

On the Vicon website [12] the number of cameras required to assemble a motion capture setup canbe simulated depending on the location size where the motion mapping is to be carried out Thereforethe dimensions of a short 6-lane swimming pool (25m x 15m x 2m) were used to carry out this simulationIt was assumed since there was no other option that the pool is a perfect parallelepiped volumealthough in most cases it has one part where the depth is greater than the other In the first instance 20cameras were used to cover the entire volume of the swimming pool space The heat map correspondingto the obtained result can be seen in Figure 25 In red the area where tracking is excellent (84 of thespace) is shown in yellow where tracking is good (92 of the space) and in green where tracking ispossible (97 of the space) Then a simulation with 25 cameras was also performed For this case thered zone increased to 91 of the total yellow to 96 and green to 100 indicating that it is possible totrack an athlete in any pool place

Finally analyzing the costs using the 20 cameras option at the price of $15000unit would cost aminimum of $300000 for such a setup in a short 6-lane swimming pool This value is of course wellabove the budget of most clubs around the world Thus a viable alternative is needed so that (virtually)every swimmer can use technology to improve his or her performance

14

Figure 25 Swimmer tracking heat map simulation for a Vicon system with 20 cameras [12]

In short using a video-based methodology has limitations that often lead scientistscoaches to in-vestigate and work with other types of devices and methods (using other types of signals) to improvethe athletesrsquo performance assessment in this particular sport

23 Inertial Sensing Approaches

In this section an alternative to the approach described previously in Section 22 is presented Oncewaterproofed inertial measurement units (IMUs) provide several advantages over the signals collectedthrough video in the analysis of dynamic behavior in athletes Firstly because digitization of the collecteddata is not necessary part of the processing may be done directly in the IMU and the remaining post-processing is consequently performed on the computer Secondly it is much more practical as thediscomfort caused by a small attached device is much less than the discomfort caused by a completeswimsuit with visual markers attached to it Thirdly this type of device can in some cases store a hugeamount of information Fourth once the processing is done automatically on the computer the resultsare ready in a very quick and simple way Lastly it is an affordable alternative and every athlete caneasily acquire one Unfortunately it is still forbidden to equip athletes with sensors during competitionsOn the other hand it is still possible to use them during training so that any technical mistakes can becorrected

231 Performance Features

The athletersquos performance is directly and strongly related with his swimming technique An athlete whohas the goal of improving his or her performance must spend some of the training time on improving histechnique [26] In this way there are several indicators that evaluate the swimmerrsquos technique (perfor-mance features) Through these features the coach can infer the athletersquos technical errors causes andcorrect them in order to improve the performance At this moment there are already some IMU-basedsystem prototypes developed mainly by researchers who use inertial data to perform feature extractionSome of the most common perfomance indicators considered in available IMU-based systems will beaddressed in this section

Stroke Type Identification

The 4 different styles of swimming competition have several specific characteristics that allow theiridentification through the obtained accelerometer signals Several researchers have reported good re-sults by positioning the sensor on the swimmerrsquos back (top or bottom) wrist chest or head If the

15

sensor is placed on the back of the athlete the identification of the backstroke style is quite easy whilethe athlete is swimming back the Z axis of the accelerometer (in the anterior-posterior direction of themovement) produces a value close to +1g while in the remaining 3 styles (buterfly breaststroke andfrontcrawl) the value produced by the same axis of the accelerometer is approximately -1g Regardingthe identification of the remaining 3 styles although not as simple there are quite a few features like themagnitude or location of the inflection points that make each style recognizable Many researchers havebeen working to use these features to develop methods that automatically recognize the athletersquos strokestyle In a first instance as in the case of [27] the regions of the plane were empirically divided basedon the energy of each of the accelerometer channels on each lap In turn the authors of [28] used aquadratic classifier to estimate the stroke style that the athlete is swimming in every training momentA total of 42 features of the accelerometry signal were extracted among which are the mean standarddeviation number and amplitude of maximums and minimums zero crossings rate and the correlationbetween the various signals from the 3 accelerometry channels In this study results were very similarto the results reported in the work by Davey et al [27] namely an accuracy of 965 for the stroke stylesrecognition and 898 for the detection of turns (placing the sensor in the upper back of the athlete)and 90 for the stroke styles recognition and 817 for the turnsrsquo detection when placing the IMU onthe athletersquos wrist although only 3 of the 4 competition stroke styles have been used to perform theclassification back crawl and breaststroke Finally by placing the sensor on the athletersquos chest Ohgiet al [29] trained two different classifiers a neural network and a decision tree The neural networkwas trained using a learning rate η = 03 a momentum coefficient α = 02 and 500 iterations with backpropagation This network consists of 4 input nodes (Var (Ax) Skewness (Ay) Mean (Az) Skewness(Az)) 4 hidden nodes and 4 output nodes (the 4 competitive swimming styles) On the other handas regards the decision tree the C45 algorithm by Quinlan (1993) was applied The authors reportedthat the results of both classifiers were similar with around 911 accuracy The biggest problem hasbeen reported in the distinction between backstroke and breaststroke where both classifiers have lowerperformance

Stroke Phase Analysis

There is a significant interest from the coaches in seeing the athletesrsquo underwater stroke so thattechnical problems can be corrected and consequently the athletes have fewer injuries and a betterperformance Thus some researchers have implemented stroke recognition algorithms mostly throughsensors positioned on the athletesrsquo wrists It is the case of James et al [30] whom combined thesignals from the accelerometer and gyroscope placed on the wrist leg and back of the athlete in orderto know which are the most informative in terms of detecting the multiple stroke phases in swimmingThe research was complemented with video images in order to validate the athletersquos movements fromthe acquired signals The article therefore reports that the detection should be based on the mid-lateralsignal obtained through a gyroscope placed on the athletersquos wrist (indicative of pronation and supinationof the forearm) In Figure 26 the accelerometer and gyroscope signals corresponding to four crawlstrokes are shown where the identification of the athletersquos various stroke phases becomes quite obviousThe signals obtained from the accelerometer were used to confirm certain stroke specific events suchas the moment where the athletersquos hand enters the water It is also reported that the athletersquos handexit point from the water (representing an early stroke recovery) is not easily recognized by any of the 3channels of accelerometry as there is no peak (event) that can be identified as such This problem hadalready been reported by several other researchers but the solution may have been found by Dadashiet al [31] Through the use of several sensors positioned on both forearms as well as the lower backof the athlete researchers were able to measure the variation of the angle between the dorsum and

16

both forearms along the stroke It is known that the beginning of the recovery phase begins when thisangle is maximum (between 150o and 175o) Thus a peak detection algorithm was used to perform therecognition of this stroke specific event

Figure 26 Signal obtained on the Y-axis of the accelerometer and gyroscope (ulnar-radial direction)corresponding to 4 frontcrawl strokes extracted from [30]

Another very useful detail was reported by Ohgi et al [32] and concerns the hand entering phasein frontcrawl Through the signal retrieved by the Z axis of the accelerometer positioned on the wrist ofthe athlete it is possible to know if the athletersquos hand is entering correctly on the water If at the time ofentry this value is close to zero the plane of the athletersquos palm makes an angle of 50o to 60o with thewater (ideal position) whereas if this value is much higher the athletesrsquo hand enters practically parallelto the water resulting in a marked deceleration of the athlete In this article it is also reported that theeffects of fatigue can be verified on the acceleration signal In particular the reduction of accelerationduring the upsweep phase is indicative of a weak extension of the elbow which in turn leads to shorterstrokes and a reduction in propulsive movements during stroke

Swim Distance

The distance traveled by an athlete during a training session can be an important feature especiallywhen the athlete trains without the coach supervision Most of the algorithms developed by researchersin this area are essentially based on turnsrsquo detection by knowing a priori the swimming poolrsquos dis-tance the distance traveled by the athlete during the training can be estimated Based on this conceptLe Sage et al [33] placed an IMU on the athletersquos lower back and filtered the raw data obtained from theaccelerometer using a Butterworth low pass filter with cuttoff frequency of 2Hz The result of the filteringis a signal that is practically constant while the athlete is swimming and has a peak (local minimum) atthe instant of time when he performs a turn On the other hand Wright and Stager [34] used a rather dif-ferent method to perform distance estimation throughout a training session Placing two accelerometerson the wrist and hip of each athlete they collected data from 43 different athletes The objective wasto find a correlation between the data obtained from the acceleration and the distance covered by theathlete during the training Through a regression they reported fairly good results (r = 090 p lt 005)Comparing the two ways of approaching the problem we can conclude that both have advantages anddisadvantages although the first method demonstrates to be more consistent and precise when theathlete swims in the pool (since the algorithm knows exactly how long it is) this cannot be used whenhe swims in open water since there are no turns The first method also fails if the athlete performsonly half a turn by reversing the direction of movement in the middle of the pool However when the

17

athlete completes the entire training correctly the distance returned by the first algorithm represents thedistance actually traveled by the athlete while the second algorithm returns only an estimate (which maybe somewhat out of phase with the reality if the athlete has completed many meters)

Lap Time

The lap time is a fundamental feature in monitoring athletes in this sport since it is through thischaracteristic that the winner is determined in a competition Note that it only makes sense to talk aboutlap times if the athlete swims in the pool In this way the lap time is directly related with the detection ofturns and stops during the training Thus a secondary objective is defined to identify the location of thiskind of events ie the problem addressed in the previous feature If these events are easily recognizedthe problem of getting lap time becomes a trivial matter This was done by Davey et al [35] through asensor positioned at lower back of the athlete these researchers reported that after a stop the athletersquosstart is detected as the vertical position of the athletersquos body change with respect to the horizontal onewhile a turn is detected using a zero-crossings algorithm applied to the perpendicular movement axis (Zaxis) once the athlete rotates in the water They also report that the identification of this type of event issimple since there is a rapid and ephemeral acceleration after the wall push-off However the resultsobtained through this algorithm differ somewhat from the results obtained through video comparison(mean difference of minus032 plusmn 058 seconds) This error is due among other less important reasons tothe athletersquos arrival to the wall on the last lap researchers report that it is quite difficult to determine theexact moment of arrival since most athletes finish the last segment with a slip to the wall On the otherhand Bachlin and Troster [36] placed the sensor on the athletersquos wrist The impact of the arrival on thewall at the turns and the final arrival in butterfly and breaststroke styles is much easier to recognizesince they are translated into a drastic reduction of the athletersquos wrist acceleration However in casesof frontcrawl and backstroke since there is no contact with the wall before during or after turns theresults are not so positive The accuracy issue in lap times remains under study since there is still nosufficiently precise algorithm covering all possible cases in all swim stroke techniques

Stroke Count and Stroke Rate

Counting the number of strokes and its ratio is the most explored and improved feature by re-searchers working in this field These indicators can be quite informative about an athletersquos performancesince a high stroke count and rate means that something in his technique is not correct it can be in-dicative of a weak underwater course a weak arm strength or a faint leg kicking In this way severalalgorithms where the purpose is to accurately calculate this feature have been developed Davey et al[35] is one such example having as previously stated placed an IMU on the lower back of the athleteUsing only the Y-axis of the signal obtained through accelerometry the authors of this article were ableto identify the strokes through the rotation of the athletersquos body To do this they low pass filtered thesignal with a Hamming window using a cuttoff frequency of 05 Hz and detected the local maxima andminima This algorithm although quite accurate has some limitations the fact that it is valid only in thestyles of symmetrical execution (as crawl and backstroke) is one of them In the case of breaststrokeand butterfly since there is practically no rotation of the trunk during stroke execution it is not feasibleto count them with such a method On the other hand Beanland et al [37] tried another approachby placing the accelerometer on the athletersquos head Once again localization and local maximum andminimum counting techniques were used The authors of this article reported however that duringfrontcrawl and backstroke athletes tend to keep their heads as static as possible in order to reducedrag this behaviour makes the stroke count impractical Still the results demonstrate that each athlete

18

has their own characteristic pattern of response which may not be synchronized with the movement ofthe arms therefore it is quite difficult to count the strokes in these styles using the accelerometer in thechosen position Finally Chakravorti et al [38] addressed the problem differently using a zero-crossingalgorithm on both the Z-axis and the Y-axis of the accelerometer to perform the athletesrsquo strokes countThe results reported relate to one minute of counts (strokes per minute) and the average errors andits standard deviation are shown in Table 23 Overall the obtained result is quite positive the biggestlimitation is the breaststroke where the algorithm reports on average more 025 strokes per minuteThe best performance occurs as can be seen in frontcrawl in this stroke technique the ratio calculatedby this algorithm is quite reliable since the mean of the estimation error is very close to zero and theaverage standard deviation is the minimum among all the techniques

Table 23 Difference between real-time and hand-computed stroke rates for a lower back mounted IMUextracted from [38]

Stroke Average plusmn SD Standard error of meanButterfly -022 plusmn 1428 0215

Backstroke 019 plusmn 10 0204Freestyle -006 plusmn 082 0145

Breaststroke 025 plusmn 1342 0237

Swimming Velocity

Some coaches are interested in the speed of the athlete in each moment of the training Althoughnot a key feature in assessing an athletersquos performance it is a useful feature to monitor some aspectsthat may be relevant Thus Bachlin and Troster [36] used a previously discussed feature (lap time) andthe a priori knowledge of the pool distance to estimate the average athlete speed in each of the lapsAnother method was reported by Hagem et al [39] where the stroke length (mcycle) is divided by thestroke rate (scycle) giving the athletersquos average speed (ms) Another alternative is to integrate theobtained accelerometry signal in the direction of motion by positioning the sensor on the back of theathlete [40] In this paper Stamm et al [40] reported that the values obtained were within a range of 4of the reference and that the integration error obtained is insignificant (0002 ms2) Finally and in analternative to integrate the accelerometry signal Dadashi et al [41] [42] compared several mathematicalmodels of regression to compute the swimmer speed These methods are much more robust since theydo not require a priori knowledge of the pool size having a wide range of applications also in the worldof open water swimming In the case of the Gaussian regression the obtained relative error was about92 [41] whereas in the Bayesian regression it was 97 [42]

Kick Count and Kick Rate

Just as interesting as having information on an athletersquos stroke statistics it is equally important tohave information on the legrsquos kicking statistics since it is this action that keeps the body stable duringswimming This is also a very hard feature to monitor with video images since leg kicking causes astrong turbulence in the water obfuscating its patternsrsquo visualisation In this way the lower limbs featureshave also been studied by researchers in recent years Although there are some authors who argue thatit is possible to observe the pattern of the leg through a sensor positioned in the lower back of the athletemost researchers defend and prefer to place the sensor in the lower limbs Despite monitoring only thelegsrsquo movement during laps it is a location that provides much more accurate and easily interpretedsignals for the characteristics to be extracted Fulton et al [43] used a gyroscope to track the athletesrsquo

19

leg kick count by placing the sensors at their thigh and shank With a zero-crossings algorithm appliedto the Butterworth low-pass filtered signals the authors of this article obtained errors in the order of59 plusmn 05 (expressed as a coefficient of variation) The algorithm developed by them only classifiesa leg kick as such if it starts at 0 rads has a downbeat phase crosses the 0 rads line has an upbeatphase and returns again at 0 rads (complete cycle) A typical pattern obtained by Fulton et al [43] isshown in Figure 27 However some athletes report that the legsrsquo sensor placement inhibits their naturalmovements pattern Thus Fulton et al [44] positioned a single sensor in the calf of the dominant legtrying to minimize the discomfort felt by the athletes but there are no records of the sensation registeredwith this location To date and according to the articles analyzed only the frontcrawl technique hasbeen object of greater study and research in this area

Figure 27 Typical pattern of a complete leg stroke extracted from [43]

Joint Angular Kinematics

In order to ensure that the stroke and leg kicking patterns and consequently the gesture of eachstroke technique is being correctly performed the joint angular kinematics are measured The aim isto correct these key angles of certain limbs so that the propulsive forces can be maximized and thedrag forces diminished One of the most important angles is the angle of the elbow that the upper armdoes with the forearm During propulsive force this angle should be close to 105 degrees so that theefficiency of motion is as close to the maximum as possible [45] These movements are also quitedifficult to monitor since the propulsive stroke phase occurs under water In this way without the aid ofinertial devices it is quite hard to perceive if the athlete is performing the technique correctly Anotherinteresting and pertinent analysis feature is based on the Euler angles There are 3 Euler angles yawpitch and roll These three angles describe the orientation of a rigid body relative to a fixed referentialFigure 28 shows a representation of pitch and roll angles in order to facilitate their understanding Incase the device is placed on the back of the athlete (either in the upper part or in the lower part) theseangles are very useful since the information about the body balance (pitch) and the body rotation (roll)can be obtained A good body balance is crucial for the athlete to swim efficiently since the drag forcesare drastically reduced There are several reasons that cause a poor body balance a weak leg kickingpoor body tension or poor head posture due to looking upwards instead of aligning spine and head[26] The body rotation in the frontcrawl and backstroke techniques is also quite important since strokelength can be increased once the side-lying gliding position is the position where the swimmerrsquos body

20

undergoes a less water resistance Body rotation is ideally initiated by the leg-kicking Both the upperand the lower parts of the athletersquos body should ideally rotate at the same time as a synchronous rotationresults in a fluid motion In contrast a twist between the top and bottom of the athletersquos body leads toan inefficient stroke path [26] In short these angular measurements can give numerous indications tothe trainer highlighting intrinsic technical problems that the athlete may have

Figure 28 Euler angles - pitch and roll representation extracted from [46]

Another interesting approach is found in [47] in which the authors placed 4 IMUs on the athleteupper arm forearm calf and thigh The data obtained were filtered with a low pass filter using a cutofffrequency of 8 Hz and the aim was to detect the pattern of coordination between the lower and upperlimbs in swimmers with various levels of experience in the breaststroke technique It can be seen fromthe result that the less experienced swimmer flexes and extends the knees and elbows at the same timeon the other hand the more experienced athlete performs the stroke with some anticipation in relation tothe kick in order to increase the slip and speed In contrast while shoulder movement is very useful inswimming especially since it is where many athletes frequently injure themselves there are no relevantstudies in this area However there are studies that analyze shoulder movement in the tennis servicemovement for instance [48]

Kinetic Variables

Some of the variables presented so far are somewhat vague if analyzed by someone who is notknowledgeable on the subject On the other hand kinetic variables are an accurate quantification ofcertain swimming events The acceleration or the force exerted in an arm stroke during the propulsivestroke phase are two good examples of variables that encompass this vast set of kinematics applied tosport Meamarbashi and Hossaini [49] applied the calculation of kinematic variables to soccer through asystem based on inertial sensors they were able to measure the force torque and angular momentumduring a player football shot comparing differences between dominant and non-dominant leg Onevariant of such a system could be applied to swimming it would be quite useful to use sensors positionedon athletesrsquo arms in order to perceive for example the asymmetries that exist in the stroke of each limbHowever the most commonly applied kinematic variables nowadays are the force and pressure plateswhich evaluate the thrust force in the starting block or after a turn [38] On the other hand Anthony IIIand Chalfant [50] have patented a system where one of the goals is to determine the force producedduring each stroke using Newtonrsquos second law F = (m times atotal) + Fd where Fd represents the dragforce that the water exerts on the athlete This frictional force depends on the fluid density (water)the athletersquos speed the drag coefficient and the area of the athletersquos arm The total acceleration (atotal)corresponds to the acceleration norm where the signals corresponding to the 3 accelerometry channelscollected during the movement of the athlete are used Unfortunately there are no results yet for thissystem and therefore its performance is unknown However this type of kinetic analysis using inertial

21

sensors represents an excellent alternative to the methods used today which involve very complex andexpensive equipment that are not within the reach of all athletescoachesclubs

232 Sensor Placement

Choosing the location of the sensor as well as how it is attached to the athletersquos body is a concern forresearchers who develop this type of devices It is important that the athlete feels comfortable and thatthe device placement does not harm the stroke mechanics On the other hand it is also important thatthe sensor is close to the athletersquos body so that the measurement error introduced by the sensor move-ment can be as minimal as possible As such and in a research context authors normally use methodsthat range from tapingstrapping or wrist-watch style bands to suits with built-in sensors Unfortunatelyin the vast majority of cases they end up not discussing the relationship between the athletersquos comfortand the error introduced by sensor movement at a given body location

The disposition with which the device is placed on the athletersquos body is also a subject of great rele-vance most researchers develop the system and the data post-processing algorithms requiring that thedevice is always placed in the same position the objective is that the arrangement of the coordinatedaxes is in agreement with the planned one However there are still some researchers who put the sen-sor in a random position deducing it later through the movement of the athlete It is the case of Michaelset al [51] whom placed the sensor on the athletersquos cap attempting to extract features such as distancelap time or stroke rate However even using advanced techniques of data post-processing they didnot obtain the expected results since for example the error between the estimation made through thepost-processing algorithm and the actual data in the mean swim distance was 41 while the actualmean was 5678 meters per training session the device detected only 3339 meters

The exact location where the inertial unit is applied is also a very important decision and dependson the features that are intended to be extracted from the athlete It is impossible to extract featuresabout the athletersquos leg movement if the device has been placed on his arms or head for instance Table24 shows some of the characteristics that can be extracted from the athlete through inertial sensingThrough an analysis of this table it is possible to verify that while the positioning of the device in thetrunk or in the head allows one to deduce enough useful characteristics to provide to the trainer andathlete when the inertial measurement unit is placed in the arms or the legs this extraction becomesvery specific it mostly serves to check for strokes or kicks still it is quite relevant and useful in the caseof some athletes with those specific types of problems (as previously discussed)

Table 24 Feasibility of extraction of common features taking into account the positioning of the sensorin front crawl [46] ++ + and - indicate respectively that a certain feature is easily possibly or hardlyextracted from the location in question

Feature Trunk Head Arms LegsLap count and timing ++ ++ ++ ++Overall momentum ++ ++ - -Stroke count + + ++ -Body roll ++ + - -Breathing patterns + ++ - -Arm anti-symmetry - - ++ -Leg anti-symmetry - - - ++

However not even the indicators presented in the Table 24 are consensual Researchers haveargued through experimentation that placing an inertial measurement unit on the head (inside theathletersquos cap or goggles) only proves useful if the swim style is butterfly or breaststroke [37] In the caseof backstroke and front crawl since the athlete should keep the head as static as possible it becomes

22

quite complicated to perform body rotation or stroke count analysis for instance

There are also some researchers who use simultaneously multiple inertial measurement units notonly to extract as many features as possible but also to perform a kinematic analysis of the athletersquosmovement (elbow angle or range of leg movement patterns are some examples) Still there is a tradeoffbetween the number of sensors that are placed on the athletersquos body and the drag discomfort strokemechanic alteration and posterior signal processing and transmission complexity [30]

This way it can be concluded that there is no fixed location where the sensor can be positionedenabling all features to be extracted However the most favorable location and where more character-istics can be extracted is the trunk Still there are two possible positions for the trunk the device can beplaced on the top or bottom of it

233 Inertial-Based Commercial Systems

Some brands such as Garmin or FINIS have been betting in recent years on the usage of inertialsensors to analyze the performance of swimmers Most of these devices are designed to be used onthe wrist and promise to accurately return some of the features discussed above In this section someof the devices currently commercialized and in the development phase will be analyzed

In Table 25 some of these devices as well as the features that their developers promise to deliverare listed The devices better known and used by recreational or competitive swimmers are FINISand Garmin (wrist-worn devices) probably because they were developed and commercialized by well-reputed brands As can be seen from Table 25 these products are quite identical in the providedfeatures

Table 25 Commercially available wearable devices along with provided features (adapted from [1])

Feature FINIS Swimsense Garmin Swim Swimnovate PoolMateHR InstabeatTime D D D DStroke identification D D D DStroke count D D DStroke rate D D DStroke length D DLap time D D D DAverage speed D D DKick countKick rateDistance D D DHeart rate D D

Thus Mooney et al [52] made an exhaustive comparison between these two products asking 10athletes to swim 1500 meters in a short course pool (25 meters) using both devices In total 15000meters (6000 laps) of the various techniques were collected for subsequent statistical analysis Alldata were collected along with two action cameras in order to corroborate the data collected by bothdevices Regarding the recognition of the stroke technique although both devices showed very goodresults it is concluded that FINIS is as a general rule more precise yielding an accuracy of 972 forbutterfly 889 for backstroke 992 for breaststroke and 100 for frontcrawl Garmin presented anaccuracy of 949 for butterfly 988 for backstroke 86 for breaststroke and 983 for froncrawl Thestandard error of mean was the criterion used to compare the features discussed hereafter As for laptimes the results between the two devices are quite similar while Garmin obtained a standard error ofmean of 0321 for butterfly 0258 for backstroke 0268 for breaststroke and 0390 for frontcrawl FINIS

23

obtained 0518 for butterfly 0244 for backstroke 0271 for breaststroke and 0202 for frontcrawl Theerror is obtained in relation to the time in seconds Finally in relation to the strokes count the resultswere once again very similar Garmin obtained a standard error of mean of 0183 for butterfly 0110 forbackstroke 0152 for breaststroke and 0192 for frontcrawl while FINIS obtained 0186 for butterfly 0106for backstroke 0145 for breaststroke and 0096 for frontcrawl Although the article also addresses theerrors related to stroke rate stroke length and average speed it was decided in this context to addressonly the ones previously described due to their relevance and to the fact that Garmin was not evaluatedin the stroke rate and stroke length It may however be noted that the errors relating to the non-analysedfeatures are in the order of magnitude of the presented ones It is therefore concluded that there is noreported device better than the other However FINIS returns more features to the user as highlightedin Table 25 It should be noted that in order to obtain the distance covered during the training bothin the case of Garmin and in the case of FINIS it is necessary to pre-set the pool length This meansthat the distance is most probably calculated based on the execution of the turns and not based on thedouble integration of the acceleration signal

Although not as well known in the market as the above mentioned the Swimnovat PoolMate HR(wrist-worn device) is the one that among the four presented provides more features to the user How-ever the price of this device is slightly above the prices of Garmin and FINIS In addition to the PoolMateHR Swimnovate also markets PoolMate 2 PoolMate Plus and PoolMate Live Unfortunately there areno publications that report on the accuracy of the features provided by this device [53]

Finally Instabeat is a device that presents a totally different concept from the remaining three Al-though it has apparently already been marketed the product created by Hind Hobika is no longer cur-rently available However the idea of the company which used crowdfunding to fund its project is quitedisruptive this device will be placed on the athletersquos swimming goggles and will measure through thesuperficial temporal artery the swimmerrsquos heart rate in real-time recurring to an optical sensor Theproductrsquos developer claims that this device will fit all types of goggles so that the athlete can use theequipment to which he is accustomed to This device can be programmed in line with the training mo-ments tasks and then according to the heart beat of the athlete the device presents one of threedifferent colors red if the heartbeat is above the planned one green if it is within what was supposedand yellow if it is below the intended This information is presented in a LED placed in front of the ath-letersquos goggles While the main feature is the real-time heart rate monitoring the Instabeat accordingto the founder will collect and save in a memory module some other features such as the stroke styleidentification average speed number of laps stroke number among others for later analysis Hobeika[54] announces on the website that the product would be marketed in the spring of 2018

It should be noted that some important and informative features were not mentioned on the tablebecause they are still devalued by professionals in the field The athletersquos body rotation (roll) the incli-nation of the athletersquos body plane in relation to the waterrsquos plane ie body balance (pitch) or the rangeof movement during strokes (symmetrical techniques) are some of these very informative features thatcontribute to the athletersquos performance improvement

24

Chapter 3

Proposed Approach

In Chapter 2 a brief description of the state-of-the art in the swimming engineering area was made Itwas concluded that while video approaches are impractical expensive and not so efficient existing iner-tial sensing approaches are at an early stage of development lacking multiple relevant features Duringthe execution of this dissertation several contacts were established with a Norwegian research group(researchers and professors at the Norwegian School of Sport Sciences) as well as with a professor ata Portuguese sports academic institution (Escola Superior de Desporto de Rio Maior) whom have beenworking in the field for many years From both parts the feedback regarding the athletersquos body rotationangle body balance and symmetrical techniques movement range features was similar reporting thelack of some of these indicators in the currently available devices They also report that even in thesophisticated video systems that they have installed in their swimming pools this type of information isnot available There is therefore a need to create a precise and efficient system that includes all thisimportant information and meets the needs of all types of swimming clubs and athletes around theworld

A new inertial signal acquisiton system setup is proposed in this chapter with the aim of helpingcoach and athlete in improving performance In order to evaluate the athletersquos performance during hisdaily workout it is necessary to first develop a prototype that collects the data of the athletersquos swimmingmotion and secondly an algorithm that processes the data quickly and efficiently so that the result canbe easily interpretable by athlete and coach It is also important given the fairly high costs of the previ-ously presented systems that this can represent a viable alternative for all athletes (ie it is importantthat the developed system can be affordable) For this purpose we selected as base development toolthe BITalino R-IoT a device that integrates the necessary base characteristics for the acquisition of thistype of signals at an affordable cost and with high versatility of hardware components which facilitatetheir use and potentiate the development of new projects and applications In terms of data processingMatLab was used - a high-performance interactive software for numerical computation that proves to bevery effective in the area of signal processing and also has a variety of toolboxes that can be used indifferent engineering contexts

The entire acquisition system and subsequent data processing workflow developed in the contextof this dissertation are presented and explained in this chapter In Section 31 the chosen device aswell as all changes made to adapt it to the aquatic environment are presented In Section 32 both thedevice location on the athletersquos body the database and its acquisition protocol are approached Finallyin Section 33 the data processing algorithm is introduced which is in turn is composed of severalsub-algorithms that perform featuresrsquo extraction

25

31 Device and Adaptations

As a result of what has been previously discussed in Section 311 the device chosen to develop theprototype will be presented as well as its whole operation mode Section 312 presents a real-timecommunication hypothesis approach as well as all the performed modifications so that the device is ableto collect signals in the aquatic environment

311 BITalino R-IoT

To support this project a device developed at the Institut de Recherche et de Coordination Acoustique Musique (IRCAM) in collaboration with PLUX - Wireless Biosignals SA known as BITalino R-IoT wasselected [55]

The R-IoT is based on the Texas Instruments CC3200 chipset and is programmed through the En-ergia IDE (developed to simplify the programming of Texas Instruments microprocessors) which closelyresembles the IDE developed for Arduino [56] This model includes a temperature sensor and an in-ertial measurement unit (IMU) composed of an accelerometer gyroscope and magnetometer each ofthese triaxial allowing the calculation of the absolute orientation (attitude) of the module in space Thiscalculation is performed based on the Madgwick algorithm [57] which will be further presented Thecollected data is packaged as Open Sound Control (OSC) messages and sent via Wi-Fi (through UDPprotocol) to a given IP and on a given port (previously defined) [55] It is also possible to connect thisdevice to the standard BITalino board in order to measure for example Electromyographic (EMG) orElectrocardiographic (ECG) signals among others although this feature was not used in this work

This device can be connected to BITalino via serial port communication based on the UART protocolor it can operate by itself (standalone mode) In the scope of this work the device is operating in thestandalone mode using the serial port for interfacing with a data logger that records data onto a memorycard

In Figure 31 the device is represented together with the coordinated axes relative to the data col-lected by the IMU It should be noted that the axes have been designed to respect the right-hand rule

Figure 31 BITalino R-IoT and its coordinate axes relative to the accelerometer gyroscope and magne-tometer

26

Wireless Communication System

BITalino R-IoT has a 24 GHz Wi-Fi transmitter that sends amongst other parameters the data col-lected by the inertial measurement unit This data is sent to an Internet Protocol (IP) address and toa certain port previously chosen by the user Although not mandatory to configure these parametersthe user can access a web page created by the device on a local server on this page parameterssuch as the destination port receiverrsquos IP address device sampling frequency or the network name towhich the device will connect to send the data (SSID) can be adjusted The device can operate bothon a local network or over the internet if necessary Therefore in order for the data to be successfullyreceived by the user both the device and the receiver (PC) must be connected to the same network(SSID) the computerrsquos IP must be the same as previously set for the data sending and the receivermust be listening to the previously defined port By default the R-IoT is pre-configured to send data toIP 1921681100 through port 8888 [55]

OSC Protocol

Open Sound Control (OSC) is an open transport-independent message-based protocol developedfor communication among computers and some other multimedia devices [58] The transmission unitof OSC is designated as an OSC Packet Any application that sends OSC Packets is an OSC Clientany application that receives OSC Packets is an OSC Server The underlying network that delivers anOSC packet is responsible for delivering both the contents and the size to the OSC application An OSCpacket can be naturally represented by a datagram sent through a network protocol such as UDP [58]Through this type of protocol various types of data can be sent Integers floats or strings are just someexamples In the scope of this work only integers and floats will be sent

Since the R-IoT can be used to extend the capabilities of standard BITalino (r)evolution devicesthis system sends two different messages through OSC one where the information acquired using astandard BITalino (r)evolution is aggregated and another containing the data from the onboard sensorsof the R-IoT (eg IMU) Of course when the device is working in standalone mode only the IMU datamessage is sent In Table 31 the data variables that compose each of these OSC messages are shownas well as the units in which they are sent (if applicable) and their output range The first nine floatsare occupied by the core of the inertial measurement unit each of the inertial sensors (accelerometergyroscope and magnetometer) has three axes which in turn generate an output value at each samplinginstant The tenth float corresponds to the temperature measured in oC The eleventh and twelfth valuescorrespond to integers that report the devicersquos push buttons status (ie flash and mode buttons) theycan only take the value 1 (if pressed) or the value 0 (if released) The thirteenth and fourteenth floatsalso take only integer values as they correspond to the device analog inputs these inputs are usedto connect any analog sensor to the board (eg EMG or ECG) and have a maximum resolution of 12bits The following 4 floats are reserved for the 4 quaternions these variables are computed based onthe Madgwick algorithm which will be duly addressed further as well as the physical meaning of thesedata Finally the last 4 floats store the three Euler angles (discussed in Section 231) and HeadingHeading is a measure taken from the magnetometer which indicates where the device is pointing to ateach instant with respect to the earthrsquos magnetic pole this variable returns 0o for North 90o for East-180o or 180o for South and -90o for West

For reference when the R-IoT is connected to BITalino the second packet contains 11 integers asequence number 2 digital inputs 2 digital outputs and 6 analog inputs

With regard to the reception and subsequent processing of the data sent by the device a free soft-ware called OpenSignals is available For simplicity reasons in the original firmware sample time is not

27

Table 31 BITalino OSC message data along with its output units and range

Data Output range3- axis accelerometer [g] -8 +83-axis gyroscope [os] -2 +23-axis magnetometer [gauss] -2 +2Temperature [oC] -40 +125Switches 0 1Analog Inputs 0 4095Quaternions -1 1Euler angles and Heading [o] -180 +180

sent in the OSC packet Instead the software receives the sampling frequency assuming that none ofthe packets are lost in the process In OpenSignals it is possible to monitor in real time the signals ac-quired from the 22 available channels and after acquisition save them to a file Due to some changesmade to the original firmware this software is not used in the context of this thesis In all performedtests Matlab was used for data acquisiton and processing

Madgwick Algorithm

Developed by Sebastian OH Madgwick this algorithm aims to efficiently calculate the orientation ofa rigid body in space The underlying motivation is to derive an accurate estimation of the positioningof a rigid body that serves multiple purposes from unmanned aerial vehicle (UAV) navigation mobiledevices autonomous underwater vehicle (AUV) navigation or human body motion tracking [59] It isapplicable to inertial measurement units (IMU) data composed of accelerometers and gyroscopes aswell as magnetic angular rate and gravity (MARG) sensor arrays The MARG sensor is a hybrid IMUwhich incorporates a tri-axis magnetometer

An IMU alone can only measure an attitude relative to the gravitic acceleration vector incidencewhich is sufficient for many applications MARG systems also known as AHRS (Attitude and HeadingReference Systems) are able to provide a complete measurement of orientation relative to the graviticacceleration vector incidence and the earthrsquos magnetic field [57] In recent years many algorithms thataim to estimate the orientation of a rigid body using magnetic and inertial sensors have been developedThese algorithms mainly use the extended Kalman filter or the complementary filter However althoughthey are quite accurate there are some disadvantages related essentially with the high computationalneeds that most inertial measurement units do not have Madgwickrsquos algorithm tries to overcome thisobstacle by creating a computationally light alternative but equally efficient and accurate For this and interms of minimizing functions Madgwick used the gradient descent algorithm since it is quite simple toimplement and is also computationally efficient In particular through the gradient descent algorithm andthe IMU collected data it is possible to obtain the quaternions associated with the rigid body orientation

The main goal of the Madgwickrsquos algorithm is the computation of the three Euler angles One simpleway of doing this calculation is to use the quaternions A quaternion is a four-dimensional complexnumber which can be used to represent the orientation of a rigid body or coordinate frame in a three-dimensional space Thus there are 4 quaternions to calculate which lead in a simple way to thecalculation of the Euler angles In Equation 31 the relation between the quaternions and the Eulerangles is represented In the expression φ represents yaw θ represents roll and ψ represents pitch q0

28

q1 q2 and q3 represents in turn the 4 quaternions

φ

θ

ψ

=

arctan

(2(q0q1+q2q3)1minus2(q22+q32)

)arcsin (2 (q0q2 minus q3q1))arctan

(2(q0q3+q1q2)1minus2(q22+q32)

) (31)

Since the optimization algorithm is the gradient descent there is a parameter to adjust (β) thisparameter represents the gyroscope measurement error expressed as the magnitude of a quaternionderivative Madgwick et al [57] also computed for different cases the optimum value of this parameter(the value that leads to the convergence of the algorithm in a smaller number of iterations) Throughsome tests Madgwick reported that the static RMS error is less than 08o while the dynamic RMS erroris below 17o These values indicate a very high precision leading to an implementation of this algorithmon the device used in the scope of this work [57]

312 System Adaptations

This section presents all the performed changes in order to adapt the device to the aquatic environmentand to its subsequent limitations First the hypothesis of a real-time communication between athlete(through the device) and coach is approached and presented Then the devicersquos firmware and hardwarechanges in order to store the collected data on a memory card are also approached

Real-Time Communication

Since data collected and processed by the device is sent by default over Wi-Fi in the 24 GHz bandthe possibility of a real time communication with the coach has been studied In this way the coachcould access the athletesrsquo times as well as their performance features in order to tune them in realtime However according to [60] the propagation of wireless signals in aquatic environments is quitecomplex since this type of signals are strongly attenuated by the environment at short propagationdistances In this way for device performance tests purposes the software made available by PLUXfor data acquisiton and recording (OpenSignals) can not be used since as mentioned it assumes thatall sent packets arrive at the receiver within a pre-defined time frame To analyze the data loss a firstchange was made to the device original firmware the sample time was added to the OSC packetTherefore with this change there are now 23 parameters sent by the device instead of 22 Thus it isno longer possible to use OpenSignals software for receiving and processing the data since the packetsdo not follow the variables number and order required by the software As such and in order to receiveand process data support scripts have been developed in Matlab the first to receive OSC messagesuninterruptedly and save them to a specific variable the others to compare the incoming messages withthe ones stored on the memory card to determine the loss rate according to certain variables such asthe device distance or depth

Data Logging

Although the real-time communication hypothesis was a goal it was decided to have a guaranteedeffective alternative for the reception and subsequent storage of collected data In addition in orderfor the tests performed on the behavior of the device and its loss rate in the aquatic environment to bepossible there would have to be a comparison term (or ground truth) Thus in the case of our selectedplatform two possible solutions were found the first would be to incorporate a wireless signal receiver

29

(eg a mobile phone) together with the device into a waterproof bag so that the signals could beimmediately received and recorded to a memory card for posterior analysis another solution althoughmore complex would be to make small changes to the device hardware and firmware so that data couldbe saved directly onto a memory card

The second case corresponds to the selected approach building upon the work by Reis and Silva[61] in which the OpenLog hardware base was selected as the memory card interface the R-IoTfirmware was modified so that the acquired data could be sent through the serial port and saved directlyonto the memory card The communication between both devices would occur through the UniversalAsynchronous Receiver-Transmitter (UART) interface In a very summary way the UART allows full-duplex bi-directional asynchronous communication between two devices through the serial port Eachdevice needs to have in addition to the power pins one transmitter (TX) and one receiver (RX) linesIn this way by connecting the TX pin on one of the devices to the RX pin on the other device and viceversa it is possible to establish the communication between both using this interface When one of thedevices is not configured to work with this type of interface or if one wants the communication to be donewith several devices simultaneously it is common to use empty pins (not previously programmed) to dothis type of functionality through software

In this way the solution implemented for this work uses a SparkFun OpenLog datalogger to save theR-IoT data stream Its main features and specifications are discussed at the end of this section

In a first instance the goal was to save all the data acquired by the R-IoT onto the memory card ata sampling frequency of 100 Hz Therefore the acquisition time the temperature the 3 axis of eachof the sensors of the inertial measurement unit the quaternions the three Euler angles heading andsome auxiliary data (such as analog and digital inputs and outputs) were being saved However itwas noticed that if on one hand certain sampling instants were missing on the other hand quite afew instants were incomplete usually missing the last variables Thus instead of a desired samplingfrequency of 100 Hz an inconsistent sampling frequency was being obtained while some of the timesthe data were recorded at 10 ms intervals (as expected) other times they were stored at 20 ms intervalscausing the sampling frequency to drop from 100 Hz to 50 Hz It was also noted that in this case thedata recorded on the memory card did not correspond to the actual device motion that is the recordeddata did not correspond to reality By way of example if the device were rotated by 90o the R-IoT wouldonly register about 80o This happened because the amount of data being sampled sent and recordedat any given time was delaying the device main loop causing not only certain cycles to be skipped butalso an incorrect and delayed sensor reading leading to a corrupted data writing To address this issueit was decided to reduce gradually and in a priority way the number of variables to be stored as well astheir precision Finally it was concluded that to obtain a stable sampling frequency of 100 Hz over a longperiod of time it is only possible to store the sampling time [ms] the 3 axes of the accelerometer [g]gyroscope [os] and magnetometer [gauss] and the three Euler and the heading angles [o] these are thestrictly necessary variables to capture the athletersquos movement In addition these variables are storedwith a maximum precision of 2 decimal places Thus at each instant of time 14 variables are recordedinstead of the 23 initial ones The greater the amount of data to be logged at each instant of time thelower the sampling frequency has to be used since the data storage process is very time consuming

The files are written to a memory card in Comma-Separated Values (CSV) format in a file of thistype each line corresponds to a sampling instant and within the same instant the different variables areseparated by commas In this way the subsequent reading of the files by the data processing softwarebecomes quite simple In Listing 31 an excerpt of a file recorded by the datalogger is shown the showndata was collected and processed by the R-IoT The first line was added to indicate the order in which thevariables are written to the file By way of example Ax represents the x-channel of the accelerometerGy the y-channel of the gyroscope and Mz the z-channel of the magnetometer

30

In order to be later used by others the developed firmware has been made available as open sourcecode 1

Listing 31 R-IoT CSV example filetime yaw pitch roll heading Ax AyAzGx GyGzMx MyMz

135400 -032 006 -051 -4695 -012 -048 086 -002 -000 -000 015 016 -003

136400 -064 007 -106 -4699 -009 -047 085 -002 -001 -000 015 016 -003

137400 -095 006 -165 -4509 -009 -048 088 -002 -001 -000 015 015 -003

138400 -127 002 -231 -4514 -005 -046 092 -003 -001 -000 015 015 -003

139400 -156 004 -311 -4520 -009 -048 087 -005 -001 -000 015 015 -003

140400 -186 011 -395 -4525 -006 -052 096 -005 000 000 015 015 -003

141400 -214 017 -505 -4531 -009 -055 113 -008 -000 000 015 015 -003

142400 -248 023 -660 -4875 -009 -066 131 -012 -000 -000 015 017 -004

143400 -284 021 -887 -4887 -025 -062 116 -020 -002 -001 015 017 -004

144400 -323 -005 -1169 -4895 -024 -059 081 -025 -004 -002 015 017 -004

145400 -364 -036 -1476 -4895 -024 -055 039 -027 -004 -003 015 017 -004

146400 -409 -061 -1771 -4960 -015 -056 020 -026 -003 -004 016 016 -009

147400 -453 -088 -2032 -4984 -002 -054 026 -022 -002 -003 016 016 -009

148400 -492 -109 -2251 -5000 015 -052 056 -019 -000 -001 016 016 -009

149400 -518 -115 -2459 -5008 026 -057 078 -019 001 001 016 016 -009

150400 -529 -089 -2686 -5012 018 -071 069 -020 003 003 016 016 -009

151400 -539 -037 -2911 -5621 009 -080 068 -020 004 005 015 020 -011

152400 -550 027 -3137 -5620 002 -085 067 -020 005 005 015 020 -011

153400 -559 103 -3369 -5619 -017 -092 053 -020 005 005 015 020 -011

154400 -569 171 -3599 -5618 -034 -097 023 -020 004 004 015 020 -011

155400 -581 219 -3792 -5616 -042 -094 -014 -016 002 002 015 020 -011

156400 -606 258 -3920 -5854 -036 -088 -018 -009 002 001 016 019 -016

157400 -641 294 -3997 -5858 -027 -086 -002 -004 003 000 016 019 -016

158400 -686 321 -4024 -5859 -015 -086 031 001 003 -000 016 019 -016

159400 -727 325 -4036 -5860 -004 -089 059 001 001 -000 016 019 -016

160400 -759 330 -4060 -5861 -006 -095 056 000 000 000 016 019 -016

Data logger

The data logger chosen to perform R-IoT data storage was the SparkFun OpenLog A representationof this device is shown in Figure 32

(a) Front (b) Back

Figure 32 SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a serial connection with anonboard ATmega328 running at 16MHz It supports both FAT16 and FAT32 SD formats and microSDcards from 512MB to 32GB This device can be easily programmed as an Arduino in this way the userchooses the firmware to put in the device In the scope of this work the minimal firmware provided bythe manufacturer is used 2

1httpsgithubcomPIA-Groupfirmware-bitalino-riot-openlog2httpsgithubcomsparkfunOpenLogtreemasterfirmwareOpenLog_FirmwareOpenLog_Minimal

31

32 Data Acquisiton

Given the device presented in Section 31 this section intends to show how it can be used In Section321 its position in the athletersquos body is approached so that in light of what was referred in Section 231the maximum number of features can be extracted providing the minimal discomfort to the swimmerReal data were collected from several athletes with various levels of experience The information aboutthe athletes as well as the data acquisition protocol is presented in Section 322

321 Body Positioning

Taking into account what was discussed in Section 23 and since it was necessary to choose a locationfor the device placement it was decided to place it on the athletersquos lower back In this way the identifi-cation of the stroke turns stops stroke count body rotation among other characteristics can be easilyextracted as can be concluded through Table 24 In Figure 33 it is possible to observe firstly an athletewith the device placed on the lower back (Figure 33a) and secondly a representation of the athletersquosbody as well as the device together with the respective coordinated axes system that accompany himin his movement while swimming (Figure 33b) In this way it can be concluded that the X-axis points inthe direction of motion the Y-axis points in the lateralside-to-side direction and the Z-axis in the verticaldirection The device has been placed inside a sealed bag so that it is not impaired by the aquatic envi-ronment To attach the device to the athletersquos body a kinesiology tape was used Although not designedto serve this kind of purpose this tape is quite strong elastic and water resistant The athletes indicatedthat they felt comfortable with the presence of the device describing that it would be the most practicaland least inconvenient place to have it in the daily training

(a) Experimental setup with the deviceplaced on the back of an athlete

(b) Body reference frame for a swimmer where X Y and Z are the for-ward side-to-side and vertical motions of the swimmer respectively(adapted from [10])

Figure 33 Device placement on the athletersquos body

322 Database

STD Accuracy In order to prove the good functioning of the device and the developed algorithm real-world data were collected in a 25 meter pool with athletes of various ages heights weights and expertiselevels Table 32 shows the personal demographic data of the athletes who participated in this study Theimages as well as the biometric signal collection was obviously done with the consent of all athletes As

32

can be seen from the table the collected data set is quite diverse although it is not very extensive Datawere collected from swimmers and triathletes ranging from 18 to 29 years of age with various levels ofexperience and different swimming techniques and turning habits so that the system was tested at alllevels and proved to work with all types of athletes and technical aspects

Table 32 Characterization of the population enrolled in this study

Age [years] Gender Height [cm] Weight [kg] Expertise LevelAthlete 1 18 M 178 615 National triathleteAthlete 2 18 M 180 742 National triathleteAthlete 3 18 M 174 63 National triathleteAthlete 4 20 M 175 65 Retired swimmerAthlete 5 18 F 164 57 International triathleteAthlete 6 18 M 172 60 National triathleteAthlete 7 29 F 168 58 National triathleteAthlete 8 21 M 177 67 International triathleteAthlete 9 24 M 178 74 Retired triathlete

Athlete 10 25 M 172 60 Retired triathleteAthlete 11 20 M 170 60 International triathleteAthlete 12 18 M 168 55 National triathleteAthlete 13 23 M 182 71 International triathletemicro plusmn σ 208 plusmn 35 - 1737 plusmn 53 635 plusmn 63 -

Each athlete was asked to swim 100 meters of each technique resulting in a total of 400 meters Noother type of requirement has been made in either the swimming techniques order or in the number ofstops made during the signal collection process This is because the algorithm is capable of recognizingeach stop and isolating each segment individually for later analysis and processing In this way eachathlete swam each segment in the order they wanted and stopping as many times as necessary How-ever two athletes reported failing to complete the intended protocol one of them swam only 50 metersbutterfly of the 100 inteded ones and the other swam 50 meters of each stroke style first and another100 meters of frontcrawl totaling at the end 50m butterfly 50m backstroke 50m breaststroke and 150frontcrawl

Thus a total of 202 laps were obtained 48 butterfly laps 50 backstroke laps 50 breaststroke lapsand 54 frontcrawl laps The inertial data collection was accompanied by a video footage in order tocorroborate the information outputed by the system However no image processing technique was usedto assist the system in the provided features computation

33 IMU Data Analysis System

The goal of the data processing algorithms developed in this dissertation is to empower both athleteand coach with the ability to analyze not only the swimmerrsquos technical movements but also his perfor-mance throughout the training The developed algorithms should be very efficient not only becausethey may have to be implemented in a small microcontroller but also because the results must be readyfor immediate analysis A Matlab script was created with the aim of analyzing and extracting sufficientinformation from the athletersquos movement always taking these considerations into account Figure 34shows the processing workflow of the developed algorithms in particular the several modules of theproposed system can be observed In the first module the required variables for the correct executionof the algorithm are defined these variables include the length of the pool the name and path of the fileto be processed the signal time window among others In the second module the CSV file containingthe data to be processed is loaded this data is thus stored in the Matlab workspace Then the third

33

phase consists of finding swimmerrsquos turns and stops so that the swimming segments can be isolatedand processed later the entire process is approached on Section 332 In a fourth phase and as soonas the stop and turn identification ends the stroke the athlete is swimming in each lap is estimated(approached in Section 333) In a fifth phase and according to the stroke estimated on the previousmodule the number of strokes that the athlete gave in each of the laps is counted The developedmethod is also explained and discussed (Section 334) Then and based on all the previous process-ing phases a final features extraction is performed these performance indicators become simple tocompute concerning the previous data processing Performance indicators such as the athletersquos swumdistance trunk elevation and body rotation body balance turns and stops statistics are computed inthis final module Each provided feature as well as its description and computation algorithm is listed inSection 331 Finally the collected and processed signals as well as some relevant events such as thestart and end of each turnstop are ploted in case the coach wants to analyse each collected signal andgo beyond the presented features

Figure 34 IMU data analysis system architecture

331 Performance Indicators

In this section all the performance indicators provided by the further explained and discussed IMU dataanalysis system are presented The performance indicators considered for the developed system are

bull Turns and Stops Statistics Taking into account that turns represent one of the four swimmingsegments it is very important to improve their execution so that the shortest possible time is spentin this phase of the race Thus the duration of each turn and stop throughout the training isprovided to the trainer as well as the duration and location of the most time-consuming turn

bull Stroke Technique Based on the discussion of Section 333 the stroke style the athlete swims ineach of the laps is also given to both swimmer and coach which is an important feature for timecomparisons for instance

bull Lap Time The lap time is computed based on the turn and stop identification (presented in Section332) For the result of this feature to be reliable and accurate the time the athlete spends stoppedcan not be counted in lap times Thus turns and stops are processed differently to compute laptimes Therefore in a lap that begins and ends with a turn the time is calculated from the minimumin the pitch signal referring to the turn that starts the lap to the minimum of the turn that finishes thelap In the case where the lap is preceded by a stop the time is counted from the moment the stopis given as finished (criterion stated in Section 332) on the other hand if the lap is preceeded orsucceeded by a stop the time is counted until the stop ends or begins respectively

bull Stroke Count The number of strokes at each lap for any of the 4 swimming stroke styles iscomputed when executing the script The developed algorithm is presented in Section 334

34

bull Stroke Rate The stroke rate is computed in two distinct phases Firstly the average arm strokeperiod is computed Secondly the inverse of this value is calculated which is then multiplied by60 so that the result is computed in strokesmin Thus it is much simpler to compare rhythms atdifferent training moments in which the applied intensities may differ It should be noted that thiscalculation was not based on the number of strokes given in a certain lap as a function of the timetaken in that same lap (that calculation would be wrong since it is not a real stroke rate) Thusonly analyzing average times between consecutive strokes it is possible to obtain a real estimateof the average stroke rate in each of the performed laps

bull Trunk Elevation The trunk elevation is a feature only applicable to symmetrical stroke techniquesie breaststroke and butterfly It consists of the difference between the maximum and the minimumpitches within an arm stroke cycle Thus a notion of the athletersquos trunk elevation in each executedstroke can be taken While a poor trunk elevation of the torso leads to a hard stroke recovery anexcessive trunk elevation represents not only an unnecessary expenditure of energy but also slowsthe athletersquos motion The average trunk elevation at each lap is also computed It is importantto note that in the reviewed state-of-the-art there was no mention to this type of performanceindicator while coaches mentioned it as providing important information

bull Body Balance The body balance or pitch angle is a very important and indicative performanceindicator of several structural problems in an athletersquos technique A weak leg kick during frontcrawlresults in a too low pitch angle for instance There are two ways to present this indicator dependingon the type of style the athlete is swimming In the case of non-symmetrical styles (ie frontcrawland backstroke) the goal is to keep a pitch constant and close to 0o In this way when the athleteswims these stroke styles the average lap pitch is computed On the other hand in the caseof symmetrical styles (ie breaststroke and butterfly) the pitch varies greatly during each strokeexecution Thus in these cases a vector of maxima and a vector of minima whose size is equalto the number of strokes performed by the athlete in a given lap is returned Thus for all givenstrokes in a lap it is possible to analyze the minimum and the maximum pitch angles In eachlap the maximum pitch average as well as the minimum are also computed to provide a fasteranalysis to the coach Thus it is possible to analyze the athletersquos movement in detail and correctany potential structural problems of the swimmer

bull Body Rotation The body rotation or roll angle is also used to correct structural problems on theathletersquos technique Again giving the frontcrawl example a poor body rotation results amongothers in a weak athletersquos slide after the stroke on the other hand an excessive rotation of thetorso unbalances and slows down the athlete This feature is presented in an analogous way tothe previous one changing the symmetrical stroke styles to the non-symmetrical ones and viceversa Thus in the case of the symmetrical stroke techniques the average rotation of the athletersquosbody during a given turn is presented (a value that should be close to 0o) while in the case ofnon-symmetrical stroke styles two vectors are returned one of maxima and one of minima withinformation related to the strokes given by the athlete However while at the pitch angle eachvector of maxima and minima had a dimension equal to the number of strokes which in this caseis the sum of the dimensions of the two vectors that corresponds to the number of strokes givenby the athlete This is because in this case the maximums refer to the strokes given with the leftside while the minimums refer to the strokes given with the right side

In the previously presented commercial systems the manufacturers focused essentially on trainingstatistics by somewhat detracting from the improvement of the swimmer technique In the system pro-posed in this dissertation more relevance was given to this swimmerrsquos technique side never negletting

35

of course the training session statistics Basically for the athlete to improve it is necessary to have thecombination of these two areas if the athlete does not improve his technique over time he will reacha threshold where even with enough training he will not be able to improve his performance Otherperformance indicators could have been computed and provided from either one or another area butpriority was given to accuracy and reliability Innovation was also added to the work by adding new dataprocessing techniques (through Eulerrsquos angles signals) and new performance indicators (such as trunkelevation a newly developed and implemented feature)

332 Turns and Stops Identification

In order to segment the laps and extract swimming features the first step in the data processing isthe identification of the athletersquos turns and stops It could be concluded from a detailed analysis afterdata collection that the most indicative sign of turns and stops was as expected the pitch angle Thishappens because all the four strokes styles involve the athlete being in a horizontal position ie thatthe athletersquos back plane is practically parallel to the water surface one In this way when the athletereaches the end of the pool he has two alternatives either make a turn in order to quickly reverse thedirection of movement or he stops In both cases the pitch undergoes a sharp change When theathlete makes the turn (either a tumble turn or an open turn) and since the device is placed on thelower back the angle changes from a value in the vicinity of zero to a fairly high absolute value (closeto plusmn90o) and again has a value close to zero when the athlete ends the turn The pitch therefore hasa local maximum or minimum (depending on the type of turning in question) when the athlete makesa turn When the athlete stops swimming the pitch changes from values close to zero as previouslymentioned to -90o (the angle corresponding to a position where the athlete is standing) In Figure 35the pitch signal obtained from a preliminary test where the athlete was asked to swim 50 meters of eachstroke technique in a pool of 25 meters is shown in short the athlete completed two laps in each of thetechniques Figure 35 also shows the stroke style relative to each signal portion In this figure the stopsare represented with a cross while the turns are represented with a circle

Figure 35 Example of an athletersquos body pitch during the preliminary experience

Figure 36 shows the main structure of this stop and turn searching algorithm In the first phase thedata processing algorithm tries with some restrictions to locate the local maxima and minima in the pitchangle signal As shown by Figure 35 there are several local maxima and minima so the search has

36

to be restricted by placing certain conditions firstly only peaks with an amplitude greater than 50o areconsidered and there must be a minimum distance of 1 second between each local maximumminimumso that it is considered a turning or stopping The angular value was empirically adjusted based on datacollected from various athletes As shown by the figure the useful pitch zone used by the athlete duringthe swimming period is at plusmn20o On the other hand when the athlete gets up or when making a turnthe pitch is in the plusmn90o zone The aim was to find a value between plusmn20o and plusmn90o Thus the value of50o was chosen There are sometimes consecutive inflection points that could lead the algorithm to failThus as there are no laps with times less than one second and the athlete does not maintain a turn formore than this time this was the chosen value

Figure 36 Proposed system architecture for turns and stops identification

In a long stop the athlete has several oscillations in the pitch signal which could be identified asseveral distinct stops and that would lead to a data misinterpretation In the case where two or moreconsecutive stops are detected the signal between stops is analyzed in order to conclude wether aswimming segment or a longer stop occurred In the second case all these consecutive stop indicationsare removed except one so that once again no false segments are detected as illustrated in Figure37 As can be seen from the figure only one stop is detected during the long period of time in whichthe athlete was resting (approximately 225 seconds)

26 27 28 29 3 31 32 33 34

Time [ms] 105

-80

-60

-40

-20

0

20

40

60

80

An

gle

[ordm]

Pitch

Figure 37 Long stop illustration

Once local maxima and minima are obtained it is necessary to segment them into turns and stopsso that important characteristics and data can be extracted from the turns First of all the local maximaare excluded immediately from this segmentation procedure These are necessarily turns since whenthe athlete stands up the pitch falls close to -90o thus only the local minima are analyzed The athlete

37

is considered to stop if the event lasts more than 3 seconds Once again this value was chosen em-pirically and based on the various data collected Turns last about 1 second while shorter stops takeapproximately 4-5 seconds

There are however certain exceptions that are not detected by this set of operations This is thecase for instance of the backstroke to breaststroke turn the athlete can choose to do a bucket turn(a backward flip which starts with the athletersquos palm touching the wall) or more often a cross-over turn(after the athlete touches the wall with his upper arm over his body his back has to be driven in thetouch hand direction to complete the turn) In the cross-over turn the most frequent one the athletersquosback maintains an angle close to 0o during the whole movement execution As a result this turningmovement is not recognized by the algorithm since there is practically no difference in the pitch angleIn this way and to prevent more situations of this type that might not have been contemplated in thecollected dataset a search for outliers was implemented Outliers are identified through the swimmingsegments duration (time between turns) That is an athlete has a given pattern of lap duration timesover a given number of laps If at any given lap there is a turning that was not identified the consequentrdquolaprdquo time will approximately correspond to twice the normal Thus it will be identified as an outlierand subsequently the exact location where the turn occurred is found Using lap duration times theidentification of these kind of outliers is thus based on median absolute deviations (MAD) For a randomvariable vector A made up of N scalar observations MAD is defined as represented in Equation 32 Avalue is labeled as an outlier when it is more than three scaled median absolute deviations away fromthe median

MAD = median(|Ai minusmedian(A)|) i = 1 2 N (32)

In this context since each dataset from the database has only about 16 laps all of them were usedto compute and find the outliers even with more than one outlier in these 16 laps all were detected Inthe context of actual training since the athletersquos pace differs greatly depending on the training phase awindow of 5 to 10 laps would have to be applied to perform the outliers detection Once an outlier hasbeen detected the exact location where the turning occurs is found Obviously it has to be somewherein that time interval but if the turn was not detected through the previously stated processing it isimpossible to be detected only through the pitch signal Thus the heading angle is used to detect theapproximate location where it occurs

The heading angle is used since it represents the compass direction in which the device is pointedto Then through the pitch signal and from the approximate location where the turn is known to be itsexact location is found So when the athlete reaches the end of the lap and reverses the movementdirection the device starts to point to the opposite side changing the heading angle by approximately180o For this purpose the place where the mean of the heading angle signal changes most significantlyis searched for This search is conducted using only the signal segment where the outlier was detectedThis part of the signal is thus divided into two distinct regions The search is performed minimizing thesum of the residual (squared) error of each region from its local mean Then to obtain the exact locationof the turn the maximum absolute pitch angle point in the vicinity of the heading angle one is searchedfor The considered proximity is 3 seconds around the initially computed heading angle point Figure 38shows one of these cases The absolute value of the local minimum that identifies the athletersquos turn inthe pitch signal is less than the following stroke segments minimums Thus it would be impossible todetect this turn using the common previously described processing However there is an abrupt changein the heading signal that indicates a change of direction Through this change it is possible to locate thelocal minimum in the pitch signal that corresponds exactly to the place where the turn was performed

Finally since it is necessary to separate what is swimming from the other segments (ie turns stops

38

27 275 28 285 29 295 3 305

Time [ms] 105

-40

-30

-20

-10

0

10

An

gle

[ordm]

Pitch

27 275 28 285 29 295 3 305

Time [ms] 105

-150

-100

-50

0

50

100

150

200

An

gle

[ordm]

Heading

Figure 38 Pitch and heading signals with outlier backstroke to breaststroke turn representation

jumps among others) so that turns and swimming cycle features can be later extracted it is necessaryto determine where is the beginning and end of each turn In this way a very important feature that canbe obtained in the improvement of performance is the time spent by the athlete in the turning For thisa 05 second temporal window which is slided over time is used The window must be small enough sothat the start and end of the turns are recognized at the exact location but cannot be so small that it issusceptible to the signalrsquos oscillationsnoise In order to determine the end of the turnstop the window isinitially placed at the local minimum or maximum and it is slided in 001 second intervals (the samplingperiod time) to the place where the average of the values contained in this window is within the rangeof -20o to 20o which is the normal pitch range for an athlete while swimming

As for determining the turnstop start the process is similar the window is initially placed at the localminimum or maximum and is slided in the opposite direction (in the direction of the referencersquos origin) in001 second intervals to the place where the average of the values contained in this window is within therange of -20o to 20o Once again in Figure 35 a green marker (either a circle in the case of a turn or across in the case of a stop) may be observed around each turn or stop beginning while a red marker isdefining the end With this the automatic identification of turns and stops is completed

333 Stroke Technique Estimation

Swimming cycles (turns) are separated from the other segments after the processing described aboveThe next step is to estimate the stroke technique the athlete is swimming so that it is possible to proceedwith the featuresrsquo extraction related to his performance and technique Davey et al [27] have developedas described in Section 231 an algorithm that is based on the energy generated by the accelerometrysignal They used the raw signals obtained from the analog-to-digital converter and through someprocessing techniques could determine the stroke technique with which each athlete was swimmingThus a technique based on this approach was used Figure 39 shows the architecture of the proposedalgorithm

Firstly since the signal that is recorded on the memory card is already in units of the SI system itmust be converted to raw data Knowing that the accelerometer only measures accelerations between-8g and 8g and since the analog-to-digital converter has 16 bits the raw data vector can be computedHowever since this method was adapted from [35] the raw data range goes from 0 to 1023 (10 bits)

39

Figure 39 Proposed system architecture for stroke estimation

Then given that the signal coming from the accelerometer is noisy it is filtered in a 48-order Hamminglow-pass window with a cutoff frequency of 05 Hz [35] These data are used to estimate the stroke stylesof butterfly breaststroke and frontcrawl For backstroke technique determination another technique isused Thus the average of the accelerometry signal in the vertical axis (Z-axis) in SI units is analyzed ifit is less than zero it is known that the athlete was swimming backstroke as it is the only stroke techniquethat is swam with the back turned towards the pool bottom (inverted Z-axis) in a second phase if it isnot verified that the athlete was swimming backstroke the energy of each of the 3 channels for the giventurn is calculated according to the Equation 33 using the filtered raw signal

Echannel = round

Nsumn=1|x(n)minus x|

N

(33)

In the case of frontcrawl (and since backstroke is already eliminated) the Y-axis channel energyis much higher than the one verified in the other two stroke styles due to the rotation of the athletersquosbody in each frontcrawl stroke In this way it becomes simple to distinguish frontcrawl from the othersBetween breaststroke and butterfly techniques although similar it is found that butterfly has more energyin the Z-axis (due to the strokersquos ondulatory movement) and in the X-axis (since it is a faster style thanbreaststroke)

Each lap gives rise to a point in space depending on the energy of each of the accelerometry chan-nels Therefore it is necessary to divide the space into 3 regions (decision regions) so that afterwardsit is possible to carry out the classification of the stroke technique the athlete swam at each given lapTaking into account the collected dataset in order for the regions to be perfectly divided a machinelearning approach was used in the first instance since it was a matter of dividing the space into differ-ent regions a Support Vector Machine (SVM) was applied The support-vector network is a supervisedlearning machine generally applicable for two-group classification problems [62] It constructs a hyper-plane or set of hyperplanes in a high- or infinite-dimensional space which can be used for classificationregression or other tasks like outliers detection [63] The model used for two classes can be generalizedto N by reducing the single multiclass problem into multiple binary classification problems [64] Thusamong the various multiclass approaches the one-versus-all was chosen this method consists in thecircumscription of N hyperplanes by training a certain class i against the remaining N-1 classes givingrise to N support vector machines Given that this problem is composed by three classes (butterflybreaststroke and frontcrawl) three SVMs were trained Since as will be seen in Chapter 4 there are

40

two classes that are not linearly separable and in order not to adapt the network too much to the trainingset (overfit) the concept of soft-margin was used In this case a cost for each misclassified example hasto be rdquopaidrdquo depending on how far it is from meeting the margin requirement It turns an optimizationthat consists on trading off how far it can make the margin versus how many points have to be movedaround to allow this margin [65]

In order to compare and eventually improve the results that were obtained with the SVM in a secondinstance another method of machine learning was carried out an artificial neural network An artificialneural network is a network of simple elements called artificial neurons which receive input changetheir internal state (activation) according to that input and produce an output depending on the inputand activation The network forms by connecting the output of certain neurons to the input of otherneurons forming a directed weighted graph [66] Each set of neurons is called a layer A neural networkmust have an input layer with as many nodes as the number of available features (in this case three ExEy Ez computed according Equation 33) a hidden layer (at least) and an output layer whose numberis equal to the number of classes (in this case three butterfly breaststroke and frontcrawl) Differentlayers may perform different kinds of transformations on their inputs In this case a fully connectedneural network with a single hidden layer composed of 10 neurons is used Regarding the number ofneurons in the hidden layer several values were tested The value of 10 was chosen because it wasthe value that presented the best results To train this network the backpropagation method is used thismethod distributes the error term back up through the layers by modifying the weights at each nodeThe function to be minimized during the network training was the mean square error

All metrics used to train both classifiers as well as the performance achieved by each of them arepresented in Section 432

334 Stroke Count

The first characteristic that is drawn from the athletersquos swimming segment is the number of strokes thatthe athlete gives in a certain lap To do this each technique is approached in a different way sinceeach has its own way of swimming Figure 310 shows the architecture of the proposed system fornon-symmetrical techniques stroke count

Figure 310 Proposed system architecture for the arm stroke counting for non-symmetrical swimmingtechniques

Both frontcrawl and backstroke have an alternating arm stroke that is the limbs movements arenot symmetrical as happens with breaststroke and butterfly In this way with each arm stroke given bythe athlete there is a normal rotation of the trunk This rotation is then the method that will be usedfor frontcrawl and backstroke strokes recognition In Figure 311 the athletersquos lower back rotation angle(roll) can be observed throughout the test It can be observed that during the first four laps (2 laps infrontcrawl and 2 laps in backstroke) there is a practically periodic and sinusoidal wave Each of these

41

peaks (both maxima and minima) thus represents an athletersquos stroke

It should be noted that on the backstroke style since the device is turned upside down when theathletersquos back plane is parallel to the plane of the water surface the device returns plusmn180o instead of 0oThis is due to the fact that the device returns all 3 Euler angles in a domain between -180o and 180oIn this way the stability equilibrium point of the athlete in this technique lies precisely in the domaindiscontinuity The signal must be subsequently processed so that it is in readable form as in the case ofthe Figure 311 This is also why discontinuities abrupt transitions occur when turning from frontcrawlto backstroke from backstroke to backstroke and from backstroke to breaststroke only the swim cycledata is processed since it would not be useful to process the data related to the turning (it is importantto recall that the turn is detected in the pitch angle signal)

To perform stroke count the signal is filtered with a 48-order low pass Hamming window at a cutofffrequency of 3 Hz in order to remove the possible artifacts it may have smoothing it Then a searchfor local maxima and minima is performed similarly to what was done in Section 332 when detectingturns placing as a restriction that there can only exist a stroke in intervals of 100 milliseconds and thatit needs to have a minimum body rotation of 20o (for both frontcrawl and backstroke cases) A simpleoutlier detection based on the peaks height is also performed in order to eliminate false positive armstrokes This outlier detection is presented below Each detected inlier inflection point is then interpretedas an arm stroke The restrictions are placed so as to avoid false consecutive rdquostrokesrdquo The variableswere once again determined through an empirical analysis conducted on a series of preliminary tests

Figure 311 Example of an athletersquos body roll during the preliminary experience

In Figure 312 the block diagram showing the main workflow of the stroke detection algorithm forsymmetric stroke styles is presented

As for breaststroke and butterfly techniques and as would be expected stroke detection cannotbe performed through the rotation angle of the athletersquos lower back since in both styles there is norotation of the torso The process of handling collected data for stroke counts in symmetric styles ismore complex than the process developed for non-symmetric styles Thus since it is the pitch anglethat varies the most in each given stroke it was the signal used to count them Figure 313 shows thepitch signal obtained during a turn of both symmetric styles Figure 313a shows a lap breaststroke pitchsignal while Figure 313b shows a lap butterfly pitch signal

In a first step the signal is filtered with a 48-order low pass Hamming window at a cutoff frequency of

42

Figure 312 Proposed system architecture for the arm stroke counting for symmetrical swimming tech-niques

3 Hz Then the search for local maxima and minima is performed exactly as done with non-symmetricexecution stroke styles However each athlete has their own stroke pattern in each of these techniquesand as can be seen from Figure 313 each stroke therefore contains several maxima and minima(although only the relevant ones are marked in the figure since it was ploted after signal processing) Inthis way unwanted inflection points have to be excluded in order for strokes to be counted Algorithm 1shows the inflection points processing and consequent non-relevant points elimination The goal is thata maximum is always preceded and succeeded from a minimum and vice versa In this way consecutivemaxima and minima are analyzed always remaining the highest in the case of maxima and the lowestin the case of minima With this algorithm the points marked with a cross in Figures 313a and 313bare obtained

A stroke cycle corresponds to the signal segment between consecutive minima However not allconsecutive minima correspond to an arm stroke segment The inflection points contained in the signalsegment corresponding to the athletersquos underwater course or arrival are of course outliers In this waya signal comparison algorithm was used to identify them In a first step and since the signal segmentsdo not have all the same size a resampling was performed For the later part of the processing allthe segments constituting a stroke cycle candidate have 200 samples In order to have a comparativeterm a mean wave is calculated this wave is computed based on 50 of central signal cycles That isfrom 25 to 75 of total signal segments between consecutive minima It is exactly at the beginningand at the end of the segments that outliers can be found Then the Dynamic Time Warping (DTW)algorithm is used to align both signals (the mean wave and the stroke cycle signal segment candidate)DTW rdquostretchesrdquo two vectors A and B onto a common set of instants such that the Euclidean distancesbetween corresponding points is the smallest possible To stretch the inputs DTW repeats each ele-ment of A and B as many times as necessary It can be assumed that A represents the candidate forstroke cycle and B represents the previously calculated mean wave Finally with the signals alignedthe distance between them is computed In this case three distance metrics are used the Euclideandistance (Equation 34) the Cosine distance (Equation 35) and the Correlation distance (Equation 36)Each of these distances are further analyzed in order to find out which obtain the best results for eachof the cases Finally based on the segmentsrsquo distances an outlier detection is performed in order tofind only the true stroke cycles The outlier detection algorithm developed and applied in this case isexplained below

dEuc =

radicradicradicradic nsumi=1

(Ai minusBi)2

(34)

43

Algorithm 1 Non-relevant inflection points elimination algorithm

1 for ilarr 2 N do N is the number of inflection points2 if i = 2 then3 prev larr inflexpts(iminus 1) Previous vector index4 curr larr inflexpts(i) Current vector index5 end if6 if [i 6= N ] and [(prev = maximum and curr = minimum) or (prev = minimum and curr =maximum)] then

7 prev larr inflexpts(i) curr larr inflexpts(i+ 1) Update prev and curr to next iteration8 Proceed to the next iteration9 else

10 if prev = maximum then11 if prev gt curr then12 inflexpts(i)larr NaN Eliminated not defined13 if i 6= N then14 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)15 end if16 else17 inflexpts(iminus 1)larr NaN18 if i 6= N then19 prev larr inflexpts(i) curr larr inflexpts(i+ 1)20 end if21 end if22 else Minimum23 if prev lt curr then24 inflexpts(i)larr NaN Eliminated not defined25 if i 6= N then26 prev larr inflexpts(iminus 1) curr larr inflexpts(i+ 1)27 end if28 else29 inflexpts(iminus 1)larr NaN30 if i 6= N then31 prev larr inflexpts(i) curr larr inflexpts(i+ 1)32 end if33 end if34 end if35 end if36 end for

44

(a) Breaststroke

(b) Butterfly

Figure 313 One lap pitch signal in both symmetric stroke techniques

dCos = 1minus

nsumi=1

AiBiradicnsumi=1

Ai2

radicnsumi=1

Bi2

(35)

dCorr = 1minus

nsumi=1

(Ai minusA

) (Bi minusB

)radic

nsumi=1

(Ai minusA

)2 nsumi=1

(Bi minusB

)2 (36)

45

Outlier Detection

The athlete who participated in the preliminary studies of this thesis is a competition athlete withenough experience Probably due to this fact in the example shown in Figure 311 (non-symmetricalstroke techniques) there are no outliers However there are some collected dataset samples thatcontain outliers at the beginning or end of the lap roll signal segment In Figure 314 an example ofone of these cases can be observed In this case an outlier is observed in the first detected inflexionpoint Note that in this case there are two consecutive minima in the first two detected inflexion pointswhich indicates two arm strokes to the same side On the one hand the removal of this type of outlierscould be possible to carry out since in normal situations there are not two strokes for the same sideHowever there are some technical exercises that require the athlete to perform several strokes on thesame side Since the coach may want to obtain information about this type of exercise this conditionwas not imposed

39 395 4 405 41 415

Time [ms] 105

-100

-80

-60

-40

-20

0

20

40

60

An

gle

[ordm]

Roll

Figure 314 Roll signal for one lap of frontcrawl stroke illustrating an outlier

Thus since it is necessary to perform an outliers detection for both symmetric and non-symmetricstroke styles a simple and generic algorithm has been developed For a given element Ai to be con-sidered valid it must obey the condition expressed in Equation 37 based on the vector mean (A) andstandard deviation(σA) and at a given threshold k The value that this threshold assumes in each caseis discussed in Chapter 4

Aminus (k times σA) lt Ai lt A+ (k times σA) (37)

This outlier detection method is therefore used in both symmetric stroke styles and non-symmetricstroke styles

46

Chapter 4

Results

This chapter reports and analyses the results obtained using the proposed system for computing theidentified swimming performance indicators Section 41 presents the results regarding the study of areal-time communication with the coach This test consists of two sub-tests a distance test and a depthtest The goal is therefore to understand whether real-time communication with the coach is possibleand for this to happen both tests must have a positive result As previously referenced changes weremade to the R-IoT firmware namely to record the acquired data to a memory card Some errors ofmeasurement and decay of the sampling frequency were also reported with the overload of variablesto be stored or increase of the sampling frequency Thus Section 42 presents the tests performed onthe device that prove the correct operation of the data logging sub-system Finally Section 43 presentsthe results of the developed data processing algorithms In this section not only the performance ofthe various approaches of automatic style classification are presented but also the metric that leads tothe smallest error in the stroke count for the symmetric styles and the perfect threshold for each of thetechniques

41 Real-Time Communication

A preliminary study was carried out in order not only to corroborate the information about the attenuationof WiFi signals in the aquatic environment contained in [60] but also to understand if communicationwith the coach in real time is possible albeit in a limited way and with some restrictions In this way twotests were carried out one of depth and one of distance The purpose of both tests was to assess theamount of information that is lost and does not reach the receiver ie the percentage of packets sentvia WiFi by the R-IoT that do not reach the computer In order to assess reliability three repetitions ofeach test were performed so that the mean results could subsequently be calculated and the associateduncertainty reduced

First the distance test was carried out this consisted of placing the device between 1 and 25 metersaway from the receiver for about 10 seconds at one-meter intervals In this way it is possible to knowif the pool distance represents a problem for the data streaming process In Figure 41 it is possible toobserve the obtained results

As expected and illustrated in Figure 41 the loss rate increases with the distance Still when thedistance is maximum (25 meters) the loss rate is 3 (ie 3 out of 100 packets sent are not received)This result does not inhibit real-time communication It is concluded therefore that the distance betweenthe device and the receiver does not seem to pose an impediment to the data transmission in real timeto the coach whether the athlete trains in a swimming pool of 25 meters or in an Olympic-size swimming

47

0 5 10 15 20 25

Distance [m]

0

05

1

15

2

25

3

Loss r

ate

[

]

Figure 41 OSC packet loss rate

pool (50 meters) In the latter case the router should then be placed in the middle of the swimming poolin order to avoid larger signal loss rates

Secondly the depth test consisted of emerging the device at depths between 5 cm and 120 cm withintervals of 5 cm In this case and contrary to what was verified in the previous test it was concludedthat as soon as the device is submerged more than approximately 7 cm the connection is lost it is onlyrestored once the BITalino is fully emerged ie when it is completely out of the water From 0 cm to 7cm deep the packet rate loss varies between 5 and 10 From there on and as previously mentionedthe connection is lost and this rate rises to 100 leading to no message reaching the receiver Thusand in order to realize if the connection could be restored during the recovery stroke phase so that someinformation could be transmitted the device was placed on an athletersquos wrist (since it is the locationof the body that is out of water for longer in this phase of the frontcrawl stroke) Initially a swimmerwas asked to swim at a very slow pace increasing stroke rhythm over time Through this test it wasconcluded that the connection takes between 13 to 15 seconds to be restored from the moment thedevice is withdrawn from the water However an athlete in a normalslow rhythm takes about 1 secondto perform the stroke recovery phase which makes this type of communication impracticable when theathlete swam at a normal pace the connection was never resumed since during 25 meters no messagereached the receiver

It is concluded therefore that another type of transmission scheme needs to be explored in order tocommunicate with the coach in real time since although the swimming pool distance is not a deterrentthe strong attenuation of the WiFi signals in the aquatic environment does not allow packets to reach thereceiver

42 Data Logging

In this section the results of the performed tests which corroborate the devicersquos adaptation to the aquaticenvironment as well as its use by the athletes during daily training are presented

First the devicersquos ability to record the data collected and processed by the IMU is tested It is im-portant to note that the frequency at which the data is written to the memory card would ideally bethe same as the streaming frequency of the R-IoT so that no post-processing operations for frequencymatching are needed Thus it has been analyzed that for the amount of data to be transmitted the

48

maximum sampling rate of the device is 100 Hz (although the device default frequency is 200 Hz) Thedata obtained in the following tests were collected at this sampling frequency

In Figure 42 it is possible to observe the pitch and roll angles of an experiment of approximately 3seconds This experiment was performed in order to simulate the trunk rotation that is performed by theathlete when swimming frontcrawl using the device on the lower back This test was performed in drycondition and it is important to point out that these data were compared with the data arriving throughWiFi in order to corroborate if the information is correct

(a) Pitch (b) Roll

Figure 42 Preliminary test in dry condition

Under the development of the database 484905 samples were collected (corresponding to approx-imately 80 minutes of acquired data) Three of these presented a difference between samples higherthan the sampling period one of 40 ms another of 50 ms and the last one of 800 ms However sincethe percentage of skipped samples is negligible and the error was probably due to a delay in a sub-cycleother than the logging one these cases were considered artifacts

In order to analyze the devicersquos use feasibility by an athlete in his daily training routines it wasswitched on for one hour with the aim of analyzing the size of the output file produced at the end of thistime It was found that per hour the generated file has a size around 25 Mb So a 32 Gb card supportsabout 1280 one-hour sessions This makes the device quite convenient since it is not necessary toconstantly download and erase the sessions gathered up to a given point The fact that the memorycard is removable and expandable is also an advantage

The battery life does not seem to be a problem either since the device was uninterruptedly switchedon and transmitting for approximately 3 hours Therefore the battery is prepared to last the entire trainingof the athlete even if it is a little longer Charging is also very simple as the device simply needs to beconnected to a charger through the USB port installed in the device connecting it to the computer or toan appropriate charger Battery replacement is also possible

43 IMU Data Analysis System

In this section the tests performed on the IMU data processing algorithms as well as their performanceresults are presented Values for some algorithms variablesrsquo choice are justified based on the presentedresults

First the results of the algorithm for identifying and distinguish turns from stops (Section 431) arepresented secondly the results concerning the recognition of stroke styles are presented namely theaccuracy results of the classifiers used for automatic recognition (Section 432) finally in Section 433

49

results are presented regarding the stroke count as well as each chosen distance used in the processfor both symmetric styles and the applied threshold in each technique

431 Turns and Stops Identification

In the set of collected data there are in total 202 laps Each lap is obviously separated by a turn or astop which has to be identified in such a way that features can be extracted from that segment and thatthe lap time can be counted and the swimming segments can be isolated for later processing Thus inthe collected dataset there are 181 turns and 34 stops All the 181 + 34 = 215 segments that separatetwo consecutive laps were duly detected by the algorithm described in Section 332 It is thereforepossible to conclude that the proposed detection algorithm has an accuracy of 100 with respect to theidentification of this type of segments However regarding the distinction between these segments inturns and stops the algorithm did not perform perfectly even if it was close enough to that Table 41presents the confusion matrix that illustrates the performance of the classification algorithm in the 215existing segments

Table 41 Turns and stops confusion matrix

EstimatedTurns Stops

Turns 179833

209

98911Reality

Stops 00

34158

1000

1000

94456

99109

As can be seen from Table 41 there were only two misclassifications two consecutive turns madeby the same athlete that took more than 3 seconds and were therefore classified as a stop The variablethat dictates the separation time between a turn and a stop is easily changeable in the algorithm codeHowever in a competitive context of daily use the athlete often makes stops of less than 3 secondsin this context turns also never exceed this value As such this variable value was kept in the 3 sec-onds since nevertheless the result is plainly positive when considering that there were 2 errors in 215segments which corresponds to a classification accuracy of 991

432 Stroke Technique Classifiers

Each technical style has its own way of execution different properties and therefore suffers differenttypes of processing Thus one of the first steps in processing the acquired data is the recognition of theswim style in each of the laps As mentioned in Section 333 an automatic classifier was developedto perform this task In a first phase the position of the device is evaluated in the case where theorientation of the Z axis reports a negative value (in the order of -1g) it is known that the athlete hasswum backstroke otherwise a classifier based on machine learning techniques is used to estimatethe style that the athlete has swum As previously described two different approaches were used anSVM and a Neural Network In both cases different training methods and metrics were tested in orderto infer which leads to the best result The dataset consists of 48 (butterfly) + 50 (breastsroke) + 54(frontcrawl) = 152 laps For each set (method metric) 1000 runs were performed In each one the testset was chosen randomly from the total set The remaining dataset was used to perform the classifiertraining For each of the sets the respective accuracy (mean) and standard deviation across all the runsare presented In each run the test set has 30 elements while the training set has the remaining 122

50

Twenty percent of the total value of the dataset was selected for testing and the remaining eighty percentfor training

Figure 43 shows the total set of acquired data used to perform the training and testing of the au-tomatic classifier Although the energy values of the backstroke laps could be computed and plotedonly the points corresponding to the remaining three swimming techniques were represented This isbecause the backstroke technique is classified based on the orientation of the device As can be seenthe dataset is not linearly separable since there is an intersection in the point cloud of butterfly techniquepoints and breaststroke ones The backstroke style was recognized with 100 accuracy in the 50 lapscontained in the dataset

2

0

4

10

6

20

8

0

10

305

12

40 1015

50 20

Butterfly

Breaststroke

Frontcrawl

Figure 43 Stroke estimation dataset

First the results related to SVM training and testing are presented Since the acquired dataset is notlinearly separable three different kernels were used to map it from the input space to the feature spaceThe aim is to conclude which one has the best results Thus the RadialGaussian Basis Function kernelthe linear kernel and the polynomial kernel whose mappings are represented in Equations 41 42 and43 respectively are used in this context

KRBF (x1 x2) = exp

(minusx1 minus x2

2

2σ2

)(41)

KLin(x1 x2) = x1Tx2 (42)

KPol(x1 x2) =(x1Tx2 + 1

)ρ(43)

Regarding the Radial Basis Function the standard deviation σ was used (σ = 1) In the polynomialkernel several orders were tested in order to conclude which one is best suited to the collected datasetTable 42 shows the results obtained for several Box Constraint values The box constraint is the costmeasure The higher the box-constraint the higher the cost of the misclassified points leading to amore strict separation of the data At the limit the box constraint can be infinite (hard margin) Ta-ble 42a shows the obtained accuracy for each of the cases while Table 42b presents the respectivestandard deviations When the data is not perfectly separable the training algorithm must allow somemis-classification in the training set (soft margin)

51

Table42

SV

Mclassification

accuracyand

correspondingstandard

deviation

(a)Accuracy

Box

Constraint

10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function8509

85968781

87358733

84868263

79878097

80535560

Linear8129

87928851

88668876

88788810

87876437

41504707

Polynomial

ρ=

18109

87908856

88638875

88978873

89006597

40135073

ρ=

28740

87488768

87968796

88708850

87706903

58536460

ρ=

38706

86658868

86728537

84108187

81377620

75836997

ρ=

48710

87058707

85388306

79907830

78637810

79176730

ρ=

58621

87498541

84268136

79807937

80007970

79977480

ρ=

68595

86708434

83078050

79338017

80177980

79307367

(b)Standard

DeviationB

oxC

onstraint10minus2

10minus1

100

101

102

103

104

105

106

107

infin

Kernel

Gaussian

Basis

Function586

577542

541592

639600

672676

6892036

Linear812

532518

537544

552534

5812010

19252833

Polynomial

ρ=

1809

536523

540551

542560

5581932

19632905

ρ=

2559

540571

565570

566594

5661498

16961622

ρ=

3560

562559

570640

701767

717951

9911508

ρ=

4569

596539

621684

697596

688674

8491416

ρ=

5574

567566

636675

676713

634667

6611323

ρ=

6582

567616

662652

689725

699660

6521339

52

As can be seen as a rule since the swimming techniques are not linearly separable as the boxconstraint increases to very high values the precision decreases and the standard deviation increasesPrecision decreases because the margin becomes less flexible The standard deviation increases be-cause in each run the accuracy depends strongly on the randomly chosen training and validation setThe best possible result is obtained with the highest precision and the lowest standard deviation Whileaccuracy gives information about the classifier performance the standard deviation reveals the sensitiv-ity of the classifier to the training set (demonstrating classifier consistency)

It is concluded through an analysis of the table that the best precision is obtained for the polynomialkernel where BoxConstraint = 105 and ρ = 1 The precision obtained was 8900 and the standarddeviation was 558

Secondly a classifier based on a Neural Network was trained The Neural Network consists of 3layers the input layer which is composed of 3 neurons (corresponding to the 3 axes of energy of theaccelerometer) the hidden layer composed of 10 neurons (explained in Section 333) and the outputlayer that is composed also by 3 neurons (corresponding to the 3 styles to be classified ie butterflybreaststroke and frontcrawl) Three different optimization methods were used to perform the networktraining Levenberg-Marquadt backpropagation method Gradient Descent and Gradient Descent withMomentum methods These methods seek to find the minimum value of the minimization criterion ineach of the iterations The problem with these types of function minimization methods is that theysometimes only find a local minimum of the function rather than the global minimum (desired value) Thegreat advantage of the momentum method is that it avoids the function being stuck in a local minimumhaving more chances of reaching the global minimum The used minimization criterion was the MeanSquared Error The network training stopping criterion was 10000 iterations (epochs) or a mean squarednormalized error (mse) less than 004

In Equations 44 45 and 46 are the various minimization expressions of the Levenberg-MarquadtGradient Descent and Gradient Descent with Momentum methods respectively In Equation 44 Jrepresents the Jacobian matrix which contains the first derivatives of the network errors with respectto the weights and biases e is the vector of network errors I is the identity matrix and micro is a scalarWhen micro is zero the Levenberg-Marquadt turns Newtonrsquos method using the approximate Hessian matrix(H = JTJ) When it is large this method becomes the gradient descent with a small step size [67] Onthe other hand in Equations 45 and 46 F represents the function to minimize η is the learning ratevalue and α represents the momentum constant

xk+1 = xk minus[JTJ + microI

]minus1JT e (44)

xk+1 = xk minus η [nablaxF (xk)] (45)

vk+1 = αvk minus η [nablaxF (xk)]xk+1 = xk + vk+1

(46)

As for the parameters used in network training in the Levenberg-Marquadt case the only variableto change is the scalar micro The aim of the Levenberg-Marquadt algorithm is to move toward Newtonrsquosmethod as quickly as possible since it is faster and more accurate near an error minimum Thus thescalar micro is decreased after each successful step and is increased only when the tentative step wouldincrease the performance function [67] In this way the performance function is always reduced to eachiteration of the algorithm The initial value of micro has been set at 0001 the increase factor is 10 thedecrease factor is 01 and the maximum value of micro is 1010

In the case of gradient descent methods it is possible to change the values of the learning rate and

53

momentum contants (when applicable) The larger the learning rate the bigger the step If the learningrate is set too large the algorithm becomes unstable If the learning rate is set too small the algorithmtakes a long time to converge [67] The momentum constant varies between 0 (without momentum) and1 (maximum momentum) A momentum constant of 1 results in a network that is completely insensitiveto the local gradient and therefore does not learn properly [67]

Note that when α = 0 vk+1 = minusη [nablaxF (xk)] rArr xk+1 = xk minus η [nablaxF (xk)] That is when themomentum constant is 0 the method becomes the usual gradient descent method

Thus the result of the neural network training through the Levenberg-Marquadt optimization functionwas 8737 with an associated standard deviation of 551 Remember that this algorithm does notdepend on any additional parameters

In turn the results of normal gradient descent and gradient descent with momentum functions areshown in Tables 43 and 44 respectively It should be noted that as previously stated when theconstant momentum is close to zero the accuracy and standard deviation values between the twoalgorithms are quite close

Table 43 Neural Network classification results using Gradient Descent

Accuracy Standard Deviation

Lear

ning

Rat

e 0001 7330 1646001 8727 69201 8877 53303 8867 50405 8873 53307 8800 528

Table 44 Neural Network classification results using Gradient Descent with Momentum

(a) Accuracy

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 7171 6997 7100 7151 7075001 8628 8643 8653 8619 865501 8863 8870 8865 8845 887403 8820 8837 8960 8887 888305 8900 8787 8780 8780 861007 8770 8810 8777 8777 8137

(b) Standard Deviation

Momentum Constant01 03 05 07 09

Lear

ning

Rat

e 0001 1842 1954 1851 1807 1844001 836 845 800 863 75701 536 567 561 553 60803 526 613 567 515 54505 509 489 526 530 91007 576 460 551 513 1604

It can be concluded from an analysis of both tables and the Levenberg-Marquadt function valuesmentioned above that the best performance is obtained for the Gradient Descent with Momentum algo-rithm when the momentum constant α = 05 and the learning rate η = 03 The accuracy obtained inthis case is 8960 with a standard deviation of 567 In this way the result obtained with this NeuralNetwork is slightly better than the result obtained with the SVM although very close

54

433 Stroke Count

In this section the results related with the developed athletesrsquo stroke count algorithm are presented Asmentioned in Section 334 there is a way of counting the strokes referring to symmetrical stroke stylesand another distinct way of counting the strokes referring to non-symmetrical techniques Both methodsare based on a detection of outliers whose expression condition is presented in Equation 37 Thusit is necessary to choose the threshold value k that is represented in this condition For this accuracyplots for each case were performed Equation 47 shows the accuracy expression where FP representsthe false positives FN the false negatives TP the true positives and TN the true negatives A falsepositive is a real stroke that is discarded by the algorithm that is it is not counted as an arm stroke Onthe other hand a true negative is a candidate for stroke that is correctly rejected

Accuracy =TP + TN

TP + FP + TN + FN(47)

Non-Symmetric Techniques

In Figure 44 the accuracy plot for the frontcrawl is shown The point displayed in the Figure corre-sponds to the optimal threshold value ie the value that leads to the highest algorithm accuracy Thusthis value returns not only the optimal threshold to be applied in this case but also the respective algo-rithm accuracy associated with this threshold level Thus for frontcrawl k = 2 is used this thresholdvalue leads to an algorithm accuracy of 9748

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Crawl

X 2

Y 09748

Figure 44 Accuracy plot for frontcrawl

In its turn Figure 45 shows the accuracy plot for the backstroke technique In this case the optimalthreshold value is equal to k = 236 This threshold level leads to an algorithm accuracy of 9569This value is slightly lower than the previously presented one for frontcrawl due to the discontinuity thatoccurs in the moment before the turn Sometimes the last stroke is not recognized since it is performedin a continuous rotation of the trunk that culminates in the turn approach

Symmetric Techniques

With respect to symmetric stroke styles the DTW algorithm was used to perform the alignment ofall candidate stroke segments with the mean stroke wave signal The distance between each of these

55

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Backstroke

X 236

Y 09569

Figure 45 Accuracy plot for backstroke

signal segments and the mean wave signal was then computed Thus three different metrics wereused to compute this distance the Euclidean the Cosine and the Correlation distances The differentaccuracy plots for each case are presented Based on these plots the distance and respective thresholdare chosen so that the best algorithm precision can be achieved

In this sense the breaststroke accuracy plots are shown in Figure 46 As can be stated by thepresented plots the Euclidean distance shows an accuracy of 8989 the Cosine distance tested aprecision of 8899 and the accuracy of the Correlation distance goes substantially up to 9152In this sense for arm stroke counting in this technique the Correlation distance is used applying athreshold k = 074 that guarantees an accuracy of 9152

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Euclidean

X 094

Y 08989

(a) Euclidean

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

Accura

cy

Breaststroke Cosine

X 087

Y 08899

(b) Cosine

0 05 1 15 2 25 3

Threshold

02

03

04

05

06

07

08

09

1

Accura

cy

Breaststroke Correlation

X 074

Y 09152

(c) Correlation

Figure 46 Accuracy plots for breaststroke evaluated under different metrics

Finally in Figure 47 the plots corresponding to the butterfly stroke style are presented Using theEuclidean distance the precision obtained was set at 9199 for the Cosine distance an accuracy of8339 is shown and with the Correlation distance an accuracy of 9088 was shown In this way theEuclidean distance is used to count the butterfly strokes using a threshold k = 134 and leading to anaccuracy of 9199

In the case of the symmetrical stroke techniques both results are very similar In both cases thedivision of a few strokes into two distinct signal segments was verified because of their presented patternIn these cases one stroke results in two outliers

56

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Euclidean

X 134

Y 09199

(a) Euclidean

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

Accura

cy

Butterfly Cosine

X 219

Y 08939

(b) Cosine

0 05 1 15 2 25 3

Threshold

01

02

03

04

05

06

07

08

09

1

Accura

cy

Butterfly Correlation

X 116

Y 09088

(c) Correlation

Figure 47 Accuracy plots for breaststroke evaluated under different metrics

57

58

Chapter 5

Conclusions and Further Work

This thesis was based on the idea design and development of a swimming system capable of assistingcoach and athlete in their daily training In the first phase a gap was detected within the landscape oftools currently available while sports like football athletics cycling tennis among others develop andadapt to the use of technologies swimming is still far behind them in this process As it was verifiedby Chapter 2 if on one hand when applied to swimming the video analysis used in other sports isunpractical inefficient and too expensive the analysis based on inertial signals are poorly developedproviding few performance indicators to athletes and coaches Based on this premise a system basedon inertial signals was designed This system would have to be precise comfortable functional andhave an accessible price so that all athletes who wanted to practice the modality and to be a step aheadcould acquire it in order to be continuously improving their technique and performance Thus using anIMU and adapting it to the aquatic environment by making some changes to its hardware and firmwarea prototype of such a system has been developed

51 Discussion

After a review of the state of the art and gathering information from coaches athletes and researchers inthe area it was decided that the prototype would be placed on the athletersquos lower back so that its mainmovements could be captured and at an early stage of the project the main and most important featurescould be collected After collecting real-world data the development of algorithms for the computationof performance indicators was started If on one hand the goal was to deliver the greatest numberof performance indicators to the user using recent and accurate signal processing techniques on theother hand it is required that the algorithm had to be efficient so that the results are ready for immediateanalysis and so that it can in the future eventually be ran in real-time In this way and using Matlab aset of algorithms have been developed that compute many important performance indicators some ofwhich are being considered for the first time such as trunk elevation This performance indicator is veryuseful in the analysis of structural problems related to the athletersquos technique Through an inspection ofthis indicator (which is very difficult to perform with the naked eye) it is possible to correct the athletein such a way that it causes less drag in the water and consequently performs better It should alsobe noted that while all the other analysed authors use the data obtained from the IMU (accelerometergyroscope and magnetometer) to extract the performance indicators in this work there was an effort todevelop something innovative extracting the performance indicators through the signals from the Eulerangles

59

The obtained results are quite positive as can be seen from Chapter 4 the precision in the identifica-tion of stops and turns using Euler angles is 100 while the accuracy in the classification of this type ofsegments was 991 On the other hand the automatic classification methods used to perform strokestyle recognition also presented a very good performance backstroke had a recognition accuracy of100 for the remaining 3 stroke techniques while the best SVM got a precision of 8900 the bestneural network got a performance of 8960 The classifiers were trained based on the energy obtainedfrom each of the accelerometry channels the main problem is a considerable overlap between the pointclouds of butterfly and breaststroke techniques which causes a sharp decrease of the classifiers perfor-mance Lastly as far as stroke counting is concerned the accuracy of the developed algorithms is about9199 for butterfly 9569 for backstroke 9152 for breaststroke and 9569 for frontcrawl Sinceeach athlete has his own stroke pattern stroke recognition in symmetrical stroke styles becomes moredifficult in the case of a butterfly for example the athletersquos lower back movement during the underwa-ter course is practically equal to the one performed in the swimming segment It is important to stressthat none of the available commercial systems or solutions proposed in the literature to the best of theauthorrsquos knowledge has previously used Euler angles to perform processing and compute swimmingperformance indicators

As a final conclusion the initially proposed goals were achieved and a support system has beendeveloped It allows swimmers to constantly improve their performance and technique by analyzing theavailable performance indicators

52 Future Work

As far as future work prospects are concerned there are a number of approaches that can be takenFirst investigate a transceiver (other than WiFi) which is not so strongly attenuated in the aquatic

environment so that real-time communication albeit to a limited extent can be feasible It is a veryimportant area since often only one coach is in charge of about 50 athletes making it impossible tomonitor each one individually If on the other hand this coach receives important statistics in real timelike technical anomaly warnings or missedfailed series times he could correct them in real time

Secondly the hypothesis of placing the IMU in other athletersquos body areas should be studied in orderto extract other features that could not be extracted with the device in the athletersquos lower back Featuressuch as stroke kicking and breathing patterns are some of them The hypothesis of simultaneouslyapplying several devices to the athletersquos body should also be studied at a later stage By combininginformation from the various devices it should be possible to improve the accuracy of extracted featuresextract more features and in the limit perform partial reconstruction of the athletersquos movement

Thirdly the classification accuracy from stroke style can be improved by adding more features of thevarious collected signals to the training process Features such as skewness variance average amongothers can be computed and introduced in the process

Lastly another perspective of future work would be to consider a generalization of the devicersquos po-sition on the athletersquos body in order to make the performance indicators extraction independent from itspositioning orientation In this way whatever the position the athlete placed the device on the body thefeatures would always be correctly extracted

60

Bibliography

[1] R Mooney G Corley A Godfrey L R Quinlan and G OLaighin ldquoInertial sensor technology forelite swimming performance analysis A systematic reviewrdquo Sensors vol 16 no 1 p 18 2015

[2] S Riewald and S Rodeo Science of swimming faster Human Kinetics 2015

[3] P Whitten The complete book of swimming Random House 2012

[4] J Vantorre D Chollet and L Seifert ldquoBiomechanical analysis of the swim-start a reviewrdquo Journalof sports science amp medicine vol 13 no 2 p 223 2014

[5] R V Breed and W B Young ldquoThe effect of a resistance training programme on the grab track andswing starts in swimmingrdquo Journal of sports sciences vol 21 no 3 pp 213ndash220 2003

[6] J Vantorre L Seifert R Fernandes J V Boas and D Chollet ldquoKinematical profiling of the frontcrawl startrdquo International Journal of Sports Medicine vol 31 no 01 pp 16ndash21 2010

[7] C Osborough D Daly and C Payton ldquoEffect of swim speed on leg-to-arm coordination in unilateralarm amputee front crawl swimmersrdquo Journal of sports sciences vol 33 no 14 pp 1523ndash15312015

[8] T Monnet M Samson A Bernard L David and P Lacouture ldquoMeasurement of three-dimensionalhand kinematics during swimming with a motion capture system a feasibility studyrdquo Sports Engi-neering vol 17 no 3 pp 171ndash181 2014

[9] V Gourgoulis A Boli N Aggeloussis A Toubekis P Antoniou P Kasimatis N VezosM Michalopoulou A Kambas and G Mavromatis ldquoThe effect of leg kick on sprint front crawlswimmingrdquo Journal of sports sciences vol 32 no 3 pp 278ndash289 2014

[10] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoEmbedded programmingand real-time signal processing of swimming strokesrdquo Sports Engineering vol 14 no 1 p 1 2011

[11] ldquoQualisys systemrdquo httpswwwqualisyscomapplicationssportsswimming accessed 2018-06-10

[12] ldquoVicon websiterdquo httpswwwviconcom accessed 2018-08-15

[13] ldquoNatural point websiterdquo httpswwwnaturalpointcom accessed 2018-08-20

[14] ldquoDartfish websiterdquo httpswwwdartfishcom accessed 2018-08-20

[15] ldquoImage-pro - media cybernetics websiterdquo httpwwwmediacycomimagepro accessed 2018-08-20

[16] ldquoEndless poolsrdquo httpswwwendlesspoolscom accessed 2018-06-08

61

[17] A M Aurand J S Dufour and W S Marras ldquoAccuracy map of an optical motion capture systemwith 42 or 21 cameras in a large measurement volumerdquo Journal of biomechanics vol 58 pp237ndash240 2017

[18] M Eltoukhy S Asfour C Thompson and L Latta ldquoEvaluation of the performance of digital videoanalysis of human motion Dartfish tracking systemrdquo IJSER vol 3 pp 1ndash6 2012

[19] ldquoBTS bioengineering websiterdquo httpwwwbtsbioengineeringcom accessed 2018-08-20

[20] ldquoSwimming technology research (STR) websiterdquo httpsswimmingtechnologycom accessed2018-08-20

[21] ldquoMotion analysis websiterdquo httpswwwmotionanalysiscom accessed 2018-08-20

[22] ldquocodamotion websiterdquo httpscodamotioncom accessed 2018-08-20

[23] ldquoAriel performance analysis system websiterdquo httpwwwarielnetcomapas accessed 2018-08-20

[24] D Thewlis C Bishop N Daniell and G Paul ldquoNext-generation low-cost motion capture systemscan provide comparable spatial accuracy to high-end systemsrdquo Journal of applied biomechanicsvol 29 no 1 pp 112ndash117 2013

[25] M Magdin ldquoSimple MoCap system for home usagerdquo International Journal of Interactive Multimediaamp Artificial Intelligence vol 4 no 4 2017

[26] M Bachlin K Forster and G Troster ldquoSwimmaster a wearable assistant for swimmerrdquo in Pro-ceedings of the 11th international conference on Ubiquitous computing ACM 2009 pp 215ndash224

[27] N P Davey D A James and M E Anderson ldquoSignal analysis of accelerometry data using gravity-based modelingrdquo in Microelectronics Design Technology and Packaging vol 5274 InternationalSociety for Optics and Photonics 2004 pp 362ndash371

[28] P Siirtola P Laurinen J Roning and H Kinnunen ldquoEfficient accelerometer-based swimming ex-ercise trackingrdquo in Computational Intelligence and Data Mining (CIDM) 2011 IEEE Symposium onIEEE 2011 pp 156ndash161

[29] Y Ohgi K Kaneda and A Takakura ldquoSensor data mining on the kinematical characteristics of thecompetitive swimmingrdquo Procedia Engineering vol 72 pp 829ndash834 2014

[30] D A James R I Leadbetter M R Neeli B J Burkett D V Thiel and J B Lee ldquoAn integratedswimming monitoring system for the biomechanical analysis of swimming strokesrdquo Sports Technol-ogy vol 4 no 3-4 pp 141ndash150 2011

[31] F Dadashi F Crettenand G P Millet L Seifert J Komar and K Aminian ldquoAutomatic front-crawltemporal phase detection using adaptive filtering of inertial signalsrdquo Journal of sports sciencesvol 31 no 11 pp 1251ndash1260 2013

[32] Y Ohgi M Yasumura H Ichikawa and C Miyaji ldquoAnalysis of stroke technique using accelerationsensor IC in freestyle swimmingrdquo The engineering of sport vol 250 pp 503ndash511 2000

[33] T Le Sage A Bindel P Conway L Justham S Slawson and A West ldquoDevelopment of a realtime system for monitoring of swimming performancerdquo Procedia Engineering vol 2 no 2 pp2707ndash2712 2010

[34] B V Wright and J M Stager ldquoQuantifying competitive swim training using accelerometer-basedactivity monitorsrdquo Sports Engineering vol 16 no 3 pp 155ndash164 2013

62

[35] N Davey M Anderson and D A James ldquoValidation trial of an accelerometer-based sensor plat-form for swimmingrdquo Sports Technology vol 1 no 4-5 pp 202ndash207 2008

[36] M Bachlin and G Troster ldquoSwimming performance and technique evaluation with wearable accel-eration sensorsrdquo Pervasive and Mobile Computing vol 8 no 1 pp 68ndash81 2012

[37] E Beanland L C Main B Aisbett P Gastin and K Netto ldquoValidation of GPS and accelerometertechnology in swimmingrdquo Journal of Science and Medicine in Sport vol 17 no 2 pp 234ndash2382014

[38] N Chakravorti T Le Sage S E Slawson P P Conway and A A West ldquoDesign and implementa-tion of an integrated performance monitoring tool for swimming to extract stroke information at realtimerdquo IEEE Transactions on Human-Machine Systems vol 43 no 2 pp 199ndash213 2013

[39] R Hagem D Thiel S OrsquoKeefe and T Fickenscher ldquoReal-time swimmersrsquo feedback based on smartinfrared (SSIR) optical wireless sensorrdquo Electronics Letters vol 49 no 5 pp 340ndash341 2013

[40] A Stamm D A James and D V Thiel ldquoVelocity profiling using inertial sensors for freestyle swim-mingrdquo Sports Engineering vol 16 no 1 pp 1ndash11 2013

[41] F Dadashi G Millet and K Aminian ldquoGaussian process framework for pervasive estimation ofswimming velocity with body-worn IMUrdquo Electronics Letters vol 49 no 1 pp 44ndash45 2013

[42] F Dadashi G P Millet and K Aminian ldquoA bayesian approach for pervasive estimation of breast-stroke velocity using a wearable imurdquo Pervasive and Mobile Computing vol 19 pp 37ndash46 2015

[43] S K Fulton D B Pyne and B Burkett ldquoValidity and reliability of kick count and rate in freestyleusing inertial sensor technologyrdquo Journal of sports sciences vol 27 no 10 pp 1051ndash1058 2009

[44] S K Fulton D Pyne and B Burkett ldquoOptimizing kick rate and amplitude for paralympic swimmersvia net force measuresrdquo Journal of Sports Sciences vol 29 no 4 pp 381ndash387 2011

[45] C Payton V Baltzopoulos and R Bartlett ldquoContributions of rotations of the trunk and upper ex-tremity to hand velocity during front crawl swimmingrdquo Journal of Applied Biomechanics vol 18no 3 pp 243ndash256 2002

[46] J Pansiot B Lo and G-Z Yang ldquoSwimming stroke kinematic analysis with BSNrdquo in Body SensorNetworks (BSN) 2010 International Conference on IEEE 2010 pp 153ndash158

[47] L Seifert M LrsquoHermette J Komar D Orth F Mell P Merriaux P Grenet Y Caritu R HeraultV Dovgalecs et al ldquoPattern recognition in cyclic and discrete skills performance from inertial mea-surement unitsrdquo Procedia Engineering vol 72 pp 196ndash201 2014

[48] A Ahmadi D D Rowlands and D A James ldquoDevelopment of inertial and novel marker-basedtechniques and analysis for upper arm rotational velocity measurements in tennisrdquo Sports Engi-neering vol 12 no 4 pp 179ndash188 2010

[49] A Meamarbashi and S Hossaini ldquoApplication of novel inertial technique to compare the kinematicsand kinetics of the legs in the soccer instep kickrdquo Journal of Human Kinetics vol 23 pp 5ndash132010

[50] J J Anthony III and S E Chalfant ldquoMulti-state performance monitoring systemrdquo Aug 19 2010 uSPatent App 12691414

63

[51] S Michaels D J Taunton A I Forrester D A Hudson C W Phillips B A Holliss and S RTurnock ldquoThe use of a cap-mounted tri-axial accelerometer for measurement of distance lap timesand stroke rates in swim trainingrdquo Procedia engineering vol 147 pp 649ndash654 2016

[52] R Mooney L R Quinlan G Corley A Godfrey C Osborough and G OLaighin ldquoEvaluation ofthe FINIS swimsense Rcopy and the Garmin swimTM activity monitors for swimming performance andstroke kinematics analysisrdquo PloS one vol 12 no 2 p e0170902 2017

[53] ldquoSwimnovate websiterdquo httpswwwswimovatecom accessed 2018-08-15

[54] H Hobeika Instabeat website [Online] Available httpinstabeatme

[55] ldquoBITalino R-IoT user guiderdquo httpbitalinocomdocsR-IoT User Guidepdf accessed 2018-04-27

[56] ldquoEnergia IDErdquo httpenergianuguidegettingstarted accessed 2018-08-17

[57] S O Madgwick A J Harrison and R Vaidyanathan ldquoEstimation of IMU and MARG orientationusing a gradient descent algorithmrdquo in Rehabilitation Robotics (ICORR) 2011 IEEE InternationalConference on IEEE 2011 pp 1ndash7

[58] ldquoOSC protocol specificationsrdquo httpopensoundcontrolorgspec-1 0 accessed 2018-07-02

[59] K Feng J Li X Zhang C Shen Y Bi T Zheng and J Liu ldquoA new quaternion-based Kalmanfilter for real-time attitude estimation using the two-step geometrically-intuitive correction algorithmrdquoSensors vol 17 no 9 p 2146 2017

[60] L Lanbo Z Shengli and C Jun-Hong ldquoProspects and problems of wireless communication forunderwater sensor networksrdquo Wireless Communications and Mobile Computing vol 8 no 8 pp977ndash994 2008

[61] M Reis and H Silva ldquoLoggerBIT An optimization of the openlog board for data logging with lowcost hardware platforms for biomedical applicationsrdquo in International Conf on Informatics in ControlAutomation and Robotics - ICINCO July 2018 pp 600ndash604

[62] C Cortes and V Vapnik ldquoSupport-vector networksrdquo Machine learning vol 20 no 3 pp 273ndash2971995

[63] ldquoScikit-Learn software websiterdquo httpscikit-learnorgstablemodulessvmhtml accessed 2018-08-23

[64] K-B Duan and S S Keerthi ldquoWhich is the best multiclass SVM method an empirical studyrdquo inInternational workshop on multiple classifier systems Springer 2005 pp 278ndash285

[65] ldquoSVM stanford university bookrdquo httpsnlpstanfordeduIR-bookhtmlhtmleditionsoft-margin-classification-1html accessed 2018-08-23

[66] A Zell Simulation neuronaler netze Addison-Wesley Bonn 1994 vol 1

[67] ldquoMatlab optimization toolbox 2017ardquo 2017 the MathWorks Natick MA USA

64

  • List of Tables
  • List of Figures
  • Introduction
    • Fundamentals of Swimming
      • Frontcrawl
      • Backstroke
      • Breaststroke
      • Butterfly
        • Context and Motivation
        • Objectives
        • Main Contributions
        • Structure
          • State of the art
            • Swimming Segments
              • Starts
              • Turns
              • Free Swimming
              • Finishes
                • Video-Based Approaches
                  • Available Systems
                  • Main Specifications
                    • Inertial Sensing Approaches
                      • Performance Features
                      • Sensor Placement
                      • Inertial-Based Commercial Systems
                          • Proposed Approach
                            • Device and Adaptations
                              • BITalino R-IoT
                              • System Adaptations
                                • Data Acquisiton
                                  • Body Positioning
                                  • Database
                                    • IMU Data Analysis System
                                      • Performance Indicators
                                      • Turns and Stops Identification
                                      • Stroke Technique Estimation
                                      • Stroke Count
                                          • Results
                                            • Real-Time Communication
                                            • Data Logging
                                            • IMU Data Analysis System
                                              • Turns and Stops Identification
                                              • Stroke Technique Classifiers
                                              • Stroke Count
                                                  • Conclusions and Further Work
                                                    • Discussion
                                                    • Future Work
                                                      • Bibliography
Page 12: Dynamic Analysis of Swimmers During Training
Page 13: Dynamic Analysis of Swimmers During Training
Page 14: Dynamic Analysis of Swimmers During Training
Page 15: Dynamic Analysis of Swimmers During Training
Page 16: Dynamic Analysis of Swimmers During Training
Page 17: Dynamic Analysis of Swimmers During Training
Page 18: Dynamic Analysis of Swimmers During Training
Page 19: Dynamic Analysis of Swimmers During Training
Page 20: Dynamic Analysis of Swimmers During Training
Page 21: Dynamic Analysis of Swimmers During Training
Page 22: Dynamic Analysis of Swimmers During Training
Page 23: Dynamic Analysis of Swimmers During Training
Page 24: Dynamic Analysis of Swimmers During Training
Page 25: Dynamic Analysis of Swimmers During Training
Page 26: Dynamic Analysis of Swimmers During Training
Page 27: Dynamic Analysis of Swimmers During Training
Page 28: Dynamic Analysis of Swimmers During Training
Page 29: Dynamic Analysis of Swimmers During Training
Page 30: Dynamic Analysis of Swimmers During Training
Page 31: Dynamic Analysis of Swimmers During Training
Page 32: Dynamic Analysis of Swimmers During Training
Page 33: Dynamic Analysis of Swimmers During Training
Page 34: Dynamic Analysis of Swimmers During Training
Page 35: Dynamic Analysis of Swimmers During Training
Page 36: Dynamic Analysis of Swimmers During Training
Page 37: Dynamic Analysis of Swimmers During Training
Page 38: Dynamic Analysis of Swimmers During Training
Page 39: Dynamic Analysis of Swimmers During Training
Page 40: Dynamic Analysis of Swimmers During Training
Page 41: Dynamic Analysis of Swimmers During Training
Page 42: Dynamic Analysis of Swimmers During Training
Page 43: Dynamic Analysis of Swimmers During Training
Page 44: Dynamic Analysis of Swimmers During Training
Page 45: Dynamic Analysis of Swimmers During Training
Page 46: Dynamic Analysis of Swimmers During Training
Page 47: Dynamic Analysis of Swimmers During Training
Page 48: Dynamic Analysis of Swimmers During Training
Page 49: Dynamic Analysis of Swimmers During Training
Page 50: Dynamic Analysis of Swimmers During Training
Page 51: Dynamic Analysis of Swimmers During Training
Page 52: Dynamic Analysis of Swimmers During Training
Page 53: Dynamic Analysis of Swimmers During Training
Page 54: Dynamic Analysis of Swimmers During Training
Page 55: Dynamic Analysis of Swimmers During Training
Page 56: Dynamic Analysis of Swimmers During Training
Page 57: Dynamic Analysis of Swimmers During Training
Page 58: Dynamic Analysis of Swimmers During Training
Page 59: Dynamic Analysis of Swimmers During Training
Page 60: Dynamic Analysis of Swimmers During Training
Page 61: Dynamic Analysis of Swimmers During Training
Page 62: Dynamic Analysis of Swimmers During Training
Page 63: Dynamic Analysis of Swimmers During Training
Page 64: Dynamic Analysis of Swimmers During Training
Page 65: Dynamic Analysis of Swimmers During Training
Page 66: Dynamic Analysis of Swimmers During Training
Page 67: Dynamic Analysis of Swimmers During Training
Page 68: Dynamic Analysis of Swimmers During Training
Page 69: Dynamic Analysis of Swimmers During Training
Page 70: Dynamic Analysis of Swimmers During Training
Page 71: Dynamic Analysis of Swimmers During Training
Page 72: Dynamic Analysis of Swimmers During Training
Page 73: Dynamic Analysis of Swimmers During Training
Page 74: Dynamic Analysis of Swimmers During Training
Page 75: Dynamic Analysis of Swimmers During Training