Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

Transcript #105: Colorizing and Restoring Old Images with Deep Learning

Return to episode page view on github
Recorded on Wednesday, Nov 21, 2018.

00:00 KENNEDY: Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is Episode 105, recorded November 21st on Turkey Eve. And I'm Michael Kennedy.

00:13 OKKEN: And I'm Brian Okken.

00:14 KENNEDY: Hey, Brian, are you ready for Turkey Eve?

00:15 OKKEN: No, not at all. Are you?

00:18 KENNEDY: I'm getting there, I'm getting there, I just picked up a whole bunch of stuff, we're going to cook a turkey and it's going to be crazy. So yeah, yeah.

00:24 OKKEN: We bought a smoked turkey. So it's already, all the work's done.

00:28 KENNEDY: Yeah, that's the way to do it, just save yourself the trouble. I don't know how many people out there listening who don't go through this Thanksgiving thing actually cook turkeys, but it's kind of stressful and it takes forever, it's like many hours.

00:39 OKKEN: Yeah, and then for some reason, everybody wants to eat like dinner at two o'clock in the afternoon or something weird like that.

00:46 KENNEDY: Yeah, well, they've probably been drinking since 10, so you know, that's why. All right, so for those of you who celebrate Thanksgiving, Happy Thanksgiving, for those of you who don't, happy email Black Friday spam week, and hopefully, you got some deals.

01:01 OKKEN: Yes.

01:02 KENNEDY: So thinking of crazy things, it's pretty awesome that DigitalOcean is giving people $100 credit for creating an account over at Tell you more about that later. You know, one thing I like about Thanksgiving is it lets you sort of look back on history and like think about your family and like, kind of just older stuff, right?

01:22 OKKEN: Yeah, it does, it's nice, and maybe look at some old pictures.

01:25 KENNEDY: Yeah, like, but sometimes, it would be great if they weren't like, you know, old and black and white and boring and crummy.

01:31 OKKEN: Definitely. There is a project, and it's Python-based and machine learning, called DeOldify.

01:37 KENNEDY: DeOldify, the name says it all.

01:39 OKKEN: Yeah, it would be actually a great name for a health club too, I think. What it is is, I can only sort of describe it, what it does is it takes a black and white photo and makes it look awesome and like, does a whole bunch of cleanup of sharpening and then colorizing it. You kind of have to look at these pictures, they're kind of amazing. One of the things I like about actual old pictures, when they started to put, take color photos and do colorizing, there's a lot of color, it wasn't muted. Whereas a lot of the, some of the colorizing algorithms that are out are kind of just can default to obvious things, like grass is green, and make everything kind of brownish and stuff, and it just make it a little bit better than black and white, but not really. But these really pop, like adding purple and greens and reds and all sorts of awesome things.

02:32 KENNEDY: These are glorious, like the old soda shop one. It's just so amazing, do you know how it gets the color right? Like, why does it not make people, you know, purple or something?

02:41 OKKEN: Well, I mean, things like people are sort of an easy thing because they're going to be kind of people colored. If we get too far into the how it works, I really can't tell you.

02:53 KENNEDY: Well, it does use deep learning, which means like, if you get too deep down, then nobody knows how it works in some sense, right, like you've taught it, sort of, by example.

03:02 OKKEN: Yeah, yeah. It's definitely based on self-attenuation generative adversarial networks and progressively growing GANs with a two time-scale update rule and generator loss in two parts. I have no idea what those words mean, but that's part of it.

03:19 KENNEDY: I think it's really cool project. I mean, you know what would be like a great Christmas gift or something, would be to like get a hold of some old photos, do this against them, and then take them and like turn that into a photo book for like your grandparents or something, wouldn't that be awesome?

03:34 OKKEN: Yeah, it would be. And I'm actually, I can't wait to try playing with this. What I'm going to linked in the show notes of this is an interview with, it's a text-based interview with Jason Antic, the developer of DeOldify, talking about why he developed it and how he developed it. And it's kind of a really fun article, so if you're curious about this, either just play with it and try it, or you know, read the article.

03:58 KENNEDY: I really like these visual things, I think it very clearly highlights like how amazing just this whole deep learning and machine learning thing is, you know.

04:05 OKKEN: Yeah, and this is sort of a fun application of it that I would've never thought we could make our lives better by making these photos better. I mean, I wouldn't have thought machine learning would be for that, but it's cool.

