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 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:05 This is episode 105, recorded November 21st on Turkey Eve.

00:11 Yeah.

00:12 And I'm Michael Kennedy.

00:13 And I'm Brian Atkin.

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

00:15 No, not at all.

00:16 Yeah.

00:17 Are you?

00:18 I'm getting there, I'm getting there. I just picked up a whole bunch of stuff.

00:20 We're going to cook a turkey and it's going to be crazy.

00:22 So, yeah.

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

00:28 - Yeah, that's the way to do it.

00:29 Just save yourself the trouble.

00:30 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.

00:37 It's like many hours.

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

00:45 - They've probably been drinking since 10, so you know, that's why.

00:48 All right, so for those of you who celebrate Thanksgiving, happy Thanksgiving.

00:52 For those of you who don't, a happy email Black Friday spam week.

00:57 and hopefully got some deals.

01:01 - Yes.

01:02 - So thinking of crazy things, it's pretty awesome that DigitalOcean is giving people $100 credit for creating an account over at

01:12 Tell you more about that later.

01:14 You know, one thing I like about Thanksgiving is it lets you sort of look back on history and think about your family and kind of just older stuff, right?

01:21 - Yeah, it does.

01:23 It's nice.

01:24 And maybe look at some old pictures.

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

01:31 - Definitely.

01:32 There's a project and it's Python based and machine learning called DeOldify.

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

01:39 - Yeah, it would be actually a great name for a health club too, I think.

01:44 What it is is, I can only sort of describe it.

01:47 What it does is it takes a black and white photo and makes it look awesome.

01:50 And like, does a whole bunch of cleanup of sharpening and then colorizing it.

01:56 You kind of have to look at these pictures.

01:57 They're kind of amazing.

01:59 One of the things I like about actual old pictures when they started to take color photos and do colorizing, there was a lot of color.

02:08 It wasn't muted, whereas a lot of the, some of the colorizing algorithms that are out are kind of just come default to obvious things like grass is green and make everything kind of brownish and stuff.

02:21 And it just makes it a little bit better than black and white, but not really.

02:25 but these really pop, like adding purple and greens and reds and all sorts of awesome things.

02:32 - These are glorious, like the old SodaShop one.

02:35 It's just so amazing.

02:36 Do you know how it gets the color right?

02:38 Like why does it not make people purple or something?

02:41 - Well, I mean, things like people are sort of an easy thing because they're gonna be kind of people colored.

02:47 (laughing)

02:49 - Okay.

02:50 - If we get too far into how it works, I really can't tell you.

02:54 - Well, it does use deep learning, which means like if you get too deep down, nobody knows how it works in some sense, right?

02:59 Like you've taught it sort of by example?

03:02 - Yeah, yeah, it's definitely based on self-attenuation, generative adversarial networks, and progressively growing the GANs with a two-time scale update rule and generator loss in two parts.

03:16 I have no idea what those words mean, but that's part of it.

03:19 - I think it's a really cool project.

03:21 I mean, you know what would be like a great Christmas gift 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.

03:34 Wouldn't that be awesome?

03:35 Yeah, it would be.

03:36 And I'm actually, I can't wait to try playing with this.

03:39 What I'm going to, with our main link 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.

03:51 It's kind of a really fun article.

03:53 So if you're curious about this, either just play with it, try it, or read the article.

03:58 - I really like these visual things.

03:59 I think it very clearly highlights how amazing just this whole deep learning, machine learning thing is, you know?

04:05 - Yeah, and this is a sort of a fun application of it that I would have never thought we could make our lives better by making these photos better.

04:14 I mean, I wouldn't have thought machine learning would be for that, but it's cool.

04:17 - Yeah, it's very cool.

04:18 So remember last time how you said Brett Canham was going to be mad at me?

04:24 Yeah.

04:25 Well, Brett Canham will probably be happy, because I got a lot of items on VS Code this week, and they're pretty awesome.

04:31 So I didn't do it to make up for it, but I'm happy to feature them.

