Welcome to my SO_Handler project

Please take a look at the existing github repoopens in new tab for this project.

I started this project in February of 2018, got busy with other things, and recently started revisiting it some. Right now I am pretty happy with everything except the R-CNN (though I think it's close). I am interested in maybe building a Gated LSTMopens in new tab But will probably wait until I have a job to train this Neural Net much more, I'm starting to run out of AWS credits and want to build a Deep Learning computer at some point in time, but those look like they'll run me about $1000-$2000.

Anyways, this does a few things:

  1. Pulls an image of a dog from Flickr
  2. Generates a text snippet via an R-CNN model (with LSTM) trained on Terry Pratchett's Thief of Time
  3. Puts these together in an email and sends it to the email address I give it

example email

As you can tell, I took this picture with text generated from an old model. I was originally going to generate love poems with this, but I decided that Terry Pratchett was a better use of everyone's time.

The email is sent by running a program which calls a the different parts and sends them to a function that builds the email. First it makes a Terry Pratchett text snippet from the RCNN. I have 4 LSTM Layers, with a 50% dropout after every epoch. It took about 51 epochs to start getting good results - I want to train it for about 50 more, I'll probably work on that soon.
  Because I'm training the model on AWS and wanted to monitor the model's progress, I added an email function. I train the model for a single epoch (loading the data in takes a significant minority of the training time), save the model and predict on some randomly pulled text from the training set. This text is then sent to my email so I can see it from my phone. I also get the epoch number the model is on.

It then pulls an image from Flickr. Flickr has an API that lets you pass tags to it and get images back. I'm going to be honest, I read just enough to get this working and there might be better ways to do this. I have the tags set to shuffle, but it always pulled the last one I had in my list (Border Collies fwiw), so I shuffle the list of tags every time I call the flickr_scraper. I also wanted to make sure I sent original pictures. To do this I made a text file called "sent_images.txt" and save the Flickr picture name to this file. I then pull a picture and make sure it's name is not in the file.

Next I pass everything to the email function I built. This builds and sends an email using MIME and an opened Gmail account. I made this pretty flexible as I can see myself using a basic python emailer pretty regularly.

Overall I'm pretty happy with the results. I want to add something to my bash that will call the main.py script every day at, say, 12pm.

EDIT: It looks like scheduleopens in new tab can do this well. I'll have to look into that more soon.