nice one! thanks!
more info on 1 cycle policy: https://sgugger.github.io/the-1cycle-policy.html
nice one! thanks!
No, for inference GPU is not needed. CPU’s is good for most of inference on most of trained models.
nor me, I’m pleased to know this
FYI I’ve removed the various questions about setup, since they should go in to the dedicated topics listed in the FAQ. I’ve also removed a lot of the “thanks” etc posts. Hopefully the thread is a little easier to read now.
There are quite a few forum posts on collecting your own images
I’m having the same issue with the padding_mode needs to be ‘zeros’ or ‘border’ but got reflection… I’ll try the update of the pytorch as the next posts indicates, see if that works better
I got this error:
ImportError Traceback (most recent call last) <ipython-input-4-67a75a9cc9b3> in <module>() 1 # Import necessary libraries ----> 2 from fastai import * 3 from fastai.vision import * 4 import matplotlib.pyplot as plt ~/anaconda3/lib/python3.6/site-packages/fastai/__init__.py in <module>() ----> 1 from .basic_train import * 2 from .callback import * 3 from .callbacks import * 4 from .core import * 5 from .basic_data import * ~/anaconda3/lib/python3.6/site-packages/fastai/basic_train.py in <module>() 1 "Provides basic training and validation with `Learner`" ----> 2 from .torch_core import * 3 from .basic_data import * 4 from .callback import * 5 ~/anaconda3/lib/python3.6/site-packages/fastai/torch_core.py in <module>() 1 "Utility functions to help deal with tensors" ----> 2 from .imports.torch import * 3 from .core import * 4 5 AffineMatrix = Tensor ~/anaconda3/lib/python3.6/site-packages/fastai/imports/__init__.py in <module>() 1 from .core import * ----> 2 from .torch import * ~/anaconda3/lib/python3.6/site-packages/fastai/imports/torch.py in <module>() 1 import torch, torch.nn.functional as F 2 from torch import ByteTensor, DoubleTensor, FloatTensor, HalfTensor, LongTensor, ShortTensor, Tensor ----> 3 from torch import nn, optim, as_tensor 4 from torch.utils.data import BatchSampler, DataLoader, Dataset, Sampler, TensorDataset ImportError: cannot import name 'as_tensor'
I have ubuntu local machine. I tested pip install fastai==0.7.0 which worked for some people (ImportError: cannot import name 'as_tensor'?) but not for me.
Open a terminal and try this
python3 -c "import torch;from torch import nn, optim, as_tensor"
File “”, line 1
SyntaxError: invalid character in identifier
from: can’t read /var/mail/torch
The forum changed the character… its double or single quotes
Traceback (most recent call last):
File “”, line 1, in
ImportError: cannot import name ‘as_tensor’
What pytorch version are you using ?
pytorch version is 0.3.1
Here is a timeline of the video of the lesson 1 of yesterday (with the links to the corresponding parts in the video).
- (not related to DL) Welcome speech by Pete Baker: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=1580
- (not related to DL) Welcome speech by David Uminsky (Director of the USF Data Institute): https://www.youtube.com/watch?v=7hX8yKCX6xM&t=1869
Home and general information: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=1964
– Thread on lesson 1 in the forum: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=2415
– Thread: https://forums.fast.ai/t/lesson-1-class-discussion-and-resources/27332
– Docs on the course: http://course-v3.fast.ai/
– Fastai Docs in html: http://docs.fast.ai
– Fastai docs in github: https://github.com/fastai/fastai_docs
– Fastai Docs in Jupyter Notebooks: https://github.com/fastai/fastai_docs/tree/master/docs_src
Online GPU setup: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=2502
– install a GPU: http://course-v3.fast.ai/#using-a-gpu
– FAQ on the course: https://forums.fast.ai/t/faq-and-resources-read-this-first/24987
Beginning of the lesson: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=3142
Step 1: import and prepare the images (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=3890)
– creation of the general
databunchdataset which contains the 3 datasets train, val and test
Step 2: create the model (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=5274)
– creation of the
learnmodel which contains the neural network architecture and the
databunchdataset (we can add the error evaluation metric on the val set as argument if we want)
– Learning Transfer: we use the parameters of a model already trained to recognize objects in images (resnet34)
– Overfitting: to check that during his training our model does not specialize on the train set but learns well to recognize the general characteristics of the objects to detect, we use a val set on which we calculate the error (see metric above) in the
Step 3: train the model with the
fit_one_cycle()method and not
fit()as in the previous version of the course (explication of the Leslie Smith paper in the article of @sgugger : The 1cycle policy)
After the break: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=6536
Step 4: analyze the predictions made by the model to understand how it works and possibly improve it (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=7922)
– use of the
interpobject instantiated by the
– 3 methods to use on the
plot_top_losse()to view the images on which the model generates a big error (loss),
plot_confusion_matrix()which displays the Matrix Confusion,
most_confused()which publishes the list of labels (classes) predicted with the greatest number of errors
Step 5: improve the model (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=8310)
– find the best Learning Rate with the
lr_find()method and then
recorder.plot()(to display the loss-vs-lr curve)
– then use the
unfreeze()method on the
learnmodel in order to be able to train all the layers of the resnet34 network and not only those added at the end of the model in order to have an architecture capable of giving a probability for each of the 37 classes … BUT using different Learning Rate according to the layers via
learn.fit_one_cycle(2, max_lr=slice(1e-6,1e-4)): the idea is that the first layers do not need to be much modified because they have already been trained to detect simple geometric shapes that are found in all images.
Step 6: we can still get a better result (a lower error) by changing the model and using a more complicated (deeper) model like resnet50 (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=9018)
Thank you @willismar !
Pip wasn’t updating the latest version of pytorch for some reason so I runned this command:
conda install pytorch torchvision -c pytorch
and now it is working! Current version 0.4.1.post2
I use code from this repository:
How did you fixed this issue?