04:35 So this first one has to do with IoT.

04:39 And I think IoT is one of these amazing things that often is below the surface.

04:45 Like when smartphones came out, it was so amazing.

04:47 Everybody saw it and you're like, show me that thing, that's incredible.

04:50 But the fact that, I don't know, your refrigerator's slightly smarter, or your microwave, or your doorbell, I think it's less obvious.

04:59 But there's tons of IoT stuff out there, and the ability to do it in Python these days is great, right?

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

05:11 - Yeah, and the price is coming down, the energy consumption is coming down, it's great.

05:15 So the thing that I wanna tell folks about is something that Jason Percor told us about, called PlatformIO IDE for VS Code.

05:25 So PlatformIO is this platform for interacting with all sorts of IoT and small device type of programming examples.

05:34 And it has tons of languages.

05:36 And what they've done is they've built in a debugging, their framework, all that stuff, into Visual Studio Code.

05:42 - Oh, that's cool.

05:43 - And what's cool is 'cause it's Visual Studio Code, it has all sorts of mixed mode understanding.

05:47 So if you're doing C++, embedded C++, great.

05:49 If you're doing Python, great.

05:51 It knows about all these things.

05:53 So super cool.

05:54 It has a cross-platform, of course, because it's just VS Code, basically.

05:58 Built-in debugger.

06:00 Check this out.

06:00 Remote unit testing on your device.

06:03 That's pretty sweet.

06:04 Firmware updates, all that sort of stuff.

06:06 - Yeah, neat.

06:07 - 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.

06:16 But it's sort of that kind of thing.

06:19 Now, there's a few features.

06:20 I think firmware updates and a few other things are paid.

06:23 But it's like $9 a month.

06:25 But there's also a free version.

06:26 So it's a little bit like PyCharm in that sense.

06:28 There's a paid edition and a free community edition.

06:30 So it's pretty cool.

06:32 The Platform.IO core itself is written in Python, which is awesome.

06:35 But it's written in legacy Python.

06:37 Boo!

06:38 Hiss, hiss.

06:38 But that's OK.

06:41 And then finally, Jason put together a video of when he--

06:45 it's sort of an unboxing of the IDE, but it's digital, so you don't really take it out of anything.

06:49 But when he first sort of test drove it--

06:51 Oh, that's neat.

06:52 --going through it.

06:52 So it's like a 15-minute video.

06:54 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 Nice.

06:59 Cool.

07:00 Yeah.

07:00 So IoT, definitely a cool option here.

07:03 You might be collecting a lot of data on those IoT devices, right?

07:06 You could have them all grabbing data from all over the world every five seconds, streaming it back, dropping it somewhere.

07:11 You want to look at it, right?

07:13 Yeah.

07:13 You might want to make that into some visualization.

07:17 >> Yes.

07:17 >> There's a lot of options.

07:20 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 >> Let's draw a graph. Wait, there's 300 ways to do that. Why is this?

07:34 >> Yeah. There's an article, it's on the Anaconda blog called Python Data Visualization 2018.

07:41 Why are there, why so many libraries?

07:44 It talks about, you know, how like there's some of them are map, there's matplotlib of course, and there's a whole bunch of others that are based on matplotlib.

07:53 And then whether or not you use JavaScript and then, you know, if you use JSON or something else, and then there's WebGL.

08:00 And anyway, this, it's a nice breakdown of the different tools and kind of the data, like what the behind it, like what data and stuff are they're using?

08:12 And then also what you can do with them, what plot types you can do.

08:15 And generally if you're, like if you're using, for instance, geographical data, then you probably maybe should look at a map plot lib with Kartopi or a few others.

08:27 They've got some examples and they bucket them together.

08:30 So it's less of a search.

08:32 You don't have to look at everything to see if you should look at it.

08:35 and also kind of what your data size is.

08:37 And I very much appreciated this to kind of narrow things down.

08:42 - Yeah, it's really cool.

08:42 And there's a great visualization as well from Jake Venderplass, which it's kind of like a mind map of related, linked together different visualization libraries.

