For larger datasets, I was experimenting with pytables - the IO on AWS with reasonable volumes seems to be very limiting, especially with smaller files. I also experimented with other types of drives, etc.
Once we go from an image to a matrix, this suddenly becomes huge. Problem is - I never found a good way of compressing it to conserve disk space. I think with the 70GB of data for the cdiscount competition, once read in as matrices, even with compression, the data becomes over 1TB or something like that, maybe even closer to 2TB IIRC.
Guess this is just how it is but I never found a good way of compressing image data in matrix form for storage. Chances are algorithms for image compression are just so highly specialized nothing else generic comes even close⌠and the whole idea of reading in images and saving them as matrices is just silly.
BTW if you have a dataset this size, does shuffling still even make sense?
Could you explain what restarting a jupyter notebook kernel does? How does it affect weights? If we have precompute=True then weights have already been computed and restarting the kernel shouldnât affect this, correct? However when I run
I get 83% percent accuracy on the third epoch. If I run the cell again, I get something like 31%. If I restart the kernel, weâre back to 83%. Why would my results be different based on the state of the kernel?
Is there any reason to call learn.fit when we have precompute=True? You say that if you have saved weights to skip learn.fit? Does learn.fit do anything more than generate weights?
Before restarting kernel ensure to save weights and load after restart. If youâve not saved, and not loaded, they will be recalculated.
Precompute true saves weights in cache thus itâs fast.
[Update] Oh I think I see what youâre saying. I could do a learn.fit and then a learn.save(some_name) before I restart the kernel. Then, after a kernel restart, comment out the learn.fit and instead do a learn.load(some_name).
test time augmentation: I understand the data augmentation that can be done while training a model. After the model is trained what use is test time augmentation? Is learn.TTA() re-learning or somehow improving the model? If itâs a way to make the predictions better isnât that training in a way? Or is it a way to increase the size of the validation set (having more images to test against)?
TTA is not improving the model nor is it enlarging the validation set. All it should do is enhance our modelâs predictive ability. The idea is that if we show our model a couple of slightly altered versions of the same image, we hope that overall it will do better then if it saw just a single image.
Maybe the image after transformations will be more like what our model learned on the train set? And even if not, itâs sort of like us when we take a new thing in our hand and try to recognize what it is, what it does. We turn it around in our hands and look at it from various perspectives. I think that this is somewhat like what we are doing here - probably not a perfect analogy but one way to look at this
Either way, by transforming the image a little bit, I think the idea is to address some of the deficiencies of our model (not being that great in categorizing images where the object doesnât appear in roughly the same spot like in the train set, etc).
Thank you for the response! You mentioned âTTA is not improving the modelâ and at the end of your response you mention âit addresses some of the deficiencies of our modelâ.
To âenhance [the] modelâs predictive abilityâ sounds like an improvement to the model.
Iâm still not sure what TTA is doing â perhaps itâs that I donât understand the role of learn.predict()?
After the training is prediction a form of validation? Measuring the results? Or does calling learn.predict() (or learn.TTA()) change (improve) the modelâs ability to predict (predict in this case meaning to âclassifyâ).
Sorry, I think I understand your question better now
predicting - we take our trained model, show it an image, and ask it what category the image belongs to TTA (test time augmentation) - before showing our model an image, we create a couple of other images that are similar (sort of like we augment the train data with data augmentation). We might change how light the image is, make changes to the colors, scale the image, etc. We want our model to classify the original image, but instead of showing it just the single image we started with, we show it the original + slightly altered copies. We predict on each of those images and then combine the results somehow (in our case, I believe we just take the average of the predictions).
Not really â I understand that process: We take the average prediction of the image + 4 transformations. I donât understand why we need to do so. However TTA seems like just testing to me â Instead of testing 1 image, now weâve tested 5 images. Weâre calling TTA to see can it detect transformations. Weâre testing how good the model is. Not making it better, but giving it different augmentations to see how good it is. I just donât see how testing 5 images vs 1 image has any effect if the model has already been trained (after all augmentation is done during training).
Analogy: teach a baby to recognize a chair. Show baby 3 different chairs. For each, show them from the front, and from the back. Thatâs training augmentation.
Now ask the baby to recognize a chair they havenât seen before (thatâs testing). Regular version: just show them the front of that one chair. TTA version: show them both the front and the back of that chair.
You would expect them to be better at recognizing it, if you show them both the front and the back.
Ah! Thank you. So to potentially get better classification results, I can take an image along with its various augmentations and the model may have a better chance to classify the image.
Iâm thinking in terms of a Web App where a user uploads an image to be classified (dog breed for example). The image once uploaded will be transformed in various degrees (side ways for ex) and the model seeing the same image in different augmentations might be able to classify it better.
Iâve searched for the Dog Breed notebook but Iâm not able to find it at all. Even tried git pull but it seems my repo wasnât updated with anything new. Can anyone provide me a way to obtain the notebook ?
Iâm pretty sure you have to create it yourself. Itâs a homework problem. I started from the lesson 2 workbook and modified it to use the dogbreeds data.