Share your work here ✅

just finished lesson 2, I made a simple Coriander/Parsley Classifier:

2 Likes

Hello everyone, I wanted to share my work for a cube cilinder classifier. Nothing too fancy but i enjoyed doing that, awesome course. Although i found that the probability the model provides for a rubic’s cube test classification is too low. And was surprised that it actually identified my charger that is cube shaped with more confidence as a cube.

Thanks :slight_smile:

4 Likes

I tried using this git repo for retinanet model made in fastai , but it doesn’t works.

from pytorch_grad_cam import GradCAM, HiResCAM, ScoreCAM, GradCAMPlusPlus, AblationCAM, XGradCAM, EigenCAM, FullGrad
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
from pytorch_grad_cam.utils.image import show_cam_on_image
from torchvision.models import resnet50

model = learn.model
target_layers = [model.classifier]
input_tensor =image.data # Create an input tensor image for your model..
# Note: input_tensor can be a batch tensor with several images!

# Construct the CAM object once, and then re-use it on many images:
cam = GradCAM(model=model, target_layers=target_layers, use_cuda=False)

# You can also use it within a with statement, to make sure it is freed,
# In case you need to re-create it inside an outer loop:
# with GradCAM(model=model, target_layers=target_layers, use_cuda=args.use_cuda) as cam:
#   ...

# We have to specify the target we want to generate
# the Class Activation Maps for.
# If targets is None, the highest scoring category
# will be used for every image in the batch.
# Here we use ClassifierOutputTarget, but you can define your own custom targets
# That are, for example, combinations of categories, or specific outputs in a non standard model.

targets = [ClassifierOutputTarget(1)]

# You can also pass aug_smooth=True and eigen_smooth=True, to apply smoothing.
grayscale_cam = cam(input_tensor=data.valid_ds[0][0].data.unsqueeze(0), targets=targets)

# In this example grayscale_cam has only one image in the batch:
grayscale_cam = grayscale_cam[0, :]
visualization = show_cam_on_image(data.valid_ds[0][0], grayscale_cam, use_rgb=True)

ERROR:

RuntimeError                              Traceback (most recent call last)
<ipython-input-162-e2230a3a31bf> in <module>
     27 
     28 # You can also pass aug_smooth=True and eigen_smooth=True, to apply smoothing.
---> 29 grayscale_cam = cam(input_tensor=data.valid_ds[0][0].data.unsqueeze(0), targets=targets)
     30 
     31 # In this example grayscale_cam has only one image in the batch:

4 frames
/usr/local/lib/python3.8/dist-packages/pytorch_grad_cam/base_cam.py in __call__(self, input_tensor, targets, aug_smooth, eigen_smooth)
    186                 input_tensor, targets, eigen_smooth)
    187 
--> 188         return self.forward(input_tensor,
    189                             targets, eigen_smooth)
    190 

/usr/local/lib/python3.8/dist-packages/pytorch_grad_cam/base_cam.py in forward(self, input_tensor, targets, eigen_smooth)
     82             loss = sum([target(output)
     83                        for target, output in zip(targets, outputs)])
---> 84             loss.backward(retain_graph=True)
     85 
     86         # In most of the saliency attribution papers, the saliency is

/usr/local/lib/python3.8/dist-packages/torch/_tensor.py in backward(self, gradient, retain_graph, create_graph, inputs)
    361                 create_graph=create_graph,
    362                 inputs=inputs)
--> 363         torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
    364 
    365     def register_hook(self, hook):

/usr/local/lib/python3.8/dist-packages/torch/autograd/__init__.py in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs)
    164 
    165     grad_tensors_ = _tensor_or_tensors_to_tuple(grad_tensors, len(tensors))
--> 166     grad_tensors_ = _make_grads(tensors, grad_tensors_, is_grads_batched=False)
    167     if retain_graph is None:
    168         retain_graph = create_graph

/usr/local/lib/python3.8/dist-packages/torch/autograd/__init__.py in _make_grads(outputs, grads, is_grads_batched)
     65             if out.requires_grad:
     66                 if out.numel() != 1:
---> 67                     raise RuntimeError("grad can be implicitly created only for scalar outputs")
     68                 new_grads.append(torch.ones_like(out, memory_format=torch.preserve_format))
     69             else:

RuntimeError: grad can be implicitly created only for scalar output

Does anyone know what is going wrong here, for input tensor i passed data.valid_ds[0][0] which is fastai type image which i later convert to tensor, using .data, if i remove unsqueese it throws dimension error.
Thanks for help.

1 Like

My Mind Map notes of the Machine Learning course.
I summarized some general ideas along with some useful technicalities.
I am planning to post more Mind Maps of the Practical Deep Learning courses too.

1 Like

Hey everyone! Although I did deploy a dog/cat classifier, I wanted to highlight a blogpost I wrote on starting journey into deep learning. The post is inspired on videos and articles recommended through the fastai ecosystem.