04:17 KENNEDY: Yeah, it's very cool. So remember last time how you said Brett Cannon was going to be mad at me? Well, Brett Cannon will probably be happy 'cause I got a lot of items on VS Code this week and they're pretty awesome. So I didn't do it to make up for it, but I'm happy to feature them. So this first one has to do with IoT. And I think IoT is one of these amazing things that often is like below the surface, right. Like when smartphones came out, it was so amazing, everybody saw it and they're like, show me that thing that's incredible. But you know, the fact that, I don't know, your refrigerator is slightly smarter or your microwave or your doorbell, I think it's less obvious. But there's tons of IoT stuff out there, and the ability to do it in Python these days is great, right?

05:04 OKKEN: Yeah, and it's amazing how the IoT everywhere is sort of just make, it's no big deal anymore so fast.

05:11 KENNEDY: Yeah, and the price is coming down, the energy consumption is coming down, it's great. So the thing that I want to tell folks about is something that Jason Pecor told us about called PlatformIO IDE for VS Code. So PlatformIO is this like platform for interacting with all sorts of IoT and small device type of programming examples, and it has tons of languages. And what they've done is they've built in a debugging, their framework, all that stuff, into Visual Studio Code.

05:42 OKKEN: Oh, that's cool.

05:43 KENNEDY: What's cool is 'cause it's Visual Studio Code, it has like all sorts of mixed mode understanding, so if you're doing C++, embedded C++, great. If you're doing Python, great. All right, it knows about all these things. So super cool, it has cross-platform, of course, 'cause it's just VS Code, basically. Built-in debugger, check this out, remote unit testing on your device, that's pretty sweet. Firmware updates, all that sort of stuff.

06:06 OKKEN: Yeah, neat.

06:07 KENNEDY: Yeah, so if you're working on like Arduinos or something like that, it's sort of comparable to the Arduino IDE, which I haven't actually used very much. But it's sort of that kind of thing. Now, there's a few features, I think like firmware updates and a few other things are paid, but it's like nine dollars a month. But there's also a free version, so it's a little bit like PyCharm in that sense, like there's a paid edition and a free community edition. So it's pretty cool. The PlatformIO core itself is written in Python, which is awesome. But it's written in legacy Python, boo, hiss hiss, but... That's okay. And then finally, Jason put together a video of when he, sort of an unboxing of the IDE but it's digital, so you don't really take it out of anything, but when he first sort of test drove it.

06:51 OKKEN: Oh, that's neat.

06:52 KENNEDY: Going through it, so it's like a 15 minute video. So if you really are interested in doing this and seeing how it works, you can check out Jason's video which I also link there.

06:59 OKKEN: Nice, cool.

07:00 KENNEDY: Yeah. So IoT, definitely one cool option here. You might be collecting a lot of data on those IoT devices, right, you could have them all like grabbing data from all over the world every five seconds, streaming it back, dropping it somewhere, you want to look at it, right?

07:13 OKKEN: Yeah, and you might want to make that into like some visualization. And there's a lot of options, so I actually, I'm in the middle of this problem right now with a work project of trying to decide which visualization libraries to use on a particular problem.

07:30 KENNEDY: Oh, let's draw a graph, oh wait, there's 300 ways to do that, why is it so...

07:34 OKKEN: Yeah, there's an article, it's on the Anaconda blog, called the Python Data Visualization 2018: Why So Many Libraries? It talks about, you know, how like there's, some of them are, there's Matplotlib, of course, and there's a whole bunch of others that are based on Matplotlib. And then whether or not you use JavaScript and then, you know, if you use JSON or something else, and then there's WebGL and anyway, this, it's a nice breakdown of the different tools and how kind of the data, like, what the, behind it, like what data and stuff they're using. And then also, what you can do with them, what plot types you can do and generally if you're, like if you're using, for instance, geographical data, then you probably maybe should look at Matplotlib with Cartopy or a few others. They've got some examples and they bucket them together, so it's less of a search, you don't have to look at everything to see if you should look at it. And also kind of what your data size is. And I very much appreciated this to kind of narrow things down.

08:42 KENNEDY: Yeah, it's really cool. And there is a great visualization as well from Jake VanderPlas which, it's kind of like a mind map of related linked together different visualization libraries, so it has like well, here's D3 as one of the major hubs, and then you've got Matplotlib. And maybe from Matplotlib, you might want to use Scikit-plot which is derived, you know, based on that. Or if you're using D3, you might use, I don't know, D3PO or whatever, like one of these other things. But it also says well, you can combine Matplotlib and D3JS and get mpld Matplot something three, like a combination, mpld3 I guess, I don't know. But the relationships, so maybe oh, if I'm using this, there's this other library that also has some other features I can combine, I think it's cool.

