Ruby, Red Pandas, and You
CC Attribution - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Marcia, Sean
Red pandas are adorable, playful, curious, and super cute. Unfortunately, they are in serious trouble. Over 50% of red panda newborns born in captivity do not survive long enough to leave their den and no one knows why. Come find out why red pandas are so amazing, how I met a Smithsonian Zoo researcher studying this and how we’re solving this important problem using Ruby and machine learning. You will also leave this talk knowing how you can get involved (no matter your skill level) with great projects like this.
 Awesome. Hey, so I just added in the Minnesotwan slide here because I was talking to someone maybe about an hour ago and they hadn't heard of Minnesotwan. And I think I'm still a little sad about what happened on Tuesday. So I think maybe talking about Minnesotwan briefly will be cathartic. So what Minnesotwan is, if you're not familiar, is, that's a rendering of Matt. Matt said he created the Ruby language to make developers happy. And so that turned into this happy feeling in our community. And back in the early days on the email lists before forums and stuff, if someone was kind of getting out in line and being a turd, people would be like, hey, hey, Minnesotwan, Minnesotwan. Like what Minnesotwan means is Matt's is nice and so we are nice. And it's just this, you know, I feel this is one of our best tenants of our community. And like my local Ruby group, we make these Minnesotwan stickers. And so if you want one, come up after. I'd love to give you one. But today, I'm going to be talking about Ruby, Red Pandas, and you. I misjudged how many people were going to be here. I really like this community. I'm Sean, by the way. I love this community, this Ruby community. And I love RubyConf. It's probably my favorite conference. It's hard to believe that it's been years since San Antonio. I feel it just happened. And it's had me reflecting on what's happened in the past year since last November, last RubyConf. And I guess obviously the thing that jumps to my mind, the big thing in the last year is that we've had an election. We have a new world leader, someone who's out there representing all that's best about us and what a country can be. Someone I'm personally very, very proud we elected. You know, obviously I'm talking about Justin Trudeau in Canada. So a lot of people ask me about this picture, and being from Saskatchewan, Canada, the reason I'm so happy here in this picture is, you know, being from Saskatchewan, it's my life goal to capture a Sasquatch. And I thought I'd captured the rarest of all Sasquatches, the albino Sasquatch, but it turns out it was just a Yeti. So about me, I'm Sean. I'm the creator, organizer of Ruby for Good. Love Dogs, figuratively. Canadian. Work for the government. And I'm not a big fan of public speaking, but my wife gave me some really good advice. She said, you know, Sean, don't worry. You're going to be fine. Just go up there, be your regular charming, enhance yourself. And yeah, I'm just thinking the exact same thing. So today I'm going to talk a little bit about bees, because a lot of people know me as the bee person. I'm going to talk about red pandas, how I solve this red panda problem. And I'm going to hopefully inspire some of you guys to get involved in a similar thing. So if you're not familiar with the bee thing, I was helping this professor who's studying colony colapsus order, monitor beehives using Ruby and raspberry pies. And he was hoping to get information on a beehive before it collapsed. Fortunately, we weren't able to, none of the beehives collapsed while we were monitoring them. So like, which seems good for the bees. And like, you know, I told them, well, we should just monitor every beehive in the world, and then none will collapse. But he's from Columbia, and maybe it didn't translate right. He just said, no, no, that won't work. But the bees are in trouble. They've just, we've ate species, just moved to the endangered species list. So it would seem like that all this bee stuff is a failure. But I think there's some good that's happened. I want to introduce you all to Taylor. This is Taylor when I met her. She was in the ninth grade. And I took her for a tour around George Mason University and showed her around. And then she just got inspired. She went back to her high school and her parents, and she got a beehive, and now she has nine beehives, and she's leading in clubs. And how awesome that is. She just got a $2,500 grant to spread research. It's just amazing. And I know this because Taylor's mom got in contact with me and told me that all this has happened, and she's applying to colleges, and she's writing about this, and that this was all this bee stuff was an inspiration for her. So I really think that maybe while the project was a failure, that this amazing young woman is going to maybe solve the problem for the future. So I'm very optimistic. But I know everyone here, you guys don't care about the bees. You're waiting to see cute little pictures of red pandas. So let's talk about red pandas. I got introduced to, well, we've all seen pictures. But my first introduction to them was really when I read this article from New York Times, I was reading this article, telling me about what's going on, and it turned out that the lady who was all featured in this article and all the pictures and this researcher, she works at George Mason University, where I worked. And so I went and found her. Her name was Elizabeth Freeman, and I asked her, hey, how can I help with your research? Because really, I'm thinking in my head, I want to go see a red panda. I want to steal a red panda. And so we got talking, and she told me a lot of really neat things about red pandas, and I'm going to share a few of them with you now. But the most important thing, if you only take one thing away from this talk about red pandas, know this, they're delicious. Okay. Obviously, it's a joke. So what is a red panda? So this is not a red panda. This is a giant panda, but red pandas are actually the original panda. They were discovered, I guess discovered, I don't know if that's the right word, 50 years before the giant red pandas. And they're not related to them at all. They're not related to bears. They're distantly related to raccoons and weasels and skunks, but they broke out on their own branch about 29 million years ago. And they're actually something that's interesting about them. They're carnivores. Even though they eat bamboo and they've evolved to eat bamboo, they are still carnivores, and they have the, my slide's wrong. Sorry. And they're found throughout the Himalayas region. They're in a, you know, Nepal, China, Sichuan, Yunnan, Bhutan. And there's two subspecies of them. And like I said, they are carnivores and they live in this really unique area. They're about 2,000 to 5,000 meters, and if you're, I guess, American, multiply that by about 3.25 to get feet. They live on the slopes. They primarily eat bamboo, but they, like I said, they are carnivores, so they'll eat animals if they can. They'll eat birds. They'll eat insects. And they're just so cute. And like I said, they have this really slow metabolism, and like they have the inside of a carnivore, so what that means is like they have the single-pouch stomach. They have the really short colon, and they have the big teeth, and they have like a large range that they inhabit, because like they can only eat those bamboo shoots, and so they kind of like little farm areas of bamboo over the place. But one of the problems with them, like compared to other animals in carnivores their size, they're really slow to mature, like sexually. Like it's about twice as long. Their gestation periods are about twice as long as well, like between 90 and 160 days, and they have a very small litter of cubs. And they suspect that some of the reasons why they, like their gestation period is so long is because of their metabolism, possibly a delayed implantation or embryonic dive-haws. And like officially they're listed as endangered. About 50% of the population is in decline, or they've had a 50% population decline in the last three generations, and this is a consistent trend, like it's not reversing. And the total population in the world is less than 10,000, they suspect, and in captivity there's between about eight and 900. And basically like humans, like we're the reason they're disappearing, like they're either being poached, or like the people who live in these areas, like they're getting by on very little, like they're very extreme areas, so they're cutting down the forest, or they're hunting dogs, or invading their dens, or they're even, like you see the lady with the hat, Elizabeth, when she was over there, she saw people wearing these hats, and actually in Yunnan province of China, it's considered good luck to give a wedding gift of an article of clothing with red pandafir on it. And there's also a problem in captivity with red pandas, like over half the cubs born in captivity, they die within the first year. Like 20% of them, like they don't even know why they die, they're still born or they die. The other ones, you know, maybe it's poor maternal care, maternal cannibalism, maybe they are delicious, or pneumonia, or other factors, and so like they really need research into this to determine what's happening. And because like I said, they are really unique, like they are their own branch, like they're the Allure Day family, and so like to give an equivalent of that, that's the same, like they have as much genetic diversity or information as felines, like all felines, so like that's lions and tigers and cats in your house, and so if we lose them, that's a lot of information we're losing. But how the researchers are getting this information to try and address a problem is through nest box cameras. And so like they've set up nest boxes, and that's where a red panda lives in the wild as a nest, and so they're trying to mimic that, and they've put all these cameras in there to really learn about its first part of life. And like this is an example of a nest box, and like the information they try and get from this is like how do mothers and cubs interact, what happens after a cub is born, and then also like in subsequent generations, how do the female cubs, do they learn something from the mothers and behavior? And so we see she's making the nest here and checking stuff out, and she's about to give birth. And so, and when they're born, they're just, they're kind of, oh, there's one, but it's not just this too, like there's a side, some side information that they're trying to get from this as well. Like pandas suffer from a parasite, and they don't know how this parasite is getting into captive panda populations, and they're also hoping by studying this, maybe they can see maybe if there's a vector from this, and there's just like little blobs of butter after they're born. And so then you also see how mothers and cubs interact. And so like I was saying, the, just so cute. So like I said, there is a parasite that's affecting them, and they don't know how this parasite is getting in, and it causes encephalitis. And so like if you do a Google search for encephalitis and red panda, you'll see articles like this and like this. And but you know, they don't call it encephalitis among researchers, they call it panda cancer. And that really bothers me because I feel like that's just such a cute name. Like can't we give it, like can't we call it like evil cancer or nasty cancer or something that really denotes how horrible it is, like Trump cancer or, I'm sorry, I promise no Trump jokes. Damn. So with regards to the Nest Box, so they have these DVRs, they're recording all this video, and this is what Elizabeth really wanted me to help with. So they record hundreds and hundreds of hours of video. And but the problem is, is like, you know, for every 12 hours they record, maybe there's only a panda on the video for three hours. And so right now what happens is a human sits down, they watch the video for the 12 hours, and maybe they fast forward a bit, and they have to mark, okay, for minute 68 to 122, there's a red panda on camera, then minute 228 to 340, there's red pandas on camera. And like, and this is really, really time consuming for them. And like their resources and like these are, you know, these are PhDs and doctoral researchers like putting their time towards like trying to watch videos, and you know, time to better spend like, you know, trying to help red pandas. And so I said, well, I'll figure that out. And you know, just sort of to emphasize the problem here, we had these giant videos, they were all between six and 12 hours long, and all the videos were huge. They're like one plus gigabytes. And we also had international people using this, like Elizabeth works with people and China and actually someone in Cincinnati, I guess they're not international. But like people all over the world, like I guess the red panda, I mean, he's pretty small and tight knit. And so like I thought, okay, how can I solve this? I need to approach this problem. I'm a software engineer. What would a software engineer do? Bam. So, so I guess there wasn't an easy answer or no one else has done this before. And so, okay, how about I just break this down into small pieces? I can do that. This isn't overwhelming. Like, seemed really overwhelming. But like, okay, what's the first part? Well, I just need to upload the files onto a server. Okay, I can do that. And I did, I just used paperclip, the paperclip gem and the jQuery file upload. And the reason those two gems is because they're both easy, I've worked with them before. And the great thing about the jQuery gem is it allows a resuming of uploads. And like this was very important because like I said, we had people in China and so I didn't want someone from China uploading a video that's, you know, multiple gigabytes, get 90% of the way done and they lose their connection and start all over because they pay, like some of their people pay for, pay by the gigabytes. And there was one gotcha. I was having a problem with upload size and I thought it was a paperclip error. It turned out to be engine X. It comes with the default configuration, it says 20 megabytes. So if you just, if you're ever in this situation, change your upload max file size to zero and it'll have unlimited. So now, okay, now we need to identify the Panasonic video. We've got the first half done, second half has got to be just as easy. And but I had no idea how to do this. And so I started asking friends and my good friend Josh, he was the CTO of upToro and I'm sure they're probably hiring so go work upToro. But he said, oh, you need to use a machine learning and a neural network. It's like, I know all those words but I don't know what any of them mean. And so, you know, I started doing some research and like, okay, I understand this. But it really turns out that, you know, analyzing video is not, not an option. I found a couple of services that would even do video. You know, the first 30 seconds were fairly cheap but then after that it's exponentially expensive and you know, if they're 12 hours long, it wasn't possible. And again, we're trying to save these researchers money. But it turns out that analyzing pictures with a neural network is extremely easy. And so, okay, all I need to do then is convert a video to images. And it turns out like that's all a video is, is a series of images and if you ever as a kid had one of those books where you flip through it and see the horse running or something, it's okay, I can do this. So how do I convert it? I found the FF MPEG tool and so I just, you know, put that in and sliced it up. But first thing, you know, another little gotcha. Most video is like 30 frames per second and so like, turned out to be a lot of images and I didn't need half a million images. Like, red pandas aren't very fast and as you saw the baby, they're pretty slow and cumbersome. And so, you know, just need one every second or so. And but, you know, I had all the images, awesome. So let's move on to the next step. Let's identify these images. And so, you know, I'd researched these neural networks things and there was this library out there called TensorFlow, it's by Google. And I was like, okay, this isn't bad. They have something called an inception network. And it's like, okay, this is real easy because they had an example using cats and dogs with two different things and it's like, oh, this is perfect. I can just like steal this entire example because I just need pandas and no pandas. And so I just basically stole all their code and it was perfect. I had to, you know, make my own classifier library of images and like the images are things like, you know, images when there's no pandas. Images when there are pandas. Oh, you know, she's being watched. Or she. Again, there was a gotcha, though. It turns out that one of the researchers in China, their videos were in color and so that led to smerrors. But you know, the great thing is with TensorFlow, you can just rebuild your classification libraries. So you know, just throw in a couple more pictures, oh, little babies. And then it was working for them. It was fantastic. And for reference, this is what it would look like when you run a picture through. It would give you a probability if, okay, is there a red panda, no, or is it empty? Because those, you know, cats, dogs. And so it thinks there's a red panda. So basically what I did is, okay, if there's, if TensorFlow believes there's more than a 60% chance there's a red panda, throw it into an array. And that's it. But there was a problem with false positives and false negatives. You know, like you're, like, occasionally TensorFlow would get some wrong. So I built in a, just like a basic thing. So I wouldn't start recording yeses or nos unless there were three in a row. And so, you know, I'd need three, like, yeses before I'd say, okay, there's a panda on camera and then three nos. And then it actually turned out to be really clever that I, clever, lucky. It turned out to be really lucky that I was doing one every second because then it just mapped up perfectly with time. So if the pandas, the yeses started at position 30, stopped at position 60, I knew from second 30 to second 60, there are red pandas on camera. And, you know, the final results of this were that it was really, really accurate. I was really worried at first because when I ran the first video through one that had been classified by one of the humans, I got different results. And so it's like, oh, crap. And so, but then I manually went through and it turned out that the humans had misclassified it and the machine was smarter than the humans. And it was cost effective too. Like it was just some of my time. But it saved the researchers a lot of money. Like I think they were looking at buying software like this that was in the name of $20,000 and software is a service fees each month and all this kind of stuff. And so this is money that they're going to use to help baby pandas that hopefully they have to go visit and steal. So I don't know if projects like this are interested or interesting to all of you. And I hope they are. And if they are, I really want to encourage you to come out to Ruby for good. And this is our logo. It's a world that's full of love because it's embracing Ruby. And if you see in the bottom corner of the copyright, that's actually not a copyright. That's a JW. That's our shout out to Jim Warwick because we love Jim. We miss Jim. We think he the proof of what we're doing. But to answer what Ruby for good is, it's easier to answer what it isn't. It's not a bunch of us trying to get together to solve stupid theoretical questions like this one. But I guess this one's solved now. What it is, it's a long weekend, long event where we get a bunch of people like us together. We start on a Thursday. We end on a Sunday. It's all inclusive. So your food and your room, everything's covered. And we build software for nonprofits. People who need our help but would never be able to afford us. And so I know a lot of you are probably thinking, oh, that's a hackathon. And it's not. It's really, really not. And anytime someone compares it to a hackathon, my soul dies a little bit. Ours is as much about community and having fun as it is about doing good. We have a hard stop every day at dinner time. And we play games in the evening and werewolf and karaoke. If I could tell you the goals of the event, it's obviously to make the world better. And it's to learn. And we have people who come who are brand new beginners to people from GitHub and Digital Ocean and Optoro. So it's all a range. And everyone's going to learn. It doesn't matter if you are brand new or if you are a senior. Like because the seniors, they're the people who seem to get the most out of it. Like a lot of them have never led teams before or if they have led teams. A lot of times, they get stuck in their ways. And so they're using certain gems and certain tools. And then they learn all these new kind of practices from these people who are new to our industry. Like maybe just out of boot camp and familiar. And again, community. And building community is so important. And I think it's especially important right now with kind of like the atmosphere we have in our country right now. And so like these are some of the places we've helped in prior years. Like the Portland Everbank, SnapFresh, Habitat for Humanity, the Humane Society. Like just really great places. And like this is the Humane Society team. Like what a great looking group of people. And one of the great, amazing things about the Humane Society is we get to play with kittens. How many room events do you get to go to where there's kittens? And so again, like there's learning and pair programming and building good stuff. And again, like community. We're playing board games here and singing karaoke. Actually, again, the hammer in this community a bit more because again, I'm in a different mind space because of all the stuff happening. So Julian there was singing karaoke late one night with another gentleman named Josh. And Josh is like from Iron Yard. And I guess Josh was looking for a new job. And Julian found that out at like 3.30 in the morning. So he called up his manager at 3.30 in the morning. Said, you have to hire this guy. Now they're coworkers. Or this guy, Devin. Who's right there? So Devin's another one of those amazing young men who you meet this guy and he's like, wow, I'm so happy I've met him now because in 10 years this guy's going to be amazing. He's amazing now. More amazing. But Devin flew in from San Francisco and when it came time to leave, he didn't get on his plane. He stayed in the area. He just loved the community so much. And I guess lastly, Adam, get married at Ruby for good. Or propose, come on. So these are my 75 new best friends from this year. And I hope next year you're one of my new 75 best friends. But enough preaching about Ruby for good. Kind of broken record on that, I think. Who's ever heard of an animal called an elephant? Okay, see a few hands. So if you've never heard of an elephant, this is an elephant. Elephants are pretty amazing animals. They have best friends. If one's sad, other elephants will comfort them. But elephants are being poached right now at the rate of about 100 a day. And actually this is Elizabeth. Actually, the person's Elizabeth. The elephant's Ambika. But Elizabeth, that's the researcher. She's also working with researchers in Africa on an elephant project that she needs some help with. So if someone's interested, I'd love to give more information. And she's also working on a behavioral app to track red panda data. And I don't see her here, but Betsy is leading that project. So if you want to get involved in that. And there's another project as well. So please get in touch. So I know I joke around a lot, but if I can be serious, I guess, for a second. I know a lot of us are maybe confused or we're kind of hurting right now because of the stuff. And so many people choosing hate rather than hope. And we're worried for friends and those of us in maybe vulnerable communities. And so I know I come up to these events and I give talks on making the world great and saving the world together. And that's great in our community. We love to get together and save the world. And I feel like that's something I love about it. But I want everyone to know that it's okay if you leave here and you just save the world for one person. And it's especially okay if that one person's yourself. So I'm not leaving on a downer note. This is a red panda fighting with a pumpkin. And they're fighting to a draw apparently. Keep hoping for them to win, but... So thank you. Any questions? Thank you. Thank you.
 Awesome.  Hey, so I just added in the Minnesotwan slide here because I was talking to someone maybe  about an hour ago and they hadn't heard of Minnesotwan.  And I think I'm still a little sad about what happened on Tuesday.  So I think maybe talking about Minnesotwan briefly will be cathartic.  So what Minnesotwan is, if you're not familiar, is, that's a rendering of Matt.  Matt said he created the Ruby language to make developers happy.  And so that turned into this happy feeling in our community.  And back in the early days on the email lists before forums and stuff, if someone was kind  of getting out in line and being a turd, people would be like, hey, hey, Minnesotwan, Minnesotwan.  Like what Minnesotwan means is Matt's is nice and so we are nice.  And it's just this, you know, I feel this is one of our best tenants of our community.  And like my local Ruby group, we make these Minnesotwan stickers.  And so if you want one, come up after.  I'd love to give you one.  But today, I'm going to be talking about Ruby, Red Pandas, and you.  I misjudged how many people were going to be here.  I really like this community.  I'm Sean, by the way.  I love this community, this Ruby community.  And I love RubyConf.  It's probably my favorite conference.  It's hard to believe that it's been years since San Antonio.  I feel it just happened.  And it's had me reflecting on what's happened in the past year since last November, last  RubyConf.  And I guess obviously the thing that jumps to my mind, the big thing in the last year  is that we've had an election.  We have a new world leader, someone who's out there representing all that's best about  us and what a country can be.  Someone I'm personally very, very proud we elected.  You know, obviously I'm talking about Justin Trudeau in Canada.  So a lot of people ask me about this picture, and being from Saskatchewan, Canada, the reason  I'm so happy here in this picture is, you know, being from Saskatchewan, it's my life  goal to capture a Sasquatch.  And I thought I'd captured the rarest of all Sasquatches, the albino Sasquatch, but  it turns out it was just a Yeti.  So about me, I'm Sean.  I'm the creator, organizer of Ruby for Good.  Love Dogs, figuratively.  Canadian.  Work for the government.  And I'm not a big fan of public speaking, but my wife gave me some really good advice.  She said, you know, Sean, don't worry.  You're going to be fine.  Just go up there, be your regular charming, enhance yourself.  And yeah, I'm just thinking the exact same thing.  So today I'm going to talk a little bit about bees, because a lot of people know me as the  bee person.  I'm going to talk about red pandas, how I solve this red panda problem.  And I'm going to hopefully inspire some of you guys to get involved in a similar thing.  So if you're not familiar with the bee thing, I was helping this professor who's studying  colony colapsus order, monitor beehives using Ruby and raspberry pies.  And he was hoping to get information on a beehive before it collapsed.  Fortunately, we weren't able to, none of the beehives collapsed while we were monitoring  them.  So like, which seems good for the bees.  And like, you know, I told them, well, we should just monitor every beehive in the world,  and then none will collapse.  But he's from Columbia, and maybe it didn't translate right.  He just said, no, no, that won't work.  But the bees are in trouble.  They've just, we've ate species, just moved to the endangered species list.  So it would seem like that all this bee stuff is a failure.  But I think there's some good that's happened.  I want to introduce you all to Taylor.  This is Taylor when I met her.  She was in the ninth grade.  And I took her for a tour around George Mason University and showed her around.  And then she just got inspired.  She went back to her high school and her parents, and she got a beehive, and now she has nine  beehives, and she's leading in clubs.  And how awesome that is.  She just got a $2,500 grant to spread research.  It's just amazing.  And I know this because Taylor's mom got in contact with me and told me that all this  has happened, and she's applying to colleges, and she's writing about this, and that this  was all this bee stuff was an inspiration for her.  So I really think that maybe while the project was a failure, that this amazing young woman  is going to maybe solve the problem for the future.  So I'm very optimistic.  But I know everyone here, you guys don't care about the bees.  You're waiting to see cute little pictures of red pandas.  So let's talk about red pandas.  I got introduced to, well, we've all seen pictures.  But my first introduction to them was really when I read this article from New York Times,  I was reading this article, telling me about what's going on, and it turned out that the  lady who was all featured in this article and all the pictures and this researcher,  she works at George Mason University, where I worked.  And so I went and found her.  Her name was Elizabeth Freeman, and I asked her, hey, how can I help with your research?  Because really, I'm thinking in my head, I want to go see a red panda.  I want to steal a red panda.  And so we got talking, and she told me a lot of really neat things about red pandas, and  I'm going to share a few of them with you now.  But the most important thing, if you only take one thing away from this talk about red pandas,  know this, they're delicious.  Okay.  Obviously, it's a joke.  So what is a red panda?  So this is not a red panda.  This is a giant panda, but red pandas are actually the original panda.  They were discovered, I guess discovered, I don't know if that's the right word, 50 years  before the giant red pandas.  And they're not related to them at all.  They're not related to bears.  They're distantly related to raccoons and weasels and skunks, but they broke out on  their own branch about 29 million years ago.  And they're actually something that's interesting about them.  They're carnivores.  Even though they eat bamboo and they've evolved to eat bamboo, they are still carnivores,  and they have the, my slide's wrong.  Sorry.  And they're found throughout the Himalayas region.  They're in a, you know, Nepal, China, Sichuan, Yunnan, Bhutan.  And there's two subspecies of them.  And like I said, they are carnivores and they live in this really unique area.  They're about 2,000 to 5,000 meters, and if you're, I guess, American, multiply that  by about 3.25 to get feet.  They live on the slopes.  They primarily eat bamboo, but they, like I said, they are carnivores, so they'll eat  animals if they can.  They'll eat birds.  They'll eat insects.  And they're just so cute.  And like I said, they have this really slow metabolism, and like they have the inside  of a carnivore, so what that means is like they have the single-pouch stomach.  They have the really short colon, and they have the big teeth, and they have like a large  range that they inhabit, because like they can only eat those bamboo shoots, and so they  kind of like little farm areas of bamboo over the place.  But one of the problems with them, like compared to other animals in carnivores their size,  they're really slow to mature, like sexually.  Like it's about twice as long.  Their gestation periods are about twice as long as well, like between 90 and 160 days,  and they have a very small litter of cubs.  And they suspect that some of the reasons why they, like their gestation period is so long  is because of their metabolism, possibly a delayed implantation or embryonic dive-haws.  And like officially they're listed as endangered.  About 50% of the population is in decline, or they've had a 50% population decline in  the last three generations, and this is a consistent trend, like it's not reversing.  And the total population in the world is less than 10,000, they suspect, and in captivity  there's between about eight and 900.  And basically like humans, like we're the reason they're disappearing, like they're  either being poached, or like the people who live in these areas, like they're getting  by on very little, like they're very extreme areas, so they're cutting down the forest,  or they're hunting dogs, or invading their dens, or they're even, like you see the lady  with the hat, Elizabeth, when she was over there, she saw people wearing these hats, and  actually in Yunnan province of China, it's considered good luck to give a wedding gift  of an article of clothing with red pandafir on it.  And there's also a problem in captivity with red pandas, like over half the cubs born  in captivity, they die within the first year.  Like 20% of them, like they don't even know why they die, they're still born or they die.  The other ones, you know, maybe it's poor maternal care, maternal cannibalism, maybe  they are delicious, or pneumonia, or other factors, and so like they really need research  into this to determine what's happening.  And because like I said, they are really unique, like they are their own branch, like they're  the Allure Day family, and so like to give an equivalent of that, that's the same, like  they have as much genetic diversity or information as felines, like all felines, so like that's  lions and tigers and cats in your house, and so if we lose them, that's a lot of information  we're losing.  But how the researchers are getting this information to try and address a problem is through nest  box cameras.  And so like they've set up nest boxes, and that's where a red panda lives in the wild  as a nest, and so they're trying to mimic that, and they've put all these cameras in  there to really learn about its first part of life.  And like this is an example of a nest box, and like the information they try and get  from this is like how do mothers and cubs interact, what happens after a cub is born,  and then also like in subsequent generations, how do the female cubs, do they learn something  from the mothers and behavior?  And so we see she's making the nest here and checking stuff out, and she's about to give  birth.  And so, and when they're born, they're just, they're kind of, oh, there's one, but it's  not just this too, like there's a side, some side information that they're trying to get  from this as well.  Like pandas suffer from a parasite, and they don't know how this parasite is getting into  captive panda populations, and they're also hoping by studying this, maybe they can see  maybe if there's a vector from this, and there's just like little blobs of butter after they're  born.  And so then you also see how mothers and cubs interact.  And so like I was saying, the, just so cute.  So like I said, there is a parasite that's affecting them, and they don't know how this  parasite is getting in, and it causes encephalitis.  And so like if you do a Google search for encephalitis and red panda, you'll see articles like this  and like this.  And but you know, they don't call it encephalitis among researchers, they call it panda cancer.  And that really bothers me because I feel like that's just such a cute name.  Like can't we give it, like can't we call it like evil cancer or nasty cancer or something  that really denotes how horrible it is, like Trump cancer or, I'm sorry, I promise no Trump  jokes.  Damn.  So with regards to the Nest Box, so they have these DVRs, they're recording all this video,  and this is what Elizabeth really wanted me to help with.  So they record hundreds and hundreds of hours of video.  And but the problem is, is like, you know, for every 12 hours they record, maybe there's  only a panda on the video for three hours.  And so right now what happens is a human sits down, they watch the video for the 12 hours,  and maybe they fast forward a bit, and they have to mark, okay, for minute 68 to 122,  there's a red panda on camera, then minute 228 to 340, there's red pandas on camera.  And like, and this is really, really time consuming for them.  And like their resources and like these are, you know, these are PhDs and doctoral researchers  like putting their time towards like trying to watch videos, and you know, time to better  spend like, you know, trying to help red pandas.  And so I said, well, I'll figure that out.  And you know, just sort of to emphasize the problem here, we had these giant videos, they  were all between six and 12 hours long, and all the videos were huge.  They're like one plus gigabytes.  And we also had international people using this, like Elizabeth works with people and  China and actually someone in Cincinnati, I guess they're not international.  But like people all over the world, like I guess the red panda, I mean, he's pretty small  and tight knit.  And so like I thought, okay, how can I solve this?  I need to approach this problem.  I'm a software engineer.  What would a software engineer do?  Bam.  So, so I guess there wasn't an easy answer or no one else has done this before.  And so, okay, how about I just break this down into small pieces?  I can do that.  This isn't overwhelming.  Like, seemed really overwhelming.  But like, okay, what's the first part?  Well, I just need to upload the files onto a server.  Okay, I can do that.  And I did, I just used paperclip, the paperclip gem and the jQuery file upload.  And the reason those two gems is because they're both easy, I've worked with them before.  And the great thing about the jQuery gem is it allows a resuming of uploads.  And like this was very important because like I said, we had people in China and so I didn't  want someone from China uploading a video that's, you know, multiple gigabytes, get  90% of the way done and they lose their connection and start all over because they pay, like  some of their people pay for, pay by the gigabytes.  And there was one gotcha.  I was having a problem with upload size and I thought it was a paperclip error.  It turned out to be engine X.  It comes with the default configuration, it says 20 megabytes.  So if you just, if you're ever in this situation, change your upload max file size to zero and  it'll have unlimited.  So now, okay, now we need to identify the Panasonic video.  We've got the first half done, second half has got to be just as easy.  And but I had no idea how to do this.  And so I started asking friends and my good friend Josh, he was the CTO of upToro and  I'm sure they're probably hiring so go work upToro.  But he said, oh, you need to use a machine learning and a neural network.  It's like, I know all those words but I don't know what any of them mean.  And so, you know, I started doing some research and like, okay, I understand this.  But it really turns out that, you know, analyzing video is not, not an option.  I found a couple of services that would even do video.  You know, the first 30 seconds were fairly cheap but then after that it's exponentially  expensive and you know, if they're 12 hours long, it wasn't possible.  And again, we're trying to save these researchers money.  But it turns out that analyzing pictures with a neural network is extremely easy.  And so, okay, all I need to do then is convert a video to images.  And it turns out like that's all a video is, is a series of images and if you ever as a  kid had one of those books where you flip through it and see the horse running or something,  it's okay, I can do this.  So how do I convert it?  I found the FF MPEG tool and so I just, you know, put that in and sliced it up.  But first thing, you know, another little gotcha.  Most video is like 30 frames per second and so like, turned out to be a lot of images  and I didn't need half a million images.  Like, red pandas aren't very fast and as you saw the baby, they're pretty slow and cumbersome.  And so, you know, just need one every second or so.  And but, you know, I had all the images, awesome.  So let's move on to the next step.  Let's identify these images.  And so, you know, I'd researched these neural networks things and there was this library  out there called TensorFlow, it's by Google.  And I was like, okay, this isn't bad.  They have something called an inception network.  And it's like, okay, this is real easy because they had an example using cats and dogs with  two different things and it's like, oh, this is perfect.  I can just like steal this entire example because I just need pandas and no pandas.  And so I just basically stole all their code and it was perfect.  I had to, you know, make my own classifier library of images and like the images are  things like, you know, images when there's no pandas.  Images when there are pandas.  Oh, you know, she's being watched.  Or she.  Again, there was a gotcha, though.  It turns out that one of the researchers in China, their videos were in color and so  that led to smerrors.  But you know, the great thing is with TensorFlow, you can just rebuild your classification libraries.  So you know, just throw in a couple more pictures, oh, little babies.  And then it was working for them.  It was fantastic.  And for reference, this is what it would look like when you run a picture through.  It would give you a probability if, okay, is there a red panda, no, or is it empty?  Because those, you know, cats, dogs.  And so it thinks there's a red panda.  So basically what I did is, okay, if there's, if TensorFlow believes there's more than  a 60% chance there's a red panda, throw it into an array.  And that's it.  But there was a problem with false positives and false negatives.  You know, like you're, like, occasionally TensorFlow would get some wrong.  So I built in a, just like a basic thing.  So I wouldn't start recording yeses or nos unless there were three in a row.  And so, you know, I'd need three, like, yeses before I'd say, okay, there's a panda on  camera and then three nos.  And then it actually turned out to be really clever that I, clever, lucky.  It turned out to be really lucky that I was doing one every second because then it just  mapped up perfectly with time.  So if the pandas, the yeses started at position 30, stopped at position 60, I knew from second  30 to second 60, there are red pandas on camera.  And, you know, the final results of this were that it was really, really accurate.  I was really worried at first because when I ran the first video through one that had  been classified by one of the humans, I got different results.  And so it's like, oh, crap.  And so, but then I manually went through and it turned out that the humans had misclassified  it and the machine was smarter than the humans.  And it was cost effective too.  Like it was just some of my time.  But it saved the researchers a lot of money.  Like I think they were looking at buying software like this that was in the name of $20,000 and  software is a service fees each month and all this kind of stuff.  And so this is money that they're going to use to help baby pandas that hopefully they  have to go visit and steal.  So I don't know if projects like this are interested or interesting to all of you.  And I hope they are.  And if they are, I really want to encourage you to come out to Ruby for good.  And this is our logo.  It's a world that's full of love because it's embracing Ruby.  And if you see in the bottom corner of the copyright, that's actually not a copyright.  That's a JW.  That's our shout out to Jim Warwick because we love Jim.  We miss Jim.  We think he the proof of what we're doing.  But to answer what Ruby for good is, it's easier to answer what it isn't.  It's not a bunch of us trying to get together to solve stupid theoretical questions like  this one.  But I guess this one's solved now.  What it is, it's a long weekend, long event where we get a bunch of people like us together.  We start on a Thursday.  We end on a Sunday.  It's all inclusive.  So your food and your room, everything's covered.  And we build software for nonprofits.  People who need our help but would never be able to afford us.  And so I know a lot of you are probably thinking, oh, that's a hackathon.  And it's not.  It's really, really not.  And anytime someone compares it to a hackathon, my soul dies a little bit.  Ours is as much about community and having fun as it is about doing good.  We have a hard stop every day at dinner time.  And we play games in the evening and werewolf and karaoke.  If I could tell you the goals of the event, it's obviously to make the world better.  And it's to learn.  And we have people who come who are brand new beginners to people from GitHub and Digital  Ocean and Optoro.  So it's all a range.  And everyone's going to learn.  It doesn't matter if you are brand new or if you are a senior.  Like because the seniors, they're the people who seem to get the most out of it.  Like a lot of them have never led teams before or if they have led teams.  A lot of times, they get stuck in their ways.  And so they're using certain gems and certain tools.  And then they learn all these new kind of practices from these people who are new to  our industry.  Like maybe just out of boot camp and familiar.  And again, community.  And building community is so important.  And I think it's especially important right now with kind of like the atmosphere we have  in our country right now.  And so like these are some of the places we've helped in prior years.  Like the Portland Everbank, SnapFresh, Habitat for Humanity, the Humane Society.  Like just really great places.  And like this is the Humane Society team.  Like what a great looking group of people.  And one of the great, amazing things about the Humane Society is we get to play with  kittens.  How many room events do you get to go to where there's kittens?  And so again, like there's learning and pair programming and building good stuff.  And again, like community.  We're playing board games here and singing karaoke.  Actually, again, the hammer in this community a bit more because again, I'm in a different  mind space because of all the stuff happening.  So Julian there was singing karaoke late one night with another gentleman named Josh.  And Josh is like from Iron Yard.  And I guess Josh was looking for a new job.  And Julian found that out at like 3.30 in the morning.  So he called up his manager at 3.30 in the morning.  Said, you have to hire this guy.  Now they're coworkers.  Or this guy, Devin.  Who's right there?  So Devin's another one of those amazing young men who you meet this guy and he's like, wow,  I'm so happy I've met him now because in 10 years this guy's going to be amazing.  He's amazing now.  More amazing.  But Devin flew in from San Francisco and when it came time to leave, he didn't get on his  plane.  He stayed in the area.  He just loved the community so much.  And I guess lastly, Adam, get married at Ruby for good.  Or propose, come on.  So these are my 75 new best friends from this year.  And I hope next year you're one of my new 75 best friends.  But enough preaching about Ruby for good.  Kind of broken record on that, I think.  Who's ever heard of an animal called an elephant?  Okay, see a few hands.  So if you've never heard of an elephant, this is an elephant.  Elephants are pretty amazing animals.  They have best friends.  If one's sad, other elephants will comfort them.  But elephants are being poached right now at the rate of about 100 a day.  And actually this is Elizabeth.  Actually, the person's Elizabeth.  The elephant's Ambika.  But Elizabeth, that's the researcher.  She's also working with researchers in Africa on an elephant project that she needs some  help with.  So if someone's interested, I'd love to give more information.  And she's also working on a behavioral app to track red panda data.  And I don't see her here, but Betsy is leading that project.  So if you want to get involved in that.  And there's another project as well.  So please get in touch.  So I know I joke around a lot, but if I can be serious, I guess, for a second.  I know a lot of us are maybe confused or we're kind of hurting right now because of the stuff.  And so many people choosing hate rather than hope.  And we're worried for friends and those of us in maybe vulnerable communities.  And so I know I come up to these events and I give talks on making the world great and  saving the world together.  And that's great in our community.  We love to get together and save the world.  And I feel like that's something I love about it.  But I want everyone to know that it's okay if you leave here and you just save the world  for one person.  And it's especially okay if that one person's yourself.  So I'm not leaving on a downer note.  This is a red panda fighting with a pumpkin.  And they're fighting to a draw apparently.  Keep hoping for them to win, but...  So thank you.  Any questions?  Thank you.  Thank you.
