I looked into Twitter. Too many privacy issues I didn’t want to deal with. I will be developing a website. Will post here when it’s done.
Hey where did you find the data set and does those image have the categorized names already so that you can use the regular expression like lesson 1?
Please don’t tag Jeremy unless it’s absolutely needed (it’s in the forum rules).
Having said that, it looks like your model is recognising Slices for its classification. Weird
Interesting @avinash3593 - it feels like it is scanning from top to bottom and sticking with what it finds first. I’d be keen to know what your other tests reveal.
I’m working on fake news classification based on lesson3-imdb.ipynb. I’ve run a few variations on it but now am trying a Kaggle dataset augmented with some additional fake news articles. Now I keep hitting this error when trying to tune the classifier:
learn_c.lr_find()
LR Finder is complete, type {learner_name}.recorder.plot() to see the graph.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-41-a7eaf4cbd03b> in <module>
1 # 2019-02-17 12:43:53
----> 2 learn_c.lr_find()
/opt/anaconda3/lib/python3.7/site-packages/fastai/train.py in lr_find(learn, start_lr, end_lr, num_it, stop_div, **kwargs)
29 cb = LRFinder(learn, start_lr, end_lr, num_it, stop_div)
30 a = int(np.ceil(num_it/len(learn.data.train_dl)))
---> 31 learn.fit(a, start_lr, callbacks=[cb], **kwargs)
32
33 def to_fp16(learn:Learner, loss_scale:float=512., flat_master:bool=False)->Learner:
[snipped out]
/opt/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py in batch_norm(input, running_mean, running_var, weight, bias, training, momentum, eps)
1424 size = list(input.size())
1425 if reduce(mul, size[2:], size[0]) == 1:
-> 1426 raise ValueError('Expected more than 1 value per channel when training, got input size {}'.format(size))
1427 return torch.batch_norm(
1428 input, weight, bias, running_mean, running_var,
ValueError: Expected more than 1 value per channel when training, got input size [1, 1200]
I initially thought it was the lr_find function itself, but lr_find works fine when I build the language model before the classifier, so this seems related to the data I’m using for data_clas, which is a subset of the full dataset (to get a balanced ds for data_clas).
I have no idea what the the err message (ValueError: Expected more than 1 value per channel when training, got input size [1, 1200]) means, so I’m hoping one of you does! I snipped out most of the traceback to be more concise here but please let me know if it’s needed…
lr_find runs all the way to the end (showing 99+ % completion, and note the first line saying it completed) and then throws this error, if that clue helps any.
thanks!
Pls check this tweet out and the link:
Haven’t read the work in detail, but it seemed to say bees can be trained to do math! I thought of your counting neural net.
I will be trying next with more images and from different classes. I didn’t yet look into the activations at the end of the network. Will try these things next and post an update.
Following lesson 2, I created in a kaggle kernel a classifier for horse breed colors. There are 4 classes: palomino, buckskin, pinto, white. My overwhelming experience so far is that of the importance of having a quality dataset.
I had to massively clean the data as there was a lot of noise: images of toys or other non-horse items (white horse inn for example), of objects with horses on them, multiple horses of different colors on the same image, watermarks, parts of horses, light which makes it hard to see the color of the horse, mixed breeds, etc. Still, the resulting dataset is not completely clean.
I was able to get an error rate of 8%.
I found using a smaller batch size worked better to avoid overfitting (not clear exactly why).
I also found I tended to get different results every time I trained, I guess because of randomness.
What did not work was unfreezing and trying to train a bit more as I was not able to get a lower loss.
I suspect in the end I did not have enough data (about 130 of each class in the training set after cleaning) and that data was too heterogeneous.
The data is organized in the imagenet folder structure, but I created a script to parse it into train/test sets. I belieev I linked to the site I got the data from in the original post
I recently published my first medium article the matrix operations done under the hood in GRUs(choosen because of a project I’m working on). The links to detailed notebook on GitHub is included in the post.
I just finished my first model and am really happy with it–recognizing keystrokes on a laptop using only the microphone. Stoked about fast.ai and its incredibly robust framework that allowed me to get 92% accuracy on these 63 classes with just a few hours of gradient descent.
I’m using Kaggle kernels, but I can’t figure out how to download/upload my resnet weights to avoid losing all the work after 6 hours. If you know how, could you drop me a hint? Also, looking for fast.ai friends in Boston, if anyone wants to get coffee!
On to my next project…
Also, does anyone know if there is a resnet with pretrained weights for spectrograms, ala model zoo? They seem sufficiently different from normal images that unfreezing the whole model is the best strategy, but they seem quite similar to each other, and there could probably be a useful set of low-level layer weights that could be consistent and transfer-learnable.
If you know of one, could you point me towards it?
If you know there isn’t one, do you want to work with me to create it?
Poisonous plants are dangerous for unsuspecting individuals such as children. Especially the plants that are common in backyards. There are many casualties due to lack of supervision of gardens in public and private areas.
One solution to this problem is image classification using deep learning. Keeping this in mind I made a custom data set of the poisonous plants that are common in our home area. I got a list of these from here:
I have made the data set available on Kaggle:
https://www.kaggle.com/nitron/poisonous-plants-images
Using fastai, I have successfully created an Image classifier for classifying a plant’s image into 8 categories of poisonous plants. The classifier have 98% accuracy on the current data set. Here is the Kaggle kernel:
https://www.kaggle.com/nitron/poisonous-plant-classifier
This is one of the first step towards the solution. Next I will make a web app for demonstrating the capabilities of the current model.
Any helpful tips are welcome 
I just finished my first model and am really happy with it–recognizing keystrokes on a laptop using only the microphone.
Nice! Did you collect that data yourself? How well does it generalize? Does it matter where the microphone was compared to the keyboard? Does it work with multiple keyboards or just the one the sounds were recorded from?
Thanks for your interest!
I did collect the data myself: 30 minutes of data, ~6000 keystrokes, soft and loud strikes, no background noise, single channel input, from built-in microphone on a single MacBook Pro, accuracy reported from validation set (20%). I would bet that the fixed distance from mic to each key was important in classification (but I am not certain–could be answered by mapping the confusion matrix to physical distance between keys).
I imagine potential opportunities for improvement to be: introduction of background noise, generalization to other laptops, complex keystrokes (e.g. cmd+c), event extraction from continuous input.
I’m happy to share it with anyone who wants a copy!
Identifying hockey team - sorry for the duplicate post on the main form.
Here’s my weekend(s) attempts at using fastai in identifying hockey teams based on their jerseys.
The model was trained, and the project hosted on Floydhub who graciously donated some CPU cycles until I find a more permanent home. I’ve tried heroku but the slug size is a major limitation - so suggestions are welcomed.
PS: I’m personally a soccer fan - but soccer jerseys change quite frequently and would’ve been harder to train on.
Hi Dipam7,
I too participated in this and got a score of 0.9557. I was in place 15 when I posted and now have moved down to 20. Try as much as I could, I am not able to get a better score than that. Lets compare notes…
Suresh
This is very interesting project! Did you have a link to your Kaggle kernel?
Hi Jona,
Interesting application! Can you share the confusion matrix? I am curious to know whether the model got confused with keys that are equidistant from the mic.
Suresh
I wanted to come up with a segmentation problem to practice the topics covered in Lesson 3. After a bit of thought I realized I had a dataset from work that could be adapted pretty easily.
I work for a company that makes games. We have about 5000 images of creatures in front of the egg they hatched out of that look like this:

For a significant number (~3500) of them we also have a matching “Who’s that Pokemon” style image that looks like this:

Unfortunately, we have lost the source files for many of the 1500 images that are missing the outlined version so it’s not easy to separate the creature from its egg (or to generate a “Who’s that Pokemon” style image with the creature and its egg in different colors).
Well, this looks a lot like a segmentation problem! If I can train a model to classify which parts of the image are “background”, “creature”, and “egg” then I can use the generated masks to extract the creature from the background image and to create “Who’s that Pokemon” style images for the part of the dataset that is missing them. In fact, the segmentation mask is a pretty close approximation for what the “Who’s that Pokemon” style image would look like!
I used the lesson3-camvid notebook as a jumping off point. And, after a full day of work, I’ve now got a model that correctly predicts about 97% of the pixels.
Example image input:

Example output from the validation set (ground truth / model output):
You can see there are a few detail areas in the image that it doesn’t quite get right (whiskers, between the neck and the paper, around the base of the tail) but it looks pretty good in most cases!
There are also some for which it really doesn’t do well (I think it’s largely due to there not being enough similar training examples). Here’s one such example:
This particular image comes from a set of creatures that come out of balloons instead of eggs. Here was the input image the model was going off of (the drop shadow also made things a bit hard for it I think):

The hardest part was getting my images to conform to the format that fastai was expecting. The original source images had a 4th channel (alpha transparency) and also had lots of transparent pixels that contained extraneous data in their RGB channels that was invisible due to the alpha channel. And the mask images had anti-aliasing and an alpha channel which had to be removed.
I had a lot of trouble making those be transformations that happened on the fly (independently transforming the x & y images doesn’t seem to be supported in fastai yet) so I ended up running the transforms up front and outputting them to disk before training my model.
I may try to put together a pull request that will make this process of adding independent custom transforms easier for people in the future (it looks like fastai v0.7 may have supported it with an is_y param passed to the transform function). But there’s a bit more to do than that because the masks are already being shrunk to a single channel prior to the transformations being run.
Edit: I now got a chance to try it on some of the images where we’re missing the “ground truth” to see how it does.
In some cases it does really well!

Unfortunately, in some of our older images, the input images aren’t styled the same way… turns out that one of the things our model learned is about the layer style applied to our images (the egg has a semitransparent white overlay over it in all of the training data). So on the old ones without this it predicts all “creature”