09:28 OKKEN: Yeah, they're all kind of interrelate. And then I wanted to point out that there's, sometimes you're just like, I just want something simple. I really was looking for this example about a year ago and I wish I would've found it, but there's an example I'm going to link to that's just a really short article and then a link to a gist, which is just a single file containing Flask application that both generates and displays a couple Matplotlib charts. So Matplotlib might be the simplest thing, but it isn't obvious right off the bat how do you, in code, how do you generate one of these things and then link to it in a webpage and all that sort of stuff. So this is nice.

10:10 KENNEDY: Nice, nice. I don't have a reason to draw a graph too much, but I'm starting to think maybe some BI type stuff might be in my future, that would be interesting to learn and I'll definitely have to come back to this to figure out how to look at it. Cool. So before we get on to the next one, which will also make Brett Cannon happy, I think, is I want to tell you quickly about DigitalOcean. So DigitalOcean, great hosting provider, super affordable, really rock solid. And one of the things that's cool that they do is they've created this idea of projects. Because often, you go into like your cloud provider and you've got like these testing servers and all these other, just like all this stuff, you know like, well, what goes with what? Is this thing, can I turn this server off, is it being used, right? What group is it related with? So they have this idea of projects, and you can group your droplets, which are VMs, and load balancers and domains and IPs and all that into these different projects so you can treat them individually as like all of this infrastructure goes with this site and that infrastructure goes with that site and stuff like that. So very cool, you should check out what they got going on over there at And like I said, you'll get $100 free credit if you create a new account there. So very nice stuff, now, speaking of the cloud and speaking of Visual Studio Code, I want to tell you all about So is a thing I recently learned about, they reached out to me for some stuff on Talk Python. And after playing with it, it is pretty cool. So you know how VS Code is an Electron JS app, right? Okay, so in Electron JS, there's kind of a hidden Chrome, the thing that you see as a window, that's really Chrome, just like a headless Chrome type of thing running some kind of HTML there. And then it talks to Node.js over like a local transport of some sort. What if you could separate those? What if the Node.js backend lived in like a server that was really awesome, and then you could just put the frontend anywhere, like a website?

12:03 OKKEN: That's kind of how it's designed to work, so it should.

12:06 KENNEDY: Yeah. It seems possible, right, so basically, that's like So it's full Visual Studio Code, but in your browser on awesome hardware. So you can write code in your browser. And it's, because it's full Visual Studio Code, you get like all the 4000 extensions, all the different languages. And it's not some like cheapo imitation sort of sometimes auto-complete works IDE in a cloud, it's like literally just Visual Studio but working in your browser. So it's really, you know, once you fire it up and you get going, it's like, within a few minutes, you're like oh wait, that's not the regular top bar from my app, that's a browser window. But you would just kind of forget. And it has some other features, so like, it runs, every time you create a project, your project lives in a Docker container and you get root access to install and configure that Linux Docker machine however you want. So you can do basically whatever you want in the cloud on this thing, and there's like a paid feature, you can push a button and it will give you up to 96 cores of computational power. You get like a certain amount free, like five hours, but after that, it's a paid feature. But still, it's pretty awesome, so if you want to work on Linux and you're on, say, Windows and you need like hardcore Linux, not just a VM, but something that's really running solid, you can use this. If you're on a Chromebook or you're on a tablet, right, this will be awesome, all sorts of stuff. Another thing that's really cool is it has Google Docs like collaboration. So multiple people can be working on the same file at the same time.

13:32 OKKEN: Oh, that's neat.

13:32 KENNEDY: Yeah, it's pretty awesome. So anyway, I wanted to tell people about it, they just launched a few weeks ago, and I think it's pretty awesome, they have really good Python support. You can obviously pip install all the stuff you need 'cause you just open the terminal and you have root access, so do what you like to it.

13:47 OKKEN: It looks like it has a whole bunch of plugins available too, it isn't just bare VS Code.

13:52 KENNEDY: Yeah, I know, it's super cool, that thing. So quite the neat project. Now, just for transparency, they did sponsor Talk Python To Me, but this is not an ad, this is just like I learned about it because of that and I'm like oh, this is pretty cool, I'll tell people about it here. So anyway, something worth checking out, and the free option is pretty cool, you get like three gigs of disk space, one gig of RAM for free forever, pretty much. So it's pretty cool.

14:17 OKKEN: That's generous.

14:18 KENNEDY: Yeah, yeah, not bad. What's your next one?

