Placeholder Image

字幕列表 影片播放

  • what is going on?

  • Everybody, welcome to the second part of our machine learning with Hallie three tutorial in this video, we're gonna be building on the last one.

  • So in the last video, we, um we basically were checking t see if we could do this like math of relative positions to get the surrounding coordinates of any given ship.

  • We definitely confirmed that we could, including getting like the rolling over of the edge of the map and so on.

  • So we are confident that we can do what we want to do.

  • So now what we want to do is work on what does the what is the individual ship?

  • See, so to speak.

  • And what is the input layer to our neural network?

  • In this case, it was specifically a convolution.

  • All neural network.

  • So coming on down here to this, like, block of code that we took from the testing grounds that we built, we just kind of needed slightly modify this, but not not too much.

  • Most of what is here actually gets to remain.

  • We're gonna be adding quite a bit, though, so for size three is probably too small.

  • We just did that for testing purposes, I would go with a 15 or maybe even a 16.

  • If we go with a 15 that would give us a 31 by a 31.

  • So it's always gonna be this number times two plus one, and that will give you the grid size.

  • I'm gonna go with 16.

  • Purely.

  • Because if we want to use things like Mobile Net and Inception and some of these other models, the minimum size is 32 by 32.

  • So we could re size or we could pad or whatever.

  • Or we could just build data that has the proper size right out of the freaking gate and we'll be all set.

  • So I'm gonna do so next eso size 16.

  • That gives us, at the end of the day a 33 by 33 grid that every ship sees.

  • So on the smallest map, it will see the entire map on the largest map 30 33 by 33.

  • Grid is huge.

  • Should the ship exceed those boundaries?

  • For whatever reason, it's probably already lost any ways.

  • But okay, anyway, uh, cool.

  • So 16 by 16 For now, surroundings is currently empty and later we were gonna populate with coordinates.

  • But we really don't need to do that.

  • That was just for quick testing purposes.

  • Now we want to do is populated with meaningful values.

  • So what I propose is that surroundings contains It's a list of lists where each list is your pixel value, so to speak.

  • And we should have the following.

  • I think my I've lost my That's unfortunate.

  • My caps lock light on my keyboard no longer works.

  • That sucks.

  • Oh, what a bummer.

  • I don't know if I could go on in this tutorial.

  • Ah, that's really depressing.

  • Oh, man.

  • My number, like all those lights aren't working anymore.

  • Darn it.

  • Okay, show must go on.

  • I guess, uh, I'm really dead inside now.

  • Okay?

  • Anyways, eso So the first value will be how light amount, Um, Then ship and then drop off.

  • So probably will be a shipyard, but it could be, um it could be a just a simple drop off location.

  • I doubt we will make it that for we will probably only have, uh, shipyards rather than adding more drop offs and stuff.

  • I don't think we'll get big enough.

  • T need drop offs.

  • But, hey, that would be really cool.

  • And it'd be great to be prepared.

  • Should we be so lucky.

  • Okay, so, um so that's what we want, Purcell.

  • So for each pixel, let's say in this image that we're going to draw the first value.

  • So So it's we will be able to depict this as if it's our g B.

  • So we could show this in, like, open CV or something just to test.

  • But anyway, that should be all the data we need.

  • The only thing we're kind of missing here is what turn number are we on?

  • So we have really At this stage, we're not in putting to the neural network.

  • Where in the game are we?

  • So if you're like, really early in the game, you could travel pretty good distance.

  • That's fine, as long as you and the other thing we don't know is like, how much?

  • How light do we currently possess right now?

  • So in the early game, or like kind of early mid ish game, it's okay to travel long distances, but towards the end of the game, if you travel out too far and you have time to come back and deposit the end of the game.

  • That's no good.

  • So So we have no concept of where we are in the game or how much how late we actually have.

  • Um, so that's kind of unfortunate that our model won't have that data later on.

  • Maybe we could also pass turn number or even a ratio of, like, turn number out of how many turns we know there will be.

  • So you know exactly how many turns there will be by the size of the map.

  • So you could maybe, rather than three channel continent, you could have a four or five, so we could have turned number and Hal i TTE And then maybe, you know, make the max How light?

  • I don't know.

  • 70,000 or 80,000.

  • Something like that is a pretty high threshold.

  • So it would still be between zero and one, which you want for scaling purposes.

  • Anyway, for now, we'll stick with the three channel, But there's every room, toe, ADM.

  • Or of things for sure.

  • Okay, So to know, certain things like ship and drop off we want to know is that our ship, or is an enemy ship is it our drop off location or an enemy drop off location.

  • I think these things matter.

  • So before we generate over ships, we do wanna have, um we want to know where are we want to know our ships.

  • And we want to know, um, we would like to know our drop off locations, so at least our drop drop off.

  • We'll call this drop off.

  • Um, come, um, I'm trying to decide how I want to do this drop because, like the drop off ourselves, we really could just go me dot Get?

  • I think it's me dot Get drop offs like drop offs equals me dot get drop offs.

  • But I don't recall if Mita get drop offs.

  • Contains also me dot shipyard.

  • I don't I don't remember.

  • And this I don't know if this is a list, so let's make sure that's a list and then plus, um ah, me, that shipyard, we'll just do this.

  • So this should just be drop off objects in shipyard objects list be dot get drop offs.

  • In fact, let's do so.

  • How about Mmm mmm.

  • Decide how I really want to do this.

  • Ah, And then for now, let's just say ships equals, Um, no, we definitely need.

  • We want to know what the position.

  • So let's do, um, d dot position for D in.

  • Okay, uh, because we want to know, Because we're gonna be on Lee looking at the cell, so we definitely need to do it this way.

  • Uh, drop off.

  • So it's called this drop off positions, and then we'll call this ship opposite positions and then, yeah, we'll just do what we had done before.

  • I can't remember if this was in our text based version or not.

  • If we had done up to this point, uh, ship positions and drop off positions, but this definitely we need.

  • So now it'll be Estai.

  • Position for s in list me dot get underscores ships.

  • Okay, so now we got the drop off positions in ship positions.

  • This way, when we go to check that cell on the helo on the game map, if it has a ship and we don't have those coordinates in our ship positions, we know that's an enemy ship.

  • If we D'oh!

  • Hey, that's our chip.

  • Great.

  • Cool.

  • Same thing.

  • We're drop off, we can find out.

  • Is it our drop off Or is this an enemy drop off just by checking to see if we have that position in those lists.

  • Okay, so now, So this is a row.

  • We are definitely going to keep that as a row.

  • So now what we're gonna do is for X and then for her.

  • For why?

  • Rather than for X what we're gonna say I just want to make some space so I can see what the heck I'm doing here.

  • And then we'll zoom in.

  • Hopefully Kinkle.

  • So first of us, a current cell equals game map, and then we want the game map at ship dot position.

  • So shipped a position that ship, as in this ship up here that were iterating through shipped up position, plus ah, position, object of x and y.

  • So this is just that relative coordinate relative to our current ship.

  • So that's that sell that we're currently interested in.

  • So current cell may be of interest would be a better Ah, better name, then what we're gonna say if current underscore cell don position in drop off positions, um or let's see if current if current position in, because in theory, we could have I kind of have to do it because you could have an enemy ship on your drop off.

  • That's totally possible.

  • So and actually, I don't know the answer.

  • So if two ships collide the highlight scenes, But if an enemy ship is on your drop off location and you go to the drop off location, I don't know what happens to your how light like, will you deposit it or does it sink to the bottom of the ocean?

  • I don't know the answer to that.

  • Anyway, someone comment below.

  • If you know the answer, what happens in that scenario anyway?

  • If current in drop off positions, um, if current, let's say drop, um drop friend foe equals.

  • So if that position is in our drop off will say that's a one else drop friend Foe equals negative one.

  • So if we happen to find a drop off and it's not that we'll check these numbers, hopefully this will make sense later.

  • This is probably the worst logic ever.

  • If current cell dot position in ship, what is it?

  • Ship?

  • Is that what we call that?

  • Ship positions?

  • Ship positions?

  • Um, ship, friend, ship, friend, Foe equals one.

  • Um, else ship friend.

  • Foot foe equals negative one.

  • So we can use this as a multiple.

  • So I believe we can on Lee find out, um, if a cell has a ship like it's a true or false kind of thing.

  • Um, so either it has ship where it doesn't have a ship, So we're gonna use that by, uh, weaken, because I don't think we can find out if it's our ship or their ship.

  • The only way we can know for sure is if, um if it's in our list of ships or not, I could be totally wrong.

  • Like I said, this is just me running through this problem.

  • I am sure there are many ways that we could do things better than I'm going to do them.

  • Okay, So, um, so, basically, what we're going to say is, uh we need to get a few things.

  • So, first fall, how light to know about that?

  • We're gonna say Halle equals current, so dot how light, um, underscore amount.

  • And that gives us the current amount.

  • Which the maximum you could ever have is 1000.

  • So a given cell can't have over 1000.

  • I don't believe At least naturally it can't again.

  • If two ships crash into each other there they lose all their Hallett.

  • But it doesn't sink.

  • It just stays afloat.

  • So I don't know.

  • What if two ships have 1000?

  • Hal I TTE is that make that 2000?

  • How light?

  • Where is it?

  • Max?

  • Out at 1000.

  • I really don't know because the constant Max Hallett is is 1000.

  • So I don't know again comment below, if you know the answer to that one anyway, for now, let's just assume it will always be 1000.

  • And once in a while it'll be more.

  • But basically we want to make We want everything in with neural networks especially.

  • But most machine learning algorithms want everything to scale between zero and one or negative one and positive one.

  • So in this case, Hallet amount being anywhere from 0 to 1000 we don't really want that.

  • You said we want to divide it by Constant Stott.

  • Max Hal I TTE and then I'll give us a decent on number.

  • But to stop for any gigantically long decimals will also around that to the nearest to decimal points.

  • Just so we don't get anything too absurd.

  • Um, and it was just this way we can keep our data set size relatively small, because over time, each game could It's gonna be probably quite large.

  • And we just there's no need to have a super long decimal point.

  • There were really just looking for general numbers.

  • So then, ah, ship status would be current cell dot ship again.

  • This is a true or false are, actually, um I think maybe it returns a ship object if there is, and then otherwise, it's none.

  • Um, I think that's the way it goes.

  • I'm not positive.

  • Also.

  • Yes.

  • So we're interest, so that would be a problem.

  • So we're rich already saying four, shipping me that cat ships.

  • If we come down here and redefine ship, we're gonna get in a little bit of trouble.

  • So, actually, let's say a ship.

  • So a ship equals current cell dot ship, Then the next thing was structures.

  • So current, so dot structure again, that's going to be a nun, or plausibly a actual structure.

  • I don't recall it'll be nun or a thing, though, So if hal I TTE is none.

  • If Fallon is none, um Hal, I equals zero.

  • Uh, if a ship is none, then we're gonna say ship a ship equal zero If structure is nine, structure equal zero.

  • If Halle is not, I always like to get This is usually where I you do like a double equals, but it doesn't appear that I've done anything wrong.

  • So cool.

  • So we got that now, um, if a ship in effect.

  • So in this case, Hal I TTE is is, um, if if a ship is none else else, um, a ship equals ship friend foe times.

  • Um And in this case, it's a ship object.

  • So we would say a ship don't How light amount divided by Max lips.

  • No, constance dot Max Hallett.

  • And again, we're gonna want around that Ah, shit.

  • From four times this.

  • So negative one times this or positive one times that round.

  • And we're gonna round that too.

  • Again.

  • The nearest to that should be fine.

  • And then structure in this case, um, if structure is non structure, zero else structure equals, um what was it struck structure?

  • What we say here?

  • Ship, friend or foe drop friend or foe.

  • So, whatever.

  • It'll either be negative one or positive one.

  • So, anyone we're like multiplying here is if the ship of its our ship, it's a positive one times, however much Hallett is on that ship divided by the max hat light.

  • So let's say it's 50% full.

  • It'll be, you know, uh, 0.5.

  • Okay, so, um, once we have that, we have our three numbers that we really want here.

  • So we can just say, um, you know our amounts or, uh, ally, a ship and structure.

  • And then we do rode out upend amounts and then should be one tab back.

  • Right?

  • So we have our once at after this, we have our full row.

  • So then it would be surroundings dot upend row and then, um, for ship in me dot Get ships.

  • So at some point, we want to write that in this case will only have one ship.

  • So really, we could just go one tab over yet again with open?

  • Um, I don't know, test text with the intention to upend as f f dot Ride the string version of surroundings.

  • Oh, no, that's good thing.

  • I scrolled down.