字幕列表 影片播放 列印英文字幕 what's going on already? We're gonna part eight of the unconventional neural network. Siri's in this part. I'm just going to be running through the code that I've used to create frame by frame. Ah, the frames of a deep dream. So with that, let's go. Hang it started. I'm going to just take the code from the tax base version the right up. Really? None of this code, I think, is necessary for us to be writing it out. Um, so I'm not gonna do that. Also, I think there's a lot of improvements that could be made. So which I'll be asking you for momentarily. So actually gonna make a new file? I'm gonna call it dream on dot Tie. Yes, sir. And it was sublime when it closed. Oh, this is still running. Let's see. How do I stop this thing from running? Cancel Bill. Good day. You just close it. I just want that to go away for now, okay? And then I'm going to copy in Paste from my sample code, my code. And then I think I'll just kind of run through it real quickly. Like I said, this pretty rudimentary python. So there's really no reason. Thio make you guys write this one out. So basically we're Yeah, we're importing things just like we did. Before we grab. We're just gonna specify which layer we wanna work with. We're gonna call it something because yeah, here. Basically, the dream goes into this dream directory. And then, um at least in dreams start I've kind of named everything and should be good to go, uh, and then in there is a limit zero. Now, if you're gonna work on your own dream, which again I highly recommend you do it just makes it more interesting. Just go into the dream directory, make a new one, call it whatever the heck you want and then inside it put your image which should be a J peg and then just call it image Underscore zero. And in my case, this image is Ah 4:50 a.m. Sorry. 800 wide by 4 50 Tall image. Just take note of whatever size image you have of the larger the image you have, the longer is going to take to process. But the cooler it is when it's actually done. So ah, come back over to dream on, actually, just writing here. We can see some of my lawfully lovely code, basically right away. I just specify the size I'm There's plenty of functions you could write to get the image size. I'm just gonna write the fricking numbers there, but you could dynamically grab the sizes. Then what this does is just kind of tracks how far we are. So if you let the dream go on and on and on and on eventually it usually gets too bright or too dark or something goes wrong. So usually kind of want to check on it after so many frames. You don't have to. Um I've easily gone thousands of frames without needing to mess with anything. It just really kind of depends on on you and what your dream kind of randomly does. Um, so you feel free to set this tow, whatever you want, and then this is just a four loop. Um, I just want to grab an eye from it. So this is the way I've done it. I'm sure there's a better way. Uh, just what I kind of hacked together because I just really wanted to see the results. So basically all it's gonna do is it's going to go into the dream directory and then it basically just looks and says, OK, in this dream directory, how many images do we have always trying to do is figure out what was the latest image, and that's the image we're gonna dream upon Dream upon and man lately, I can't talk anyway, That's the dream image that we're going to start with, and we're gonna let it dream on. So lovely planes going over the house. Uh, so it'll just keep going through I until we figure out what the latest I could be. And then we're gonna load in that image, and then we're going to specify a trim to that image. Now, one thing I do not like about how I'm doing this right now is if you'll give me a moment, let me pull up. Uh, the other one. It's the one I've been working on so far. It starts with story night, but as you can see it, actually, when it starts to zoom in, it's actually zooming in right to this point. But really like a center zoom. I'd like to be able to do that The other thing I noticed is like it stretches out everything except for around this point. So it's not quite what I was hoping for. Um, so hopefully someone can come up with a better zoom function. I just wanted to do something to keep things moving, moving along something exit that will show the full one price somewhere towards the end. Earl just uploaded or something is this one's a pretty cool one, going very specifically through the layers at a time. So anyways, that's how much I want to trim by. Uh then basically, what we do is we trim each size, I believe. Let me just make sure I've done that, minus the white trim all the way to something My eyes. So somewhere in there, my logic is wrong. I just like I'd like to zoom into the center. Someone don't figure that out. Text as you. You probably noticed, um, the When you deep dream on an image, For whatever reason, it's somewhere in that deep dream code, probably. Ah, the image gets a little darker, just a little bit darker, probably because we are clipping so like, if maybe we did some sort of I don't know how you do it better, but it does seem to get a little darker. So each time here we modify the are the G B. You can just add a couple thio, each one all all of them use at a little bit more. So this would make the image get overall a little brighter. You could also, alternatively add like look, if you wanted the image to turn more red over time, you could do something like this that would produce a lot of red's. Ah, if you really like the color purple, you could do reds and blues together. You get more purples, probably, um, stuff like that. So you kind of have to find the sweet spot there. I'm gonna leave it where it is for now. Um, then, uh, you do pretty much all the things that you've already seen before, like none of this is anything different, Which is why I didn't want to write it up. Um, yeah, The main thing here to keep in mind is at least when you first start number of iterations shouldn't be 15 and price should be one. Honestly, as you get further into the the new design, you might want to do more iterations, but to start for the first few frames, you keep it low. 123 Something like that number of repeats should always be one you can. Basically, each frame is a repeat, so there's no need for you to be doing many repeats because, like I said, yeah, each frame is Theo. Effect is effectively a repeat. So, uh, everything was good. We're on layers three. So I think we're good enough to we Could pride generate at least a few images here? I'm gonna keep no mid orations to three. Uh, I think we're good. Let's rumble. Let's just run this thing. Um, I have no idea. Actually, I should have checked the last video How the video did when I ran Deep Dream and was recording. I have no idea if it's screwed me up or not. Hopefully not I'll find out. So as that runs in his process, processing the image we can start to see. Results are already coming in as you get deeper as you change. Um, the number of iterations you're gonna it's gonna take much, much longer than this. And if you use a bigger image. It's gonna take much, much longer. But what we can do is we can begin to zoom in. And as you can already see the images kind of changing and really quickly. Actually, we can see the squares are forming, so that's pretty cool. So let me see how for lease on Windows you're on Lennox, you think you can actually just keep going, but as you can see, So this is one way we can very slowly begin to morph this image into, um into whatever we're trying to dream about. So after you've gotten this far, you know you can probably just okay, let's make the federation's I don't know. You could just keep doubling it up. I would just keep going until about 20. But all of this stuff you really could, um, you really could write the program to handle for you, including, like brightness, random color changes, the layer changes, all the stuff you could write a program to just automatically do for you. But I kind of find it. It's kind of fun. Thio manually mold the model, but by all means, you can definitely control over all brightness and all that stuff and just kind of let a model run for a long time. But everything is so slow to make a real true dream. Like the 10 80 p dream that I've been working on. Um, that's been taken like days and days and days has just been running and running running, so it just takes a long, long time. Now, with the images of small is the ones that we've been working with it wouldn't take necessarily is long. But anyway, as you can see, that's just a good way to make a nice, smooth transition from the image into, um, into our little squares. Basically, um, so that's how you can make frames. Now, in the next tutorial, I will show you all how you can go from frames to an actual video. Um, obviously, there's a ton of different ways that you can do it. We're going to be using Python to do it, but there's like a 1,000,000 ways you could take frames and convert to video. So anyways, ah, that's we're gonna do in the next one, and then I'll show you, at least in part. Well, I've already showed a little bit of it. But I'll show you the rest of it, probably in the room with me, even at the rest of it. I don't know. It's kind of a long anyways. Um, I'll show you at least how to make videos in next tutorial questions, comments, concerns, whatever. Feel free to leave in below, uh, otherwise see you in the next video.