AI Learns To Play Golf
Summary
TLDRIn this video, the creator explores the development of a golf-playing AI using four separate neural networks for different golf clubs. Each network is trained with a reward system to optimize swing mechanics. Despite unconventional techniques, the AI achieves impressive results, with the driving AI hitting balls 210 yards. Challenges arise in adapting the algorithm for irons and short game clubs, but the AI shows promise, raising anticipation for its performance in an actual golf course scenario.
Takeaways
- 🤖 The video features an AI-controlled ragdoll named 'Block House' playing golf, utilizing a neural network to simulate a golf swing.
- 🏌️♂️ The AI is split into four separate neural networks, each specialized for driving, irons, chipping, and putting.
- 🚀 The driving AI is trained to swing the club with a specific direction determined by the cross product of vectors from the shoulder line to the club face and the right shoulder.
- 🎯 A reward system is implemented to guide the AI, focusing on club velocity matching the target direction and minimizing deviation from the swing plane.
- 📉 The iron AI is adjusted to account for shots typically taken from the ground, not an elevated tee, and emphasizes keeping the club flush with the ground.
- 🌐 The wedge AI is trained with an extra input to control swing strength and is tested on randomized terrains to improve adaptability.
- 💻 The putting AI focuses on accuracy and control, with a reduced backswing to encourage consistency over speed.
- 🤹♂️ Despite the AI's unconventional techniques, such as one-legged stance and face plants, it can achieve consistent and effective golf shots.
- 📊 The training process involves reinforcement learning, where the AI learns from rewards and punishments based on its performance.
- 🌟 The video concludes with a teaser for a future video where the AI will be tested on actual golf courses.
Q & A
What is the purpose of increasing the size of the golf ball in the AI simulation?
-The size of the golf ball is increased to overcome limitations in the physics engine where small objects tend to phase through solid surfaces. This also helps to better simulate how the club interacts with the ground during golf shots.
How many separate neural networks are used for the AI golfer, and what are they responsible for?
-Four separate neural networks are used for the AI golfer: one for driving, one for irons, one for chipping, and one for putting. Each network is specialized to handle the unique swing requirements for each type of golf shot.
What is the swing plane and how is it calculated?
-The swing plane is defined as the axis around which the golf club needs to be tilted to hit a perfect golf shot. It is calculated using the cross product of two vectors: one from the shoulder line to the club face and the other from the shoulder line to the right shoulder.
How does the reward system for the driver AI work?
-The reward system for the driver AI compares the velocity of the club to a target direction using the dot product. It also measures how far the club has deviated from the swing plane and gives a punishment that scales with that deviation.
What changes are made to the AI's swing when it needs to come back the other way after the backswing?
-The swinging reward is reversed once the club is past a certain point relative to the ball, and the swinging reward is squared to emphasize the importance of moving the club fast.
How does the AI's iron swing differ from its driver swing?
-The iron swing is similar to the driver swing, but with a slight tweak to the reward system to keep the club flush with the ground. The backswing is also shortened to reduce the swing speed, leading to a more precise swing.
What additional input is added to the neural networks for the wedge and putting AI?
-An extra input is added to control how hard the AI swings, shifting the focus from rewarding speed to rewarding how close it gets to the target speed.
How does the AI handle uneven terrain during wedge shots?
-The AI learns to hit shots on uneven terrain by simulating random platforms for the ragd doll to stand on during training, which makes it more resilient to uneven terrain on actual courses.
What adjustments are made to the putting AI to improve its performance?
-The putting AI has its backswing greatly reduced to focus more on consistency than speed. It also follows a set of rules to ensure proper putting technique, such as keeping the leg straight and hitting the ball at a 45° angle.
What are the results of the AI's training for different types of golf shots?
-The AI's training has been successful for driving and iron shots, with the AI capable of hitting long distances and maintaining a consistent swing. The wedge AI shows versatility in hitting from various surfaces, while the putting AI, despite some issues, is functional and can putt effectively.
Outlines
🏌️♂️ Golf AI Development
The video script introduces the development of a golfing AI using a neural network. The AI, named 'algorithm poo,' is enhanced with four separate neural networks, each specialized for different types of golf swings: driving, irons, chipping, and putting. The script discusses the limitations of physics engines in simulating golf, such as small objects passing through solid surfaces and the difficulty in simulating club-ground interaction. To address these, the ball size is increased. The AI's reward system is explained in detail, focusing on the driver swing, where the direction of the swing is determined by the cross product of vectors from the shoulder line to the club face and the right shoulder. This direction defines the swing plane. The script also explains how the reward system is adjusted for the backswing and the importance of speed in the downswing. The AI's training results in a successful golf swing, although it ends with a humorous face plant.
🚀 Iron and Short Game AI Training
The script continues with the application of the same algorithm to an iron swing, which is similar to a driver swing but with the added challenge of being hit from the ground. The reward system is tweaked to emphasize keeping the club flush with the ground. The backswing is shortened to reduce the AI's swing speed, aiming for a more precise swing. The training is successful, and the AI demonstrates a consistent iron swing, albeit with a tendency to drag the club along the ground before striking the ball. The script then discusses the challenges of training the AI for short game shots, where accuracy and control are more important than distance. For the wedge and putting AI, the reward system is adjusted to reward proximity to the target speed rather than speed itself. The wedge AI is trained on uneven terrain to increase its resilience, while the putting AI focuses on consistency due to the generally flat nature of the green.
🤖 Mixed Results in AI Golf Performance
The final paragraph discusses the results of training the AI for wedge and putting shots. The wedge AI performs well, with a stance and swing similar to real golfers, but it tends to fall over, likely due to its training on randomized surfaces. The putting AI, however, does not perform as expected, humorously described as following a set of rules that lead to an ineffective putting technique. Despite the mixed results, the script concludes that the golf AI is complete, with four neural networks for different types of golf shots. The anticipation is set for the next video, where the AI will be tested on actual golf courses.
Mindmap
Keywords
💡AI
💡Neural Networks
💡Reinforcement Learning
💡Physics Engines
💡Cross Product
💡Swing Plane
💡Dot Product
💡Driver
💡Iron
💡Wedge
💡Putting
Highlights
Introduction of a sporting AI for golf using algorithm 'poo'
Return of the 6ft tall, 187 lb ragdoll 'block house' with a neural network
Limitations of Big Balls physics engines and solutions
Increasing the size of the golf ball for realistic simulation
Splitting AI into four separate neural networks for different golf clubs
Use of cross product to determine the swing plane
Reward system based on club velocity and target direction
Adjusting the reward system for backswing and emphasizing speed
Training results showing AI capable of hitting golf balls 210 yards
AI's unique golf swing technique despite ignoring traditional principles
Applying the same algorithm to an iron for different swing mechanics
Tweaking the reward system for iron shots to keep the club flush with the ground
Shortening the backswing for a more precise iron swing
AI's iron swing technique and its impact on distance
Transitioning to short game with a focus on accuracy and control
Adding extra inputs to neural networks for wedge and putting AI
Simulating uneven terrain during training for wedge AI
Reducing backswing for wedge and putting AI to focus on consistency
Mixed results from wedge AI showing versatility but issues with balance
Putting AI's performance and the challenges it faces
Completion of golf AI with four neural networks for different types of shots
Upcoming test of golf AI on actual golf courses
Transcripts
we are starting to rack up quite the
collection of sporting AI on this
channel but honestly it's not enough I
want more so today we're going to play
some golf with this comes the return of
our trusty algorithm poo which is making
its fourth appearance on this channel
similarly a red ragd doll will also be
returning a friend of mine has told me
to name it block house but unfortunately
some bouldering place we both go to has
stolen it so that's unlucky in case
you're new to this channel this ragd
doll is 6t tall and about 187 lb or if
you're English about 1 and 1/2 hours of
beer at the allei pal it also Sports a
big neural network to control itself
which in this case will be used to
create a golf swing now before you begin
I just want to clear up a few things
firstly Big Balls physics engines have
limitations small objects tend to phase
through the solid surfaces and it's kind
of difficult to simulate how the club
interacts with the ground on some golf
shots to solve both these issues we're
going to increase the size of the ball
besides that it should behave
identically to a real one this includes
rolling friction bounciness shot shaping
not being able to find it in the woods
and kicking it when nobody's watching as
for the AI there's a different kind of
issue golf is hard and each Club
requires a different kind of swing with
this in mind we're going to split our AI
into four separate neural networks one
for driving one for irons one for
chipping and one for putting we are
dealing with reinforcement learning here
so we need a reward system for each one
let's start with the driver the first
thing we need to do is tell the AI which
direction it needs to swing the club but
what direction is this well let's take
the direction from the shoulder line to
the club face and the direction from the
shoulder line to the right shoulder we
can take these two vectors and perform
an operation known as the cross product
this spits out a new Direction this
direction defines something called a
swing plane which is basically the axis
we need to tilt around to hit a perfect
golf shot we can take this new Direction
with the shoulder line to the club face
and apply the cross product again this
final Vector is the exact Direction the
club should be moving in to create a
perfect swing we can now easily turn
this into a reward by comparing how much
the velocity of the club matches this
direction and then give out a reward
accordingly in Math's terms this will be
the dot product of the club's velocity
and the target direction we can also
reuse the swing plane to measure how far
the club has deviated from it and give
out a punishment that scales with that
to help guide the club back on target
this is a good start and this reward
system will generate a good back swing
but eventually the club will need to
come back the other way this can be done
by measuring the angle of the club
relative to the ball and simply
reversing The Swinging reward once it is
past a certain point once this happens
we will change the swinging reward a bit
by squaring it this really emphasizes
the importance of moving the club fast
by giving the AI huge rewards for doing
so unless you're really bad with your
wedges your driver should be your
longest shot so we're going to encourage
the AI to swing as hard as possible here
back come back other than that we've now
covered all the basics of a golf swing
and it should be enough for our driving
AI to learn how to hit good golf shots
let's see what it comes up
[Music]
[Music]
with
[Music]
[Music]
[Music]
H some interesting results there our
training has been successful and our
driving AI is now capable of Smashing
golf Falls roughly 210 yard there is a
slight pull in its shots but this can
easily be compensated for by aiming
slightly to the right if we examine the
Technique we can see this beautiful
swing in action the AI immediately
shifts all of its weight onto its right
foot because obviously one leg is better
for balance than two but you know what's
better than one leg none which the AI
demonstrates by attempting to fly like
Superman as it brings the club back down
it holds this position all the way until
it strikes the ball at which point its
legs are completely parallel with the
ground we are then treated to two very
contrasting actions a beautiful drive
and a painful face plant despite
completely ignoring all golf principles
our AI has managed to create a unique
and interesting swing but how well will
this transfer to other types of golf
shots let's apply the same algorithm to
an iron iron swings are very similar to
driver swings but there is one big
difference typically irons are hit from
the ground not an elevated te this makes
the shot slightly more challenging as
lowering the club to much will at best
turn it into a lawn mower and at worse a
shovel we will take the original reward
system and add one small tweak we will
measure the height of the club from the
ground and give it a reward based on how
close it is to being flush this places a
bit of emphasis on keeping the club
flush with the ground without being too
overbearing on the original system
additionally we will shorten the back
swing a bit which will reduce the speed
at which the AI swings overall this
slightly tweaked reward system should
lead to a more precise swing let's see
how it
goes
[Music]
[Music]
[Music]
[Music]
[Music]
once again our training has been
successful overall the technique Remains
the Same the AI pivots onto its left
foot like before but this time it's a
little more stubborn and opts to keep it
there all the way until it strikes the
ball after the hit it transforms into a
Tetris piece and face plants the path of
the club is a little sloppier and tends
to drag along the ground just before the
ball is struck this is a little
unfortunate and it does cost the AI some
distance but overall it is still
consistent enough to do its job properly
so we can now move on to the next steps
so far our AI has trained to hit it long
but how's it short game this is where
things get tricky we are now less
concerned with distance and more
concerned about accuracy and control so
our two remaining AI will be built with
this in mind for both the wedge and the
putting AI we are going to add an extra
input to the neural networks which will
help us control how hard they swing to
enforce this both the reward reward
systems will be changed slightly from
rewarding speed to rewarding how close
it gets to the Target speed we will also
add something extra to the wedge AI if
you've ever been around a green before
you may have noticed the large amount of
bumps and Hills or these holes that they
put a rake in for some reason the
terrain is far from being flat so our
wedge AI will need to learn how to hit
shots on uneven terrain during training
we will simulate this by generating a
random platform for the ragd doll to
stand on every shot attempt this will
change which will force our to become
more resilient to the uneven terrain it
will face on actual courses as for the
putting AI this isn't necessary putting
is almost exclusively done on the green
which typically is the flattest part of
a golf course for a final touch we will
greatly reduce the back swing of the
wedge and putting AIS which should
encourage them to focus more on
consistency rather than speed and that
should be all we need to do so let's run
yet another training session see you
soon
[Music]
[Music]
[Music]
[Music]
[Music]
[Music]
[Music]
[Music]
[Music]
[Music]
that's a mixed bagger results if I've
ever seen one on one hand we have our
wedge AI if you disregard the falling
over part it's pretty good The Stance it
takes at the start is quite similar to
how real golfers are taught and the
swing is also fairly normal even after
the ball is hit the AI still looks okay
unfortunately though this doesn't last
the AI finishes by attempting a kotti
kick and promptly fails because of its
training on randomized surfaces the
wedge AI boasts quite a bit of
Versatility it can hit a ball from a
flat surface or a bunker or a
tree or even inside a clubhouse it
doesn't matter it's pretty good at its
job wish I could say the same about the
putting AI though here's a small set of
rules to ensure that you too can learn
how to putt one make sure you keep your
leg straight and make sure that you're
looking at the ball two if you're sure
of the speed of your swing drag your
putter along the grass so that you can
readjust it three follow through
preferably as stiff as possible four hit
the ball on a 45° angle this is
extremely important as the flag might be
in that direction and finally lie down
this will conserve energy for your next
shot follow these rules and you'll be a
professional in no time or you might
just end up being a shitty putting robot
you know what it works and that's good
enough for me our golf AI is now
complete boasting four neural networks
for every type of Shot Golf has but how
will it perform in a real game in the
next video I will put it to the test by
cing it through some golf courses
special thanks to the Banana Fish C for
supporting this
video yes I a ho in one I won had
reward what mean no you didn't even
check what does mean you think I
understand that you got what it takes
where where are my giant Apple te why
did it take 6 months for that video to
come
out
Weitere ähnliche Videos ansehen
GAME IMPROVEMENT IRONS vs PLAYERS IRONS | Which SHOULD You PLAY?
Gender Classification From Vocal Data (Using 2D CNNs) - Data Every Day #090
This device could FIX YOUR GOLF SWING! | BAL.ON Smart Kit Review
Club 99 - Golf Club Descriptions
Stop Hitting Behind The Ball
Shark Tank US | Fling Golf Is 'The Future Of Golf'
5.0 / 5 (0 votes)