14:20 OKKEN: This one, it just popped up on my news feed, I think it was this morning. This is a Forbes article about Guido and trying to bring more women into the Python community. Some of this stuff I didn't, I knew some of these things were happening, but I didn't know some of the impetus and the, I mean, I was glad but I didn't really understand why. But apparently, in 2015, somebody just mentioned to him like weird, there's no women in the Core, in Python Core, why? And you know, he talks about a lot of projects having that problem or at least situation where there's not a lot of women contributing, and you kind of have to examine why that's going on. And so he took on putting out an offer saying that he would mentor women to try to, that wanted to become Core developers. And of course, we know Mariatta was the first. And that's awesome, and now there's four altogether which, and he just wants that to keep growing. And it's also kind of a nice talk, it's an interview that happened after he stepped down saying that he's definitely going to be, stay involved with Python, it's just he doesn't want to be part of all the everyday fighting and stuff.

15:42 KENNEDY: Right.

15:43 OKKEN: And just, I kind of read this also and I was thinking about, there was a comment than Python was worse than the average just commercial engineering team. That is troublesome, but I think a lot of, even depending on what kind of field you're in, this might still be a problem, and I think people need to examine their own hiring processes and how you get people involved in your project and whether it's open source or whether it's commercial, and take a look about really, one of the comments was some teams will say there's no women in the core because nobody's been interested, nobody's asked. But that's probably a little insincere if you take a look about how the commit bit happens, it's often kind of a nebulous fuzzy we trust this person sort of a thing. And a lot of hiring is that way too, and the argument of that a lot of hiring people say is well, I would hire a woman or somebody, other underrepresented group, but nobody applied. And I think that's just kind of BS, you have to go out of your way to try to find a larger pool, and so this is just a good reminder.

16:52 KENNEDY: Yeah, it's a great reminder, and Guido did super important work there. I've said it before, but I think, I've been at different types of programming conferences. And coming to a Python conference is a much better experience in feeling like this group of people represents the general population of the world compared to other ones where, you know, not so much or not at all, basically. So I think that's a really positive aspect of what's happening for the community and it's great that Forbes, I mean, Forbes, that's a huge place to cover this, so that's pretty awesome. On your hiring thought. A lot of jobs, I think, get filled by first asking all the team members who work there who do you know and who's awesome, who should we hire? And when that process fails, then it's like fine, we'll put like a general, put a general job offer out there that everybody might get. But I can certainly see how that would create reinforcing groups, because the team that you have would know people most likely like them, right?

17:55 OKKEN: Yeah, and also, some of it's the crucible process of the hiring process as well, even if you have people that are decent candidates, I don't remember where I have this reference from, but I've heard a comment that more frequently, a male will apply for a job where he meets at least two of the qualifications. But more likely, a woman will only apply for jobs where she meets all of the qualifications. And there's a difference right there, so you have to, it has to start from the very beginning of be very careful what you put in your required qualifications because you will eliminate a bunch of people.

18:35 KENNEDY: Yeah, I think that's really interesting. I speak to my wife about this sometimes and she's like, well, guys will just say they'll just, they can do this thing or whatever and they can't, they don't have all the experience or everything that they need, and they'll just do it and then they'll get the job, and women don't. And I don't know, she wasn't really saying that was unfair, she was just saying...

18:51 OKKEN: It is the way it is so you have to be aware of it.

18:53 KENNEDY: It is the way it is, but I mean, on one hand, let's put this out here as an encouragement to women to say look...

18:59 OKKEN: It's not merely requirements, it's a wishlist.

19:01 KENNEDY: Yes, and if you have most of, it's a wishlist, and if you have most of the things or the important ones even, just apply, right, I mean, there's so many opportunities for JIT learning, just in time learning, like if you know three out of the six things, but you could take some online classes or something or read a book on the others, like just apply.

19:20 OKKEN: Yeah. The other end of it is often part of the hiring process isn't really on qualifications, it's on fit, do they seem like they already fit into the team? And you have to really be careful with that because you might end up with a whole bunch of people that are kind of the same.

19:36 KENNEDY: Yeah, I think that one's trickier, it needs attention. Okay. So the last one that I want to cover is from a very inspirational woman named Anna-Lena Popkes. And I had her back on Talk Python just last week, actually.

19:50 OKKEN: It was an incredible interview too, loved it.