08:54 So it has like, well, here's D3 as one of the major hubs, and you've got Matplotlib.

08:59 And maybe for Matplotlib, you might wanna use scikit-plot, which is derived based on that.

09:04 Or if you're using D3, you might use, I don't know, D3 Poe or whatever, like one of these other things.

09:09 But it also says, well, you can combine Matplotlib and D3.js and get MPLD, Matplot-something-3, like a combination.

09:19 MPLD3, I guess, I don't know.

09:22 But the relationships, so maybe, oh, if I'm using this, there's this other library that also has some other features I could combine.

09:28 I think it's cool.

09:29 - Yeah, they all kind of interrelate.

09:30 And then I wanted to point out that there's some, Sometimes you just like I just want something simple I really was looking for this example about a year ago, and I wish I would have found it, but there's a Example I'm gonna 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 now the plot lib might be the simplest thing, but it isn't obvious right off the bat how do you encode, how do you generate one of these things and then link to it in a web page and all that sort of stuff.

10:08 So this is nice.

10:10 - Nice, nice.

10:11 I don't have a reason to draw graphs too much, but I'm starting to think maybe some BI type stuff might be in my future.

10:18 That would be interesting to learn and I'll definitely have to come back to this to figure out how to look at it.

10:22 Cool.

10:23 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.

10:30 So DigitalOcean, great hosting provider, super affordable, really rock solid.

10:36 And one of the things that's cool that they do is they've created this idea of projects.

10:40 Because often you go into your cloud provider and you've got these testing servers and all this stuff.

10:46 You're like, well, what goes with what?

10:47 Is this thing, can I turn this server off?

10:50 Is it being used, right?

10:52 What group is it related with?

10:53 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.

11:10 So very cool.

11:11 You should check out what they got going on over there at

11:15 And like I said, you'll get $100 free credit if you create a new account there.

11:20 So very nice stuff.

11:21 Now, speaking in the cloud and speaking of Visual Studio Code, I wanna tell you all about

11:27 So is a thing I recently learned about.

11:30 They reached out to me for some stuff on Talk Python.

11:33 And after playing with it, it is pretty cool.

11:36 So you know how VS Code is an ElectronJS app, right?

11:41 OK.

11:42 So in ElectronJS, there's kind of a hidden Chrome--

11:44 the thing that you see is a window that's really Chrome, just like a headless Chrome type of thing running some kind of HTML there.

11:51 And then it talks to Node.js over a local transport of some sort.

11:55 What if you could separate those?

11:57 What if the Node.js backend lived in a server that was really awesome, and then you could just put the front end anywhere like a website?

12:03 - That's kind of how it's designed to work.

12:05 - Yeah, yeah.

12:06 It seems possible, right?

12:07 So basically, that's like

12:09 So it's full Visual Studio Code, but in your browser on awesome hardware.

12:14 So you can write code in your browser, and because it's full Visual Studio Code, you get all the 4,000 extensions, all the different languages, and it's not some cheapo imitation, sort of sometimes the autocomplete works, IDE in the cloud, it's like literally just Visual Studio, but working in your browser.

12:32 So it's really, 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 for my app.

12:41 That's a browser window, but you would just kind of forget.

12:43 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.

12:56 So you can do basically whatever you want in the cloud on this thing.

12:59 And there's a paid feature, you can push a button, and it will give you up to 96 cores of computational power.

13:06 You get a certain amount of free, like five hours, but after that, it's a paid feature.

13:10 But still, it's pretty awesome.

13:11 So if you wanna work on Linux and you're on, say, Windows and you need hardcore Linux, not just a VM, but something that's really running solid, you can use this.

13:21 If you're on a Chromebook or you're on a tablet, this would be awesome.

13:25 All sorts of stuff.

13:25 Another thing that's really cool is it has Google Docs-like collaboration.

13:29 So multiple people can be working on the same file at the same time.

13:32 - Oh, that's neat.

13:33 - Yeah, it's pretty awesome.