2 Likes

Hello Everyone!
Currently working through the final lesson in Practical Deep Learning for Coders 2022 and thought… hey, it might not be a bad idea to step out of my comfort zone and share a couple experiments from earlier in the course.

Not sure whether the Honda you stumbled across was an Accord or a Civic? This image classifier (quite literally) does exactly that! Feel free to test it out next time you’re on a stroll. :oncoming_automobile:

To practice training models on other image datasets (as well as find new recipes…), I found this dataset on kaggle and trained an Indian Food Classifier! Apologies in advance if it makes you hungry. :drooling_face:

7 Likes

Hey everyone! I’ve implemented simple facemask detector using fast.ai tools and fine tuning. Then, deployed it on hugging face: FacemaskDetector - a Hugging Face Space by BMukhtar

3 Likes

Hello fellow FastAI’ers, wanted to share my Kaggle notebook I submitted for Spaceship Titanic competition.

  • My reference for creating above notebook is “Why you should use a framework”.

  • My public score is 0.779 for this submission, which is impressive given that I haven’t implemented any feature engineering etc.

  • Some of the other notebooks on this competition submitted used extensive analysis based on Random forest, decision trees, Naive bayes (which left me awestruck as a beginner that there is so much to learn) to get score of 0.725.

  • With my submission I am convinced the power of using framework and why I should use it.

Thanks! @jeremy for this awsome course. On the “Road to the top” and to “Finish the damn course”.

Regards

2 Likes

Hi everybody, I am starting the 2022 version of the course. I made a F1 car VS Car classifier as the F1 season is about to start. It’s not great but it was good fun.
I am starting the course again and hopefully I would be able to finish it this time and not get overwhelmed about the how and why and everything in between

1 Like

!!! Update !!!

  • In second iteration, I used a very simple feature engineering - splitting Cabin into its components as separate categorical features - “Deck”, “Num” and “Side” (see details in Data section of the Spaceship Titanic competition).
  • This slightly improved my score from 0.77928 to 0.78816 and with further experimenting with no. of layers, learning rate etc. to 0.78466.
  • In third iteration, on top of synthetic features, I experimented with “Ensembling” which further enhanced my score to 0.79331
  • Given that at the time of my last submission, top 5th score is ~ 0.818, I could achieve a pretty good score thanks to the power of using a framework.
  • More important than score for me at this stage is probably the gain in confidence and motivation this outcome gives me to test my understanding beyond “Getting started” competition on Kaggle.
3 Likes

Hey everyone!

I just published my first post on “Is Apple fruit rotten?” - a deep learning based mini project inspired by lesson 1 of Practical Deep Learning for Coders. I would love to get your feedback on it!

If you have a few minutes to spare, please check it out and let me know what you think. Your comments, suggestions, and feedback will help me improve and create better content in the future.

Thanks in advance for your time and support!

3 Likes

Hey @glunkad I really like how you structured your github pages! The article flowed very nicely especially when you mentioned some applications towards the end. I think another step is to show the confusion matrix, since it’s a classification model, this visual ties in the overall performance of the model to readers who aren’t familiar with machine learning. Another step could be to mention your data preprocessing choice within your datablock. I see you chose squishing your image, maybe mention some alternatives or additional preprocessing steps you could take.

1 Like

Hello @montanoj14 ,
I just wanted to express my gratitude for taking the time to review my post and providing valuable feedback. Your suggestion to include the confusion matrix is very helpful as it would give readers a clear understanding of the model’s performance. I also appreciate your suggestion to mention the data preprocessing choice within the datablock, and to discuss alternative or additional preprocessing steps that could be taken.

I’m grateful for your thoughtful feedback and I’m excited to implement these changes to improve the overall quality of my work. Thank you once again for your time and input.

Best regards

1 Like

Built my first model after taking the course! Hope to build from here. Any suggestions on how to make it better?

Here is the notebook, its theme: Get quality data

2 Likes

I followed Jeremy’s suggestion on building a classification model for Picasso’s paintings…

Nice meeting y’all!

1 Like

Hello. I’m proud to announce my new startup, What’s-a My Pasta?

Through the transformative power of artificial intelligence, modern technology can now distinguish between 10 different pasta types, both cooked and uncooked!

3 Likes

I participated recently in my first competition: aiornot hosted by Hugging Face. The competition ended today and I’m very happy (and proud) that I finished 15th out of 98 participants. I wrote a little write-up on my blog.

I started with fastai about a month ago, it’s really great to see how much one can learn from fastai. Thanks so much @jeremy :pray:

9 Likes

I adapted Lesson 4 of this course to solve a real-world matching problem for an insurance client!

Here’s my blog post on it:

6 Likes

Wow, that’s super impressive! Congrats on your win!

2 Likes

Great job! :smiley:

2 Likes