Share your V2 projects here

I wrote a visualization callback! This appears in the Appendix of a 2-part post comparing traditional classification systems with contrastive loss systems:

vizpreds_preview

11 Likes

lightweight :muscle::dart::muscle:

demo_outpuput

Squat detector using image classification… looks complicated but is actually surprisingly straightforward

  1. I spent a long time trying to make this train on the regular unprocessed images from my webcam feed – it didn’t work (!)

  2. The whole secret to training this network so simply and so quickly (which I eventually figured out…) was to use an intermediate network – in this case AlphaPose, a paper from 2018. It was SOTA and detects human poses and draws these colorful lines between the nodes.

  3. As soon as the resnet34 was looking at the colorful pose outputs instead of the raw images, it converged within a handful of epochs. It was amazing to realize the power of stacking these networks together.

Dataset:

I literally just built my own dataset by taking a couple of videos and extracting noteworthy frames then uploaded them to labelbox.com.

I manually labelled them into 6 categories (took me about 1 hour…) the whole thing is free – and also the entire dataset was only 195 images.

18 Likes

I wrote a transform block for an object detection task that has only one class. Since there’s only one class, I don’t need any classification or labeling on the bounding box. I didn’t get this working out of the box with the fastai applications level API, but once I more deeply learned the transform system, I was able to figure it out. Sharing it here in case it’s useful for someone else:

from fastcore.transform import *
from fastai.data.all import *
from fastai.vision.all import *
from fastai.test_utils import synth_learner
import pandas as pd
from pathlib import Path
from nbdev import show_doc
import os
from chessocr import *

#export
class NoLabelBBoxLabeler(Transform):
    """ Bounding box labeler with no label """
    def setups(self, x): noop
    def decode (self, x, **kwargs):
        self.bbox,self.lbls = None,None
        return self._call('decodes', x, **kwargs)

    def decodes(self, x:TensorBBox):
        self.bbox = x
        return self.bbox if self.lbls is None else LabeledBBox(self.bbox, self.lbls)

#export
class BBoxTruth:
    """ get bounding box location from DataFrame """
    def __init__(self, df): self.df=df
        
    def __call__(self, o):
        size,x,y,_,_,_,_=self.df.iloc[int(o.stem)-1]
        return [[x,y, x+size, y+size]]

#export
def iou(pred, target):
    """ Vectorized Intersection Over Union calculation """
    target = Tensor.cpu(target).squeeze(1)
    pred = Tensor.cpu(pred)
    ab = np.stack([pred, target])
    intersect_area = np.maximum(ab[:, :, [2, 3]].min(axis=0) - ab[:, :, [0, 1]].max(axis=0), 0).prod(axis=1)
    union_area = ((ab[:, :, 2] - ab[:, :, 0]) * (ab[:, :, 3] - ab[:, :, 1])).sum(axis=0) - intersect_area
    return (intersect_area / union_area).mean()

#export
NoLabelBBoxBlock = TransformBlock(type_tfms=TensorBBox.create, 
                             item_tfms=[PointScaler, NoLabelBBoxLabeler])

data_url = Path.home()/".fastai/data/chess"
df = pd.read_csv(data_url/'annotations.csv', index_col=0)
block = DataBlock(
    blocks=(ImageBlock, NoLabelBBoxBlock), 
    get_items=get_image_files,
    get_y=[BBoxTruth(df)],
    n_inp=1,
    item_tfms=[Resize(224)])

dls=block.dataloaders(data_url, batch_size=64)

dls.show_batch(max_n=9, figsize=(8, 8))
9 Likes

Hi lukew hope all is well!

Great use of available papers, not only practical, but amusing as well. This could be used a basis for many other exercises.

Great work.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

If any one wants to play around with the SIIM-FISABIO-RSNA COVID-19 Detection competition on Kaggle you could start with this notebook

2 Likes

First blog post… inspired by fastai.

I have a project at work where I train a model weekly in production, but need to run predictions every 4 hours or so. The SQL queries to get updated data can be complicated and errors upstream can happen frequently, which means that data integrity is compromised, and accuracy goes down in real life.

I wrote a process grab 10k random records from my training data, unioned with 10k records of my “live” data… and if I can build a simple model in BQML to detect if a record is from train or from ‘live’, then I have a data issue and I fail the process.

Please let me know any feedback or thoughts! thanks!

7 Likes

Does it tell you if you hit depth in your squat though :stuck_out_tongue_winking_eye:

3 Likes

I’ve just finish setting up my blog about this project.

The app which I made above, is embed in the home page which I think is very interesting that we can integrated our app (using render or Voila for example) in our blog using fastpage

I also wrote a first blog about classification sound using Spectrogram image.

Hope you find it interesting,

2 Likes

Hi @pratikskarnik, the link says it is deleted.

Hi Romandovega hope all is well!
Thanks for wonderfully, clear concise and practical post.

Cheers mrfabulous1 :smiley: :smiley:

Hi @all. Hope all of you are doing great.
I am working on crypto -price prediction model, and trying to use sentiment analysis for news and tweets, to make the model better.
It would be great if someone is interested in this project, or can suggest me any helping material.

Thanks…

Hi! I wrote a Medium post about running a model trained by using FastAI on Android (natively) by using Pytorch Mobile.
(It’s easily adaptable to works on iOs)

It’s pretty straightforward but maybe it helps someone without a very deep understanding or maybe it helps to spread the existence of Pytorch Mobile.
The code of the notebook where I trained the model and the app is fully available on: GitHub - mariano22/fastai-android-demo: How to run pytorch model trained with FastAI in Android app

4 Likes

Great Job! :grinning: :grinning:

Sharing my first steps in DL using Fast.ai, to encourage other beginners in their own journeys.

This is particularly helpful if you found the installations difficult to follow.

Congratulations for taking your first steps! :slight_smile:
Maria

2 Likes

This blog is a fruit of the learnings from Lesson 05 on Image Classification.

It elaborates on the DataBlock, batch augmentation, learning rates, and using a series of fits vs fine_tuning. I used the delicious FOOD dataset.

I find that the best way of learning is getting your hands dirty, so dive in!

Maria

Hey everyone

I wrote a python library for molecular design using machine learning. There’s a mix of generative models, reinforcement learning and computational chemistry. If you’re interested check it out

3 Likes

Hi guys, for those just starting to venture out. This might help you in creating your own dataset.

Using a Kaggle dataset wasn’t as straight-forward as I initially thought. Here’s my experience in bridging the dataset from Kaggle to Colab and using it for Computer Vision techniques.

1 Like

Hi guys,

Just sharing a blog post and web app - I am only 2 lessons in but thought I will put something together of my journey so far. Its a walkthrough of an end to end implementation of an image classifier built on fastai using flask and node js.

Here is the link to the web app - https://radiant-dusk-43609.herokuapp.com/

1 Like

Part 1 focuses on image tensors, filters and the convolution process.

2 Likes