13:34 So anyway, I wanted to tell people about it.

13:36 They just launched a few weeks ago and I think it's pretty awesome.

13:39 They have really good Python support.

13:41 You can obviously pip install all the stuff you need 'cause you just open the terminal and you have root access.

13:46 So do what you like to it.

13:47 - It looks like it has a whole bunch of plugins available too.

13:50 It isn't just bare VS code.

13:53 - Yeah, no, it's super cool, that thing.

13:55 So, quite a neat project.

13:56 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.

14:05 So, anyway, something worth checking out, and the free option is pretty cool.

14:10 You get like three gigs of disk space, one gig of RAM for free forever, pretty much.

14:16 So, it's pretty cool.

14:16 - Yeah, that's generous.

14:18 - Yeah, yeah, not bad.

14:19 All right, what's your next one?

14:20 This one, it just popped up on my news feed, I think it was this morning.

14:24 This is a Forbes article about Guido and trying to bring more women into the Python community.

14:34 Some of the 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.

14:43 But apparently in 2015, somebody just mentioned to him, like weird, there's no women in the core, in Python core, why?

14:52 And, you know, he talks about a lot of projects having that problem, or at least a situation where there's not a lot of women contributing, and you kind of have to examine why that's going on.

15:05 And so he took on putting out an offer saying that he would mentor women that wanted to become core developers.

15:14 And of course we know Marietta was the first, and that's awesome.

15:20 And now there's four altogether, and he just wants that to keep growing.

15:26 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 stay involved with Python, it's just he doesn't want to be part of all the everyday fighting and stuff.

15:42 >> I read this also and I was thinking about, there was a comment that Python was worse than the average just commercial engineering team.

15:53 That is troublesome, but I think a lot of, even depending on what 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.

16:20 But that's probably a little insincere if you take a look about how the commit bit happens.

16:27 It's often a kind of a nebulous, fuzzy, we trust this person sort of a thing.

16:32 And a lot of hiring is that way too.

16:34 And the argument that a lot of hiring people say is, well, I would hire a woman or somebody, other underrepresented group, but nobody applied.

16:46 And I think that's just kind of BS.

16:47 You have to go out of your way to try to find a larger pool.

16:51 And so this is just a good reminder.

16:52 - Yeah, it's a great reminder.

16:53 And Guido did super important work there.

16:57 I said it before, but I think, I've been to 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 not so much, or not at all, basically.

17:20 So I think that's a really positive aspect of what's happening for the community.

17:25 And it's great that Forbes--

17:26 I mean, Forbes, that's a huge place to cover this.

17:29 So that's pretty awesome.

17:30 And 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?

17:38 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 right? Yeah, and also the some of it's the the crucible process of the hiring process of as well, even if you have people that are decent candidates. I don't remember where I could 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.

18:26 So you have to it has to start from the very beginning of be very careful what you put in your required qualifications Because it'll eliminate a bunch of people. Yeah, I think that's really interesting I speak to my wife about this sometimes and she's like guys will just Say they'll just they can do this thing or or whatever and they can't they don't have all this 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's just saying it is the way it is So you have to be aware of it. 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 if you have a moment Requirements, yes And if you have most of it's a wish list and if you have most of the things or the important ones even just apply Right. I mean there's so many opportunities for JET 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. 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?

19:30 Yeah And you have to be really careful with that because you you might end up with a whole bunch of people that are kind Of the same. Yeah, I think that one's that one's trickier and these needs attention Okay, so the last one that I want to cover is from a very inspirational woman named Annalena Popkis, and I had her back on Talk Python just last week, actually.

19:49 That was an incredible interview, too.

19:51 Thank you.

19:52 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.

20:00 And one of the things that was inspirational was not long ago, she had no programming skills, Then she decided to go into 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.

20:16 And the thing that I wanna tell people about is directly from that whole path.

20:20 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 - Nice.

20:32 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 Cool.

20:42 So if you're out there and you are doing data science or want to get into data science, she has a bunch of really nice notebooks that you can check out.

