what's going on everybody and welcome to
a video on the Python plays GTA series
just want to go through some of the code
aspects of the Charles 2.0 as well as
address some of the frequently posted
comments so first I want to do is I'm
just gonna drag up the tensor board this
is the training cycle I actually ended
up having to train this model twice the
first time I forgot to save the model
yeah I was pretty angry anyway
um really this one took 24 hours so like
just one whole day and that's 24 hours
per époque and all I did was train this
model for one epoch and I went that way
because at least with mobile net I
trained that for multiple epochs and
then went back and saw how each epoch
did over time in terms of validation
accuracy and after one epoch validation
actors so you did only one thing and
that's go down so with exception I
honestly have not run it beyond one
epoch looking at validation accuracy and
validation loss especially you know like
all validation losses done has gone up
after you know I don't know a third of
training so after that like this looks
like it's about to start coming down
anyways plus validation losses and
continuing to drop so I only did one
epoch at some point I may end up pushing
this model a little further just to see
but I don't think it's gonna do any
better so really only one epoch a ton of
training data though and yeah that one
epoch took 24 hours so anyways yeah cool
so that's the model that we're using X
ception mobile net you can kind of see
how mobile net compared to exception
very very close in terms of their
performance just a little different like
exception dropped quite quickly with
with the loss and let me just refresh it
so we get both I don't know why is this
graph like all goofy yeah I guess
because it's the validation laws but if
I unsmooth it any more you can't see
these main ones but you can see here
that exception was just slightly better
the whole time in all
of the metrics that you can track so or
at least all metrics that we track so
anyways
exception it was so next thing I want to
talk about is well one thing was for
sure
the the image pre-processing
just divided by 255 so all of your image
arrays need to get divided by 255 that's
really simple I don't think I need to
show code for that just understand that
that was one of the changes that got
made so now I'm gonna pull up the github
in fact I can just fullscreen it and
come to two files I just updated one is
the exception model itself and the other
one is this weighting distribution by
class so coming over here this is just
the setup for the exception model
because all you really have to do is
just import it from chaos and then you
set the the input shape for that first
layer and obviously you don't accept
their weights they do offer like
pre-trained weights that you can use
transfer learning with I wanted to use
all of my own data I've got plenty of
data that wasn't an issue so I didn't
need to do transfer learning specify the
shape again 270 by 480 this is quite a
big resolution if you want you could
take a picture I have I shouldn't have
one maybe even in in here let me scroll
down real quick I don't but I bet I do
on cyber do I have an image of a 4 8 -
you know 480 by 270 here you go yeah so
this is a 480 by 270 resolution and if
we just kind of like zoom in a little
bit I mean I feel like at this
resolution you can see all the things
that you really need to see in a model
like I can tell that's a car and a bus
and this is a car car this might be a
motorcycle but it's so far off in the
distance I don't really care I can tell
these are cars traffic light is easily
discernible buildings trees I feel like
480 by 270 s good enough also the
mini-map is easy to read whereas at 160
by 90 that's like impossible and like
this is clearly a bus but what the heck
is this I really don't know is that a
bench or is that a car you know
so I think that's a pretty good
resolution so we're gonna go ahead and
just continue with that resolution
really that's it honestly it's just use
exception rather than inception v3 the
next thing is the waiting class
distributor I'll come up with a better
name at some point but basically what it
does is it distributes the weights by or
it adjusts weights in order to
effectively distribute classes evenly so
in the prepared prepare data data set
let's see oh this is actually I think
this will be that's a training data but
the actual validation data is something
like it's like 500 gigabytes worth of
data it's a ton of training data
I'm sorry enough 500 gigabytes uh like
500 megabytes worth of training did it's
a few samples from each of this segments
of things that we did so I created some
training data and other people had
created some training data and we kind
of pulled them all together I also
created training data at different times
at one point I started using the the
speedometer to attempt to see if we
could teach Charles like how fast he was
going at a given time but then also the
waypoints weren't always there but later
we added the waypoints so this this
model has been trained with waypoints
without waypoints with a speedometer
without a speedometer and then in all
the other scenarios like at night in the
daytime please no please and so on
storms all that stuff so this model has
training and all that and that's really
why this model works without the you
know like the GPS and stuff like that
and I suspect that's why this model it
performs much much better one of the
things that a lot of people said is like
hey this model goes way too fast that's
kind of the whole point the whole point
of the model is to drive erratically
like I don't know about you but when I
play Grand Theft Auto I Drive pretty
darn erratically and I think most people
do as well so the whole point of Charles
is to drive like that and some people
are claiming he doesn't break maybe you
weren't here for the other models this
is interesting I just noticed this that
can't be correct I think I would have to
go in there and fix that is that I
wonder when that that has to have come
in
I gotta be sy I gotta fix X anyway sorry
I got distracted when I noticed it's one
point a it must have just gotten hit or
something whenever I was moving things
anyways some people were like oh you
know it doesn't use his brick he
definitely uses his brakes so if you
turn into the stream or something you
can hear the squeal of his brakes when
he's using them and you can also just
see he slows down considerably this is
probably the first model that actually
uses its brakes and it does quite
heavily and then as far as crashing into
things like I would say the previous
Charles model was like I don't know
avoided things 10 to 20 percent of the
time where is this one 70 percent of
time I mean he's doing pretty good in my
opinion I guess that doesn't matter but
yeah so the other thing that I did hear
is so what so this script just goes
through and just ignore that a I'm gonna
fix it at some point and then here's the
decay and then all it does is it goes
through these you know you start with
weights of 1.0 and then this is just so
I know which is which then also I have a
close dict basically this is keys that
are closed right so if if the model
predicts a but it was meant to be a waa
that's better than if the model
predicted a D and it was meant to be a
waa right so I wanted to just know as I
adjusted the weights if we were losing
sight of also just being close to the
right answer because the theory of
course is is that the validation data is
perfectly balanced so all the classes
should be predicted an equal number of
times and so the theory of this script
is let's adjust the weights until that's
true and if we do that the end result
will be a better model and so anyways
this is another way of just kind of
measuring like is that still happening
and then of course running it in game is
the final test right is this actually
better so anyway here we just load in
the model we have this distribution
dictionary then this is just for simple
calculations and then we just start
going through the data so again like I
said you bring in the data this is just
opening the training files which are raw
data so then here we div by 255
this is the answer this like the
classification we checked the prediction
and then we are using weights because
that's the whole point of this so it's
just whatever the output from the neural
network was so this is just an array
right of this distribution of what it
thinks the prediction is so then we
applied this numpy rate array of weights
we just multiplied it so this is not new
we've been doing that since the very
very beginning so if we go to test model
dot pipe and we scroll down I am sure we
will find it looks like this yes so
again same thing model that predict and
then we just multiply that prediction by
another array of weights now these are
what these weights I just adjusted by
hand and then would test it in game
adjusted again by hand testing game and
I just felt like there's got to be a
better way than doing that and so that's
what how I came up with this method here
so then all it does is as it's you know
iterates through all this stuff it just
kind of prints out both the new accuracy
it prints out the weights the act the
real accuracy against the actual data
and then the closeness accuracy so again
the closeness is just like hey if it was
meant to be a W but it says W a we're
gonna say that's still worth like being
thirty percent right okay so you still
take a hit but it's not the full hit so
anyway that's what this script does so
then I just ran this for like many many
iterations and basically once there you
just run it you can run it indefinitely
but if you just keep running
indefinitely this is gonna keep shaving
weights off but until things are pretty
well distributed you just want to keep
on running it now with exception here I
found a few things were curious and I
think it's still the case I'm actually
gonna pull up or did I save them I did I
did save them so yeah so so s the break
and s a yeah and SD so well all of these
were indeed things that he does just
does not want to
so I actually would i ran the script for
quite a while and he still was never
issuing breaks so then what I did was I
just set these to 1000 which is crazy
because look how little these numbers
are they started at 1.0 and then I was
like dude so I set it to a thousand
watch the first I did 10 and then I did
a hundred and I was like dude it's still
not breaking I did a thousand and then
he starts to break so anyway I assure
you he breaks I've got data to prove it
but yeah that required some huge weights
the other thing is once he gets in game
this wait for go forward is just not
enough he doesn't move enough so I just
after the fact this was actually the
only weight I manually adjusted after
this distribution but it was definitely
necessary this one just doesn't move
enough okay so those are all of the
changes I don't really think there's
much more for me to talk about leading
up to this point if I have forgotten
something someone feel free to remind me
but what I'm gonna be focusing on next
is taking or basically re bringing back
the re bringing back just bringing back
the object detection API from tensorflow
so hopefully that is supported on
tensorflow 1.11 I just upgraded a 1.1
one the new release candidate so I'm
hoping to continue with that throughout
this project we'll see how that goes
I seem to have just horrible memories of
working with the object detection API I
hope it's better now but I doubt it
anyway that's gonna be the next thing I
jump into that way Charles can be you
know can exit the vehicle and all that
and then also we can begin to do you
know if there is no motion going on we
know we're stuck and we can get out of
it and stuff so anyway that is
everything I believe like I said if
you've got questions comments concerns
suggestions whatever you think Charles
is dumb let me know below or if you
think Charles is awesome and I will hurt
your comment
anyways that's it for now a quick shout
out to the recent sponsors we got to
Edwards Edward McCain I apologize
Deut nation median I don't know Joe best
Dooley I think I recognized that one as
a second time maybe it is if people
continue I see their name again I'm not
really sure and Edward William Sam's
thank you guys very much for your
support I really appreciate it you guys
let me do this kind of stuff and it's
probably the best job I could possibly
have so thank you guys very much anyways
that's all for now the github is messy
right now it's going to continue to be
messy
other things people did talk about was
like you should have joystick control
trust me we did it before
I'll probably do it again the problem is
it makes some things better and then
some things worse so if with the
joystick control or like any sort of
degree control it does slow him down
quite a bit so he won't go like full
speed all the time the problem though is
when he doesn't go full speed he turns
early for many many turns because in the
training data I went full speed I drove
very erratically so if he slows down and
as he approaches turns and you if you've
been following the stream either before
or even now this is still a problem if
he's not going very fast he still tries
to turn early for a turn as if he's
going fast and he's gonna slide out a
little bit and so that's kind of a
problem so I'm not really sure how we're
gonna overcome that but I may bring back
in the joystick control but the next
thing I really want to focus on is
object detection really got to get
object detection back so we can get them
back stealing cars when he loses a car
we can take away the invincibility and
then we can also have him do a lot more
things like interact on foot and stuff
like that so that's definitely what I
want to do next so I got to start
collecting data and all that it'll be a
hoot and a half so anyway for like the
19th time that's it
questions comments concerns whatever
feel free to leave below otherwise I'm
gonna see you guys in another video