19:53 KENNEDY: Yeah, thank you, she was such a great guest and so many people wrote to me and said wow, she was really inspirational. And I think she was, and one of the things that was inspirational was not long ago, she had no programming skills, and then she decided to go to a computer science master's program in machine learning, and now she's working at Microsoft's AI residency program in just a few short years, which is incredible. And the thing that I want to tell people about is directly from that whole path. So she put together a GitHub repository of IPython Notebooks, Jupyter Notebooks that are basically explorations to understand the core algorithms of machine learning.

20:31 OKKEN: Nice.

20:32 KENNEDY: Yean, not I want to create, you know, import scikit-learn and feed this function a few things, but with no dependencies, how do we build up these algorithms and what does that look like.

20:42 OKKEN: Cool.

20:43 KENNEDY: So if you're out there and you are doing data science or wanting to get into data science, she has a bunch of really nice notebooks that you can check out, I'll link to most of them here. And this is built in modern Python, so hooray for that. Anyway. She built this for herself to learn these algorithms as she did this sort of career progression, and maybe, you know, throwing it out there is going to help a lot of people. It already has like 2500 GitHub stars, so I guess it will be.

21:09 OKKEN: Plus it has a perceptron. I don't even know what a perceptron is, but that's a really cool word.

21:13 KENNEDY: I know, it's like a psychic power used by the machine learning algorithm. No, I have no idea what it is either, but it sounds awesome.

21:21 OKKEN: I'm sure there's data science people rolling their eyes at us for not knowing this stuff.

21:25 KENNEDY: I'm sure. Yeah, I was going to make a good joke about another algorithm to follow up on that, but I just failed, so we're just going to leave it there, but yeah, so check out Anna-Lena's work if you're getting into data science, that's pretty cool. Well, that's it for our main items, Brian, what else you got for us? Any little extra things you want to throw out?

21:40 OKKEN: Just somebody mentioned to me the other day that AWS Lambda now supports Python 3.7, which is awesome.

21:48 KENNEDY: Yeah, you can use data classes. It's cool, and it wasn't like it upgraded from 3.6, I think, I think it was something before that, like they were like well, when is 3.6 coming in, and they just said you know, skip that, 3.7.

21:58 OKKEN: Oh, they don't have 3.6?

21:59 KENNEDY: Well, they might now, I think that they were saying they were waiting for 3.6 and then actually, 3.7 came out, I could be wrong about that, but I feel like this was a big jump in the 3 world.

22:08 OKKEN: Yeah, I was so happy with 3.6, but now that 3.7's here, I'm like, I'll just use 3.7.

22:11 KENNEDY: Yeah, that's awesome.

22:12 OKKEN: How about you, you got anything else?

22:14 KENNEDY: Remember you asked me what Shiboken meant from last time? It has a super deep meaning. Actually, no, it doesn't mean anything, it's just a random name. I wonder if it was, what was that, hack your name? They could've probably just named it for the hack your name, right, yeah. So right now, I get Stylus for hack your name. That's pretty much as good as Shiboken, but Shiboken, there's, I actually linked to the blog post that says there's no name. But it's still a pretty cool C++ interrupt thing. Also, people out there listening, if you want to nominate somebody to become a PSF fellow, Python Software Foundation fellow, this is a group of folks who every quarter, five people are nominated and put on the roster as having done something awesome for the Python community in general. So I'm linking to the place where you can read what this is about and then nominate somebody. So if someone out there is doing something cool, nominate them, that way, they have a chance of being in this group.

23:09 OKKEN: Are you a fellow?

23:10 KENNEDY: I am, actually. Very surprising, I didn't even know about Python Software Foundation fellows and somebody nominated me and they said hey, you got the award. Wait, what? So yeah, whoever nominated me, thank you so much, that was awesome, I am, yes.

23:22 OKKEN: Yeah, that's cool. So it would be a waste if somebody were to nominate you again.

23:26 KENNEDY: Yeah, the link I actually sent is a Twitter thing that says please don't nominate me, here's how to nominate somebody.

23:30 OKKEN: Oh, okay.

23:34 KENNEDY: Yeah, yeah. But that's pretty awesome. All right, so anyway, that would, I'm sure that would really make somebody's week if they got that and they probably don't even expect it.

23:42 OKKEN: Yeah, nice, cool.

23:43 KENNEDY: All right, well, that's it for this week, Brian.

23:45 OKKEN: All right, well, we'll talk to you next week.

23:46 KENNEDY: Yeah, you bet, go forth in turkey. Thank you for listening to Python Bytes. Follow the show on Twitter via @pythonbytes, that's Python Bytes as in B-Y-T-E-S, and get the full show notes at If you have a news item you want featured, just visit and send it our way, we're always on the lookout for sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy, thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page