Often I find myself feeling burdened by the slow progress I’m making in my Deep Learning journey… but I kept that aside for a bit to write up some thoughts, insights, handy todos and setup guides for the non-geeks trying to do Deep Learning:
Special thanks to @jeremy and @rachel - your positive influence made this possible.
Also thanks to @wgpubs, @hiromi and @rob for their posts on vim setup for fastai. I built on their inputs to get my setup guide going.
I treat the activations from late in the network as an embedding for the names and use it to find “similar” names using the distance in this embedding space. It doesn’t perform fantastically, but is a useful proof of concept for better performing models on more complex tasks.
Using a balanced training set (which means including objects from rare cases multiple times) gives a much better result on a balanced validation set (with an equal number from each class). The full training set gives ~30-40% accuracy where the balanced set gives ~60-70%.
The default fast.ai text classification model works really well in this context without tuning. This is pretty astounding given it was tuned for word-level tokens.
Embeddings give much better results than one-hot encoding the inputs (the fast.ai text classification does this for you)
I’ve created this tool Code with AI which tries to solve a problem I used to face, that is while taking part in a competitive programming competition I sometimes wished for something which would tell me (or give hints) as to which competitive programming concept will be used to solve that problem!
Thanks to @jeremy and fast.ai, I have been able to solve this problem!
Some details about the current model: It solves this multi-classification problem, with >80 different classes of problems, with an unbalanced factor of ~100 and uses pretrained wikitext103.
The current model has an F1 score of ~49 and I’m thinking of improving it further by using bidirectional RNN and an approach similar to DeViSE paper, i.e instead of training the model to predict O or 1, train the model to go closer towards the embedding vector representation of labels - the intuition behind this is that labels in competitive programming like graph, dfs, bfs etc aren’t disjoint. Will share the results I get with that approach.
I had never participated in any machine learning hackathons, with fastai tabular and i made an attempt and participated in 2 hackathons where i secured rank 152 and rank 31 respectively, although first hackathon i did’nt include all the tables of training data.
I wanted to know what more could have been done like any data manipulation steps or different architecture of NN or any other suggestions about going on with tabular data.
I was able to deploy my model (resnet-34 trained on Plant Village dataset) on render, it’s super fast and super easy like fastai. all thanks to @anurag
The dataset has questions from codechef and codeforces. I tested the tool from questions from hackerrank as well, it seemed to work. Also, I’d put up a blog post on codeforces to see how it goes, and have received positive response from the community.
Thanks Jeremy, that makes sense, so I went back and read more text samples, since I recalled seeing some where the source was mentioned. There’s no field for the article source, and the model only sees the article text, so I looked for the news source (or something related) showing up in the text. Turns out there aren’t many of those - maybe 5%. Most are “clean” in not having any markers that I could see.
But I looked deeper into the dataset heritage and it was (in my opinion) a bit flawed, partly because it was labelled based on the article source (website) and not on the actual content. McIntire used a Kaggle fake news dataset (https://www.kaggle.com/mrisdal/fake-news) from 2016 for his ‘fake’ records and AllSides (https://www.allsides.com/unbiased-balanced-news) to scrape articles for ‘real’ records. The Kaggle ds was in turn based on a Chrome add-in, BS Detector (https://bsdetector.tech/) which in turn was based on classification of online sources by OpenSources (http://www.opensources.co/) which actually has 12 classes. The Kaggle ds used the most ‘fake’ websites to collect articles with 8 classes, and McIntire simplified the labelling into just FAKE, which I think is a bit misleading (e.g., that includes the ones labeled ‘satire’).
I think it’s misleading to judge that an article is fake strictly because of its source, and reading some ds samples bears that out: there are quite a few records where the article content seemed fine to me (and I’m pretty skeptical in general) but it was classified as fake.
But all that said, it still looks to me like the model works amazingly well at classifying McIntire’s dataset. Because I consider the labeling to be biased and too simplistic, I don’t think this should be used for a real-world application, but it was a good learning experience, and I’m planning to move on to trying the full Kaggle ds. But I would appreciate any other feedback or suggestions!
I have only tried to summarize important points from relevant papers. Just like a bookmark, if you want to refer a certain paper in the future, but instead of reading it through its entirety, you could come here and go over the summarized version.
Please do let me know what you think and also mention other relevant papers that you would like to see here.
Update on this. I made some modifications to the model and deployed it to AWS. The main thing I changed about the model was the dataset used. It turns out when you train an image generation model on images of pets, it starts to make everything look a little furry. Instead I used a subset of the Open Images dataset.
I got the model up and running on AWS. @pankymathur’s code was helpful in figuring out returning an image. Although I still manage the process by saving the model output as an image and serving it with html, which I am not sure is optimal. I’m planning on doing a write up of the whole process at some point.
I made a couple of text generators following the model of lesson 3 IMDB – one is trained on the complete works of Jane Austen and the other on Trump’s tweets from 2009-2018. They are both online, the first at https://deepjane.now.sh/ and the second at https://deepdonald.appspot.com/. The second is powered by Google App Engine. In case it helps anyone in the future, I had a lot of trouble getting the app working on GAE (I ran into errors even with the starter code) but ended up able to deploy successfully after building the Docker image locally (and trying over and over a bunch of times).
They are also on twitter! Jane is @AutoAusten and Donald is @RNN_DonaldTrump. They tweet periodically by themselves, but you can also @ message them a few words and they’ll (hopefully) respond with a tweet beginning with your message. If you try them and don’t get a response, please let me know! I’ve been working out the bugs but fear there are still some lurking around.
Currently working on a Medium post about the experience.
Good one Karl, just tried uploading few thumbnails and output resolution images were great, IMHO App and website look great . you can surely enhance and optimize it in future, depending upon traffic and heavy production loads, so keep up the good work
I did an object detection problem that finds the center of a phone in an image using Fastai v1 and the Datablock api. The link to it on my github is here.
One of the challenges I had was making a custom collate function for single image points, as Fastai only has one function for bboxes in the vision library. Having it work though made a huge difference in my accuracy as I only had ~115 images to work with.
I made a basic snake classifier as a small project. The first and only goal of the initial part was to prove if it could readily distinguish between a very common confusion of copperhead (venomous) and corn snake (harmless). Result was it could do so rather easily and got to 100% quickly with all three models (resnet, vgg, etc). I wrote an article on it to help promote FastAI here:
Now I’m working on adding a number of other snakes (garter, rattlesnake, etc) to try and expand it into a fuller snake classifier where people could just easily upload a photo and get a classification for most snakes in the US and ideally other countries over time.