20:51 I'll link to most of them here.

20:53 And this is built in modern Python, so hooray for that.

20:56 So anyway, she built this for herself to learn these algorithms actually did this sort of career progression, and maybe throwing it out there is going to help a lot of people.

21:05 It already has like 2,500 GitHub stars, so I guess it will be.

21:09 Plus it has a perceptron.

21:10 I don't even know what a perceptron is, but that's a really cool word.

21:13 I know. It's like a psychic power used by the machine learning algorithm.

21:17 [laughter]

21:19 No, I have no idea what it is either, but it sounds awesome.

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

21:25 I'm sure.

21:26 Yeah, I was going to make a good joke about another algorithm to follow up on that, but I just failed.

21:30 So we're just going to leave it there.

21:32 But yeah, so check out Anna Elena's work if you're getting into data science.

21:35 That's pretty cool.

21:36 Well, that's it for our main items, Brian.

21:37 What else you got for us?

21:38 Any little extra things you want to throw out?

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

21:48 Yay, you can use data classes.

21:50 Yeah.

21:51 That's cool.

21:51 And it wasn't like it upgraded from 3.6, I think.

21:54 I think it was something before that.

21:55 They were like, well, when is 3.6 coming?

21:56 And they just said, skip that.

21:58 3.7.

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

21:59 Well, they might now.

22:00 I think that they were saying they were waiting for 3.6 and then actually 3.7 came out.

22:04 I could be wrong about that, but I feel like this was a big jump in the 3 world.

22:07 Yeah.

22:08 I was so happy with 3.6, but now the 3.7 is here.

22:10 I'm like, yeah, I'll just use 3.7.

22:11 Yeah.

22:12 That's awesome.

22:12 How about you?

22:13 Got anything else?

22:14 Remember you asked me what Shabokan meant from last time?

22:17 Yeah.

22:18 It has a super deep meaning.

22:19 Actually, no, it doesn't mean anything.

22:21 It's just a random name.

22:22 I wonder if it was, what was that?

22:24 Hack your name?

22:25 Like they could probably just name it from hack your name.

22:27 Right.

22:28 - Yeah. - Yeah, so right now I get Stylis for hack your name.

22:31 That's pretty much as good as Shabokan, but Shabokan, I actually link to the blog post that says there's no name, but it's still a pretty cool C++ interop thing.

22:40 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.

22:57 So I'm linking to the place where you can read what this is about and then nominate somebody.

23:04 So if someone out there is doing something cool, nominate them.

23:07 That way they have a chance of being in this group.

23:09 Are you a fellow?

23:10 I am, actually. Very surprising.

23:12 I didn't even know about Python Software Foundation Fellows, and somebody nominated me, and they said, "Hey, you got the award." I said, "Wait, what?" So yeah, whoever nominated me, thank you so much.

23:20 That was awesome. I am. Yes.

23:22 Yeah, that's cool.

23:23 So it would be waste if somebody were to nominate you again.

23:26 - Yeah, the link I actually sent is a Twitter thing that says, "Please don't nominate me.

23:29 Here's how to nominate somebody." - Oh, okay. (laughs)

23:32 - Thanks.

23:33 Yeah, yeah. - Cool.

23:35 - But that's pretty awesome.

23:35 All right, so anyway, I'm sure that would really make somebody's week if they got that, and they probably don't even expect it.

23:42 - Yeah, nice.

23:43 - Cool, all right, well, that's it for this week, Brian.

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

23:46 - Yeah, you bet, go forth and turkey.

23:48 Thank you for listening to Python Bytes.

23:50 Follow the show on Twitter via @PythonBytes.

23:52 That's Python Bytes as in B-Y-T-E-S.

23:55 and get the full show notes at

23:59 If you have a news item you want featured, just visit and send it our way.

24:03 We're always on the lookout for sharing something cool.

24:06 On behalf of myself and Brian Okken, this is Michael Kennedy.

24:09 Thank you for listening and sharing this podcast with your friends and colleagues.


Back to show page