Ruby__Red_Pandas__and_You_0_155.png Ruby__Red_Pandas__and_You_156_215.png Ruby__Red_Pandas__and_You_216_395.png Ruby__Red_Pandas__and_You_396_1883.png Ruby__Red_Pandas__and_You_1884_1931.png Ruby__Red_Pandas__and_You_1932_2051.png Ruby__Red_Pandas__and_You_2052_3539.png Ruby__Red_Pandas__and_You_3540_4055.png Ruby__Red_Pandas__and_You_4056_7055.png Ruby__Red_Pandas__and_You_7056_7127.png Ruby__Red_Pandas__and_You_7128_8255.png Ruby__Red_Pandas__and_You_8256_9263.png Ruby__Red_Pandas__and_You_9264_10679.png Ruby__Red_Pandas__and_You_10680_11771.png Ruby__Red_Pandas__and_You_11772_12599.png Ruby__Red_Pandas__and_You_12600_14495.png Ruby__Red_Pandas__and_You_14496_16187.png Ruby__Red_Pandas__and_You_16188_18419.png Ruby__Red_Pandas__and_You_18420_20651.png Ruby__Red_Pandas__and_You_20652_21011.png Ruby__Red_Pandas__and_You_21012_21779.png Ruby__Red_Pandas__and_You_21780_21911.png Ruby__Red_Pandas__and_You_21912_30491.png Ruby__Red_Pandas__and_You_30492_30707.png Ruby__Red_Pandas__and_You_30708_37247.png Ruby__Red_Pandas__and_You_37248_37523.png Ruby__Red_Pandas__and_You_37524_37751.png Ruby__Red_Pandas__and_You_37752_37931.png Ruby__Red_Pandas__and_You_37932_38063.png Ruby__Red_Pandas__and_You_38064_38267.png Ruby__Red_Pandas__and_You_38268_38555.png Ruby__Red_Pandas__and_You_38556_39035.png Ruby__Red_Pandas__and_You_39036_39995.png Ruby__Red_Pandas__and_You_39996_40211.png Ruby__Red_Pandas__and_You_40212_41015.png Ruby__Red_Pandas__and_You_41016_41447.png Ruby__Red_Pandas__and_You_41448_44039.png Ruby__Red_Pandas__and_You_44040_44195.png Ruby__Red_Pandas__and_You_44196_44230.png