Placeholder Image

字幕表 動画を再生する

  • Um hello.

  • Hello.

  • Plan that wait.

  • But back then, back singing will happen.

  • Happening will happen happening will happen again and again because you and I will always be back.

  • Then you will always be back.

  • Then if there were some amazing for south inside of time to take us back to wear and hang each moment up like pictures on the walls inside a 1,000,000,000 tiny friends so that we could see it all, all it would look like will happen happening with happen, happening happen again and again.

  • Be back then you know that we'll always be back, then you and will always be back.

  • Then that's why.

  • And I will always be best friend.

  • I just knew I play the ukulele and I also like games.

  • And so there's many things you might know about me or want to know about me.

  • These are the things that are pertinent to this talk.

  • Um, games like lots of games, board games, card games, video games, like a lot of you.

  • I also program, Um and then lastly, I really like mischief.

  • Um, I like because I think of it as a jump sounding board jumping board, whatever that term is into, like, creative problem solving, creative thinking on innovation.

  • I like Mr so much that I named my son Loki.

  • Um, this is my secretary, uh, father shot of my my son, who I'm so proud of.

  • Host.

  • So one of the games I've been playing this game called Set.

  • Um, I was playing this game with my friends.

  • Susan, I want to come and go over all the rules with you first.

  • Um, So it's a card game.

  • Where, by the way, the New York Times has a set game that you can play.

  • It's kind of fun.

  • So you could go check that out.

  • Um, said is a card game.

  • It's a matching card game.

  • You're trying to make, uh, sets of three cards each.

  • You All these cards have, um, a color number, pattern and shape.

  • I talk.

  • You listen really quickly for color blind people.

  • Um, so amongst these attributes, what you're going for is a set of three cards where the attributes, the they're all the same are all different.

  • Um, and so here this is This is an example of a set where the number is all different.

  • 12 and three the patterns, actually, all the same, they're all striped.

  • Their shapes are all different, and the colors are all different.

  • Um, so this is a very fun game until you play with somebody like my friend Susan.

  • Um, who I want to give you A I don't know.

  • I don't have music.

  • Music on my thing.

  • Maybe there's musics really quickly.

  • That's correct.

  • Try again.

  • Uh, no music.

  • So this is what playing set against Susan is like, um, it's where she just starts taking cards.

  • And I'm just observing and telling her Hey, good job.

  • Um, but wow.

  • Great.

  • Great.

  • Take their.

  • Um Oh, you almost had that one.

  • Oh.

  • Okay.

  • Uh, wait.

  • Do I see something?

  • No, no, no.

  • Um, so it's trust me.

  • It is a fun game.

  • Um, but until you play against somebody like Susan So how does that make me feel, Azad, protagonist of this talk.

  • Um, how does my protagonist too satisfied with their life?

  • I can't be Susan.

  • It's set.

  • What would it take for my protagonist?

  • Me to find satisfaction.

  • This is their goal.

  • Beat Susan, it's set.

  • Uh, what are my productions?

  • Biggest years and character flaws.

  • We'll probably three things first is that I don't really want to put the effort into getting good at this game so I could sit down and just play alone a lot until I get really good at this game because it's tricking your brain into kind of seeing these sets as quickly as possible.

  • But I am pretty lazy and so not interested in that.

  • Um, I'm also impatient.

  • I don't take the time to do that.

  • Um, I'd rather do it.

  • Use it for something else.

  • And last of all, the mother of all character flaws.

  • Hubris.

  • Um, I'm pretty sure I I was reading about Starcraft being beat by deep mind and off ago in Alpha Zero.

  • And like, I can do this, I can solve set with my computer.

  • Um, and I can finally beat Susan this way.

  • Um and so I started thinking about how this problem this forms.

  • And so for a human, it's interesting, because if you think the problem in two parts, the set making is the hardest part for human, Uh, when you you can quickly see these cars and you know what they are.

  • But you can't make the sets very quickly out of them for a computer.

  • It's actually the opposite.

  • The set making of super easy.

  • Um, And the vision part, that's the hard part.

  • So I can tell we're gonna computervision the crap out of this problem.

  • All right, here's the plan.

  • Um, we I want this around my phone, so I'm gonna use the cam on my phone, get into a browser on canvas.

  • Um, and then I get pixels from those pixels.

  • We're gonna identify a bunch of cards in the thing.

  • Um, from there, we want to extract out every card, um, and then put each card.

  • We won't identify the color number of shading in shape, and then eventually, we're gonna force himself in the south of here.

  • All right, so let's get into it.

  • Um, so this is my test image for this for this thing?

  • Um, as you can see a bunch of cards.

  • Um, getting out the things that you kind of care about are these ones this get images.

  • Data is what we care about here.

  • We get out this big, huge number array, so this looks kind of foreboding and creepy.

  • Um, it's got one No, 11 million pixels in it.

  • um So let's go over what this image data object is really quickly.

  • Um, you can think of images as a series of pixels.

  • Uh, here we have not six pixels, six huge pixels.

  • Um, and then each pixel is itself basically four numbers.

  • There's a red green blue on Transparency Alfa Complainant, RGB A.

  • So that's four numbers times six pixels.

  • That's 24 numbers.

  • SATs are 24 numbers that we see here.

  • Um, and then it's a flat array, so it's one dimensional.

  • But if you know that with that, you can, you know, basically where rapid.

  • Um And so this array corresponds with this picture up here.

  • And if I change this, that that's that's transparency.

  • So it goes away, I'm gonna bring it back.

  • I can make it black.

  • I could make this one red, so you can see how those things up.

  • So we're gonna be using this image data object a lot throughout this talk.

  • So, uh, gotta get familiar with it.

  • So first up is we want to threshold out.

  • We want to simplify this picture.

  • Whole bunch.

  • Um, well, basically changed in tow, straight, black and white.

  • Um, and that's to make our job a lot easier later on to do this.

  • This is called threshold ing.

  • Ultimately, what I'm doing here is I'm converting every RGB value into a gray.

  • And if that gray is over below a certain value, either side of the white 55 or black zero, um, itself it changed this slider.

  • You can kind of see how it affects the image.

  • Um, and then on entertaining thing.

  • That note here is that you'll notice that this is not a 10 year transform from RGB gray.

  • Um, and that really quickly is if you look at these green and blue values here.

  • So this is actually the same amount of green and blue light hitting your eye, but because of how your retinas all jacked up, um, you perceive the green a lot more than the blue.

  • Um, And so you think green is a lot lighter than blue?

  • And so that's take into account with this formula here.

  • Um, all right, so we have a black and white image.

  • Now we want to find those cards again.

  • Um, to do that, we go to N.

  • P.

  • M.

  • And just find some random package that finds finds, But what this package does it It's called Maur Neighborhood tracing.

  • Which sounds scary because it has a name on the front of it.

  • Um, use neighborhood in the context that makes no sense whatsoever.

  • Um, but you can think of this as, say, you're an ant.

  • Um, and you really like black pixels and your exploratory ants.

  • So you just out for a walk and your baby methodical.

  • So you just scanning through all of this black.

  • Um, And then you also hit this white picks on you.

  • Well, what is this?

  • This is new.

  • Uh, let's figure this thing out.

  • So you kind of back up, you go to the side.

  • You kind of headed again.

  • What picks a look at you back up.

  • You decide.

  • You do that a whole bunch until you're kind of like making a way around this whole thing until you're all the way back to the beginning again.

  • Um and so if you've paid attention like late doubles down, used, basically made and trace the path around this card, Um, so that's more neighborhood chasing.

  • Um, you'll notice that I then so I take the threshold image running through that I get a bunch of contours.

  • Um, and then I end up filtering based on area here.

  • Um, and so if I kind of change some of these values, which now you'll notice that I'm twiddling values, a lot of these values have to do with, um, the source image.

  • So I'm kind of like picking numbers out of the air based on kind of the parameters of what I'm assuming that's gonna be important later on.

  • Um, so here I've, like, made the area threshold go away, lowers basically put out smaller shapes, but I actually don't want those.

  • So go back to here and only get 12 of them.

  • Um, some Bactine marginal 12 cards and see where we we went to.

  • Now pull out each card to do this, we need to simplify that path a little further.

  • Um, instead of that path is like a whole bunch of dots around that card.

  • Ultimately, what I want is this rectangle ish thing are quadrilateral that consists of only four verte sees to do that.

  • Um, there's probably a cool name for this thing, but I made up some ran the way to do this.

  • Um, what I end up doing is basically removing pixels.

  • So I want to remove her done pixels a longer line.

  • Um, and so I just keep removing them until it down before the way I choose which pixel to remove Next is basically the one that result in the minimum least area change which result in a pretty good rectangle this point.

  • Um, Now I want to pull out every card.

  • So this is now where I'm going from here to here.

  • Um, so this is called perspective transform, which again?

  • Go to N P.

  • M.

  • You just search for a perfect chance for you get this thing.

  • Um, this is basically linear algebra.

  • I'm not playing this one, but then your algebra matrix math you can pull out, transformed from a perspective in tow.

  • This perspective.

  • All right, we got every card.

  • That's kind of, um oh, so we need to correct for the lighting in the room.

  • Basically, you'll notice here that this is I took this in like a yellowish little room.

  • Sometimes you get warm lighting.

  • Sometimes you get cool lighting.

  • Ultimately, one kind of correct for that.

  • So we want the back of the cards that basically be as like to 55 to 5 to five white.

  • Um, to do that, we can assume that our white point.

  • So we need a white point.

  • We can assume that the background on the card is white.

  • Um, and so what I've done is just average the top and bottom borders of every card.

  • Um, and call it that my white point on.

  • And then using that, I can shift every pixel in the image in RGB space, uh, into basically where the backgrounds of averaging out to be more white than the rest of the card and all the, um, all of the other colors in the slightly frightening Also, which is actually good.

  • Okay, so recapping where we are, we got our image.

  • We identified some cards we extract with cards, and now we want to go for all of the colors and all the things in them.

  • So here we have the spectrum of the record.

  • So I've gone through and basically just grabbed every pixel, mapped it to a que, um and then throwing out all the white.

  • So you can tell this is actually pretty pretty indicative of kind of all the cards I ran through.

  • It's pretty easy to tell that there's purple card, a red card, a green card.

  • This weird one here is kind of interesting.

  • So that one was actually this, uh, one here.

  • We can see some rain building going on here, which is still fine.

  • Um, there's a lot of strong signal here.

  • Still in the purple, so really fine.

  • Um, next one is number.

  • So for number again, I just throw contouring out again for each card.

  • I run through the contra finder.

  • Um, and I get contours, and I end up looking at the percentage area or sorry, the percentage width of the contours versus the entire card.

  • Um, so if there's one shape on there, it'll end up around 25%.

  • When there's two, it's around like 55%.

  • And when there's three, it's around 85% on.

  • Go ahead.

  • Correct.

  • For this kind of case, where Mr Khan tour by just using this and nearing and over here and assuming that deducing basically that this is going to be three.

  • Um, okay, I've got two things down.

  • Next one's shading for shading.

  • We want to grab basically the inner core of every contour on and look at its average luminosity eso to grab its inner core.

  • You end up taking a bounding box of the entire contour cutting that down to like, 3/4 of the size of the thing, Um, and then averaging pixels again inside of that internal bucks to give you basically So for an outline, you end up with White pretty much everything.

  • About 55 for striped.

  • You end up with somewhere between 2 32 40 and then four solid.

  • You end up with everything below, like 1 80 Um, again, you'll notice that like, I'm I'm kind of like hard coating these values.

  • And at some point, um, shape is a little bit more complicated, so shape we can kind of do the same thing.

  • Take that banning box and look at the percentage area of the contour where versus the, um, shape.

  • And then we get this.

  • So diamond is actually a lot of doesn't take up a lot of the area.

  • Um, squiggle takes a blow, but Maurin overtakes the most.

  • Uh, this that was getting a little close for me.

  • So, like this difference between oval and squiggles iffy.

  • So I decided to throw in yet another, um, dimension here.

  • So this is a convex whole.

  • Um, so this is this chart down here is the same as a stop one, but I've added a wide dimension.

  • Eso it pulls out some of these values contacts.

  • All you can think of is like basically taking some saran wrap and wrapping these shapes, um, in saran wrap.

  • And so that's the shape you get for Overland Diamond.

  • You end up with basically no change in the convex hole on that first global you and more so it pulls it out a little better and makes the convocation a lot easier.

  • Um, finally were down to, like, the boot floor step finding, Um, here is where the computer actually has a structure information in order to go ahead and look for all the sets.

  • When you do the math, it's 12 cards, three cards for set.

  • That's only 220 possible sets, which is absolutely nothing to a computer.

  • It crunch.

  • It crushes this and 20 microseconds.

  • Um, checking all of those two aren't any possible sets for, um for sets toe kind of put this more introspective when you think of sets for a minute.

  • I'm at, like one cent per minute.

  • Susan's good.

  • She's at, like, 20 cents per minute and the computers at 300,000 sets for a minute, so it's got a beat there by far.

  • Um, so then knowing the sets, you draw them back on the service image and got this cool looking thing here.

  • Um, So how does this play out?

  • How did I D'oh.

  • So it's gonna give it away, But this is playing again against Susan, um, with my first builder.

  • So, um, you know, I'm not doing so well.

  • Still, actually, there's no set their own.

  • Never mind.

  • There's one.

  • She took it.

  • Well, I got one.

  • Uh, that's way better than I was doing before.

  • Um, and it was basically, uh, pretty even match, actually.

  • Basically, when Susan slow, I can get a set.

  • Um, if she's fast, then I still lose.

  • Um, and that was actually do dio due to Where's my slighty?

  • No.

  • How do I get out this way?

  • Um, so we lost in this example.

  • Still, it was very sad.

  • So what happens is that, like, we trained this thing on basically one or two or three source images.

  • Um, which is exactly the problem of over fitting.

  • So I basically built the model based on, like, a couple source images.

  • Didn't take into account a whole lot different lighting that I might come into, um, contact with shadows, lots of other different things.

  • Um, and so the way that fixed this is basically you get a lot of source images.

  • Um, So I went back, and I built into my thing wayto quickly grab a lot of images on and then attack them.

  • Um, and then based on that, I can actually, um, fine stuff.

  • Or so I can train this a little better.

  • So it's basically taking all of those all those images and using those who inform all those magic numbers which I call poor man's machine learning, which is exactly, actually machine learning s o.

  • Don't let anyone tell you otherwise.

  • It's basically machine learning's doing.

  • Um, So I put together a training montage, plays it's on YouTube.

  • No, it does.

  • Okay.

  • Hello.

  • I need sound.

  • I'm gonna do this live start over cause I got time.

  • That's right.

  • Changeable passion.

  • Wait, wait, wait.

  • I tithe.

  • And the last built five stocks all right.

  • Oh, I went full screen.

  • No full screen.

  • Although all we're doing is a live demo.

  • Next.

  • I did, um, So Okay, I did.

  • I get.

  • So I have a plant in the audience and everyone welcome an and get A dealer is miles around or anybody who wants to deal deal some cards.

  • What software update to my phone.

  • Try install this.

  • Wait.

  • Uh, I guess quit iTunes that decided to open on me.

  • Oh, look at some random images.

  • It's good.

  • So anyone wants to cheat against their friends, go to set that business dot com.

  • Um, and that is my screen.

  • All right.

  • All right.

  • Um no dealer, huh?

  • We need a dealer.

  • Dealer would be great.

  • You Oh, Billy.

  • Hi, Billy.

  • I work with Billy.

  • Um, can you 3 12?

  • So, um well, I have a chance of losing easily, because lighting up here is interesting.

  • I tried this earlier, and I think I was okay.

  • But also an is pretty good this game.

  • And so we'll see.

  • We'll see.

  • How this girls are you ready?

  • Where you go?

  • Oh, I'm seating.

  • I can take it because I'm a cheater.

  • Oh, no.

  • These cards are weird.

  • Fix up, Justin.

  • Threshold ing.

  • Is there anything here?

  • Maybe that's not one of the false Positive.

  • Yeah.

  • Thes cards too close to each other.

  • Wait, no, there's a set.

  • What?

  • Yeah, This is where he would still have a chance Because computers can't see.

  • That's it.

  • I think the pressure's getting the end.

  • The stage pressure.

  • There's a TV set.

  • You go.

  • Whoa!

  • That was a harder set.

  • Um, yet set.

  • Okay, I think we get the idea, because this is gonna take a while to go through, but there's another set right there that and got, um All right, I'm gonna declare that a victory.

  • Thank you again.

  • So great.

  • We built some networks.

  • Um, actually prepared for both version of this, but with one.

  • So that's good, um, is a video just in case of showing that I also beat Susan.

  • So I completed my accomplishment.

  • So the remaining things actually through here, So I did all of this in CPU on the browser.

  • Um, there's you could do all this and Web deal would be a lot of fun.

  • Totally bent itself.

  • Dictators in jail.

  • So?

  • So, given that I have this, like training set.

  • Now I can actually throw this attempted flow, which would also be a whole lot of fun.

  • Um, the other things I want to highlight really quickly.

  • Our other versions of things that have kind of built actually did not build meeting snowflake thing.

  • But, uh, so this is actually a totally different game.

  • This is like a crazy game where you have crazy dice figures.

  • Um, and you kind of build your character up over time.

  • One thing about building your character's gonna have these, like, item buys.

  • And you're trying to figure out what your these is better than D'oh.

  • 44 this 11.

  • They use random dice, they look the same s.

  • So I decided I'm gonna boot for this.

  • This too.

  • So I'm gonna run simulations against all of this on these air damage curves for each of these weapons, a different distances.

  • Another example that I want to highlight his actor's tool called a medium or a cold called snowflake from medium.

  • Um, so this is actually a visualization of the engineering ladder?

  • Um, this is a little bit do, sir, as far as like, actual tools to hack your life with but two means is a tool that you can use toe pack your career with, um, so you can kind of see where you sit on their ladder for here.

  • Seriously is really good at project management and initiative and accomplishment.

  • Um, but she is very low on the community scale.

  • Stop killing people and blowing them up.

  • Um, but she can, like, have a one on one with her manager, which I don't think she has a manager.

  • Um, and they can talk about how, you know, she could probably target just doing this easy 01 on well being and, like, 01 community.

  • And she's actually gone up a level.

  • Um, so this is just the tool that I feel like you can You can basically very quickly figure out.

  • Like if you've ever had a woman with her manager and you're trying to figure out, Like what?

  • What's the next best thing for me to work on?

  • What would happen if I, like, just got really good at some of these other things?

  • Where would that put me?

  • Um, this answers it for you.

  • Um, so yeah.

  • So, again, why?

  • I again love cheating and mischief in just solving problems in ways that shouldn't be solved.

  • Um, and I feel like it leads to basic innovation, so that's kind of why I hope I've inspired you to actually build something, um, and kind of show now, like, I've never done computer vision things before this, Uh, this is my first pass at it.

  • Um, so I hope you can do that, too.

  • Um, and then ultimately, all of these slides are on this website.

  • Observable H Q isn't a cheat.

  • Um, let me visit up on there's actually block post content inside of this.

  • So if you share it, then it should make sense to all your friends do.

  • Thank you.

Um hello.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

JS・CV・ARで人生をごまかす方法 - Visnu Pitiyanuvath|JSConf Hawaii 2019 (How to Cheat at Life with JS, CV, and AR - Visnu Pitiyanuvath | JSConf Hawaii 2019)

  • 1 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語