Questions tagged [fast-ai]

Fastai is a deep learning library for Python. It is built on top of PyTorch, and provides high level API to various common deep learning applications and data types.

Fastai is a deep learning library for Python. It is built on top of PyTorch, and provides high level API to various common deep learning applications and data types. For more information see: https://docs.fast.ai or https://github.com/fastai

433 questions
7
votes
1 answer

How to get predictions and calculate accuracy for a given test set in fast ai?

I'm trying to load a learner which was exported by learn.export() and I want to run it against a test set. I want my test set have labels so that I can measure its accuracy. This is my code: test_src = (TextList.from_df(df, path, cols='texts') …
Ahmad
  • 8,811
  • 11
  • 76
  • 141
6
votes
1 answer

fastai.fastcore patch decorator vs simple monkey-patching

I'm trying to understand the value-added of using fastai's fastcore.basics.patch_to decorator. Here's the fastcore way: from fastcore.basics import patch_to class _T3(int): pass @patch_to(_T3) def func1(self, a): return self + a And…
SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
6
votes
1 answer

fast.ai not using the GPU

When I run training using fast.ai only the CPU is used even though import torch; print(torch.cuda.is_available()) shows that CUDA is available and some memory on the GPU is occupied by my training process. from main import DefectsImagesDataset from…
Tom Dörr
  • 859
  • 10
  • 22
6
votes
2 answers

fastai tabular model - how to get predictions for new data?

I am using kaggle house prices dataset, it is divided into: train and test I built a model with fastai tabular using train set How can I predict values for test data set? I know it sounds easy and most other libs would do it like…
Oleg Peregudov
  • 137
  • 2
  • 8
6
votes
2 answers

Applying transforms to fastai v2 vision

In fastai v2 i am trying to add image augmentations So tfms = aug_transforms(do_flip = True, flip_vert=True, max_lighting=0.1, ) data =…
Rajan Lagah
  • 2,373
  • 1
  • 24
  • 40
6
votes
1 answer

Fastai - failed initiation of language model in Sentence Piece Processor, cache_dir parameter

I've been already browsing web for hours to find a solution for my, which i believe so might be a pretty petty issue. I'm using fastai's Sentence Piece Processor (SPProcesor) at the very first steps of initiation of a language model. My code for…
Slonecznik
  • 61
  • 2
6
votes
1 answer

Mask values in segmentation task are either 0 or 255. How do I resolve this?

I must be getting something terribly wrong with the fast-ai library, since I seem to be the only one having this problem. Everytime I try the learning rate finder or training the network, it gives me an error. It took me a week to produce this…
mjwock
  • 63
  • 5
6
votes
1 answer

fastai - Multiclass metric for Image Segmentation

I’m currently exploring how to apply Dice metric to a multiclass segmentation problem with fastai. I checked the concepts and discovered that Dice is really similar to the F1Score. Following this, I have two questions regarding their implementation…
6
votes
0 answers

"Can't get attribute 'ImageList'" using FastAI and PyTorch

Version Numbers: torchvision: 0.3.0 torch: 1.1.0 fastai: 1.0.57 For no reason that comes to mind, I always run into this error: Can't get attribute 'ImageList' when loading my model. I use load_learner(".", fname="model.pkl") to load my model, and…
Zium
  • 163
  • 9
6
votes
2 answers

fastai error predicting with exported/reloaded model: "Input type and weight type should be the same"

Whenever I export a fastai model and reload it, I get this error (or a very similar one) when I try and use the reloaded model to generate predictions on a new test set: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type…
Max Power
  • 8,265
  • 13
  • 50
  • 91
6
votes
1 answer

How can I convert fastai image from open_image() format to opencv?

I have image opened this way in fast.ai: img = open_image(img_f) How do I show it with cv2.imshow ?
Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206
6
votes
4 answers

FastAI library v1 with Google Colab

I am trying to install the FastAi library and use it with Google Colab. I am Using: !pip3 install fastai !apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python import cv2 from os import path from wheel.pep425tags import…
Joe S
  • 410
  • 6
  • 16
5
votes
1 answer

Why does Pytorch autograd need a scalar?

I am working through "Deep Learning for Coders with fastai & Pytorch". Chapter 4 introduces the autograd function from the PyTorch library on a trivial example. x = tensor([3.,4.,10.]).requires_grad_() def f(q): return sum(q**2) y =…
Mack
  • 53
  • 3
5
votes
1 answer

Problem in lr_find() in Pytorch fastai course

While following the Jupyter notebooks for the course I hit upon an error when these lines are run. I know that the cnn_learner line has got no errors whatsoever, The problem lies in the lr_find() part It seems that learn.lr_find() does not want to…
5
votes
3 answers

NameError: name 'get_transforms' is not defined

This code was running without any problems before I updated my python and fastai: from fastai import * from fastai.vision import * import torch ... tfms =…
sevil.z
  • 53
  • 1
  • 4
1
2
3
28 29