Thank you Zach, I will try it out
I see an error like this on paperspace while running dls.valid.show_batch(max_n=4, rows=1)
Any thoughts? Looks like an error with matplotlib
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-12-d24c61455493> in <module>
----> 1 dls.valid.show_batch(max_n=4, rows=1)
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/data/core.py in show_batch(self, b, max_n, ctxs, show, **kwargs)
90 if b is None: b = self.one_batch()
91 if not show: return self._pre_show_batch(b, max_n=max_n)
---> 92 show_batch(*self._pre_show_batch(b, max_n=max_n), ctxs=ctxs, max_n=max_n, **kwargs)
93
94 def show_results(self, b, out, max_n=9, ctxs=None, show=True, **kwargs):
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/dispatch.py in __call__(self, *args, **kwargs)
96 if not f: return args[0]
97 if self.inst is not None: f = MethodType(f, self.inst)
---> 98 return f(*args, **kwargs)
99
100 def __get__(self, inst, owner):
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/vision/data.py in show_batch(x, y, samples, ctxs, max_n, nrows, ncols, figsize, **kwargs)
43 def show_batch(x:TensorImage, y, samples, ctxs=None, max_n=10, nrows=None, ncols=None, figsize=None, **kwargs):
44 if ctxs is None: ctxs = get_grid(min(len(samples), max_n), nrows=nrows, ncols=ncols, figsize=figsize)
---> 45 ctxs = show_batch[object](x, y, samples, ctxs=ctxs, max_n=max_n, **kwargs)
46 return ctxs
47
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/data/core.py in show_batch(x, y, samples, ctxs, max_n, **kwargs)
13 if ctxs is None: ctxs = Inf.nones
14 for i in range_of(samples[0]):
---> 15 ctxs = [b.show(ctx=c, **kwargs) for b,c,_ in zip(samples.itemgot(i),ctxs,range(max_n))]
16 return ctxs
17
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/data/core.py in <listcomp>(.0)
13 if ctxs is None: ctxs = Inf.nones
14 for i in range_of(samples[0]):
---> 15 ctxs = [b.show(ctx=c, **kwargs) for b,c,_ in zip(samples.itemgot(i),ctxs,range(max_n))]
16 return ctxs
17
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/torch_core.py in show(self, ctx, **kwargs)
296 _show_args = ArrayImageBase._show_args
297 def show(self, ctx=None, **kwargs):
--> 298 return show_image(self, ctx=ctx, **{**self._show_args, **kwargs})
299
300 # Cell
/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/torch_core.py in show_image(im, ax, figsize, title, ctx, **kwargs)
52 if figsize is None: figsize = (_fig_bounds(im.shape[0]), _fig_bounds(im.shape[1]))
53 if ax is None: _,ax = plt.subplots(figsize=figsize)
---> 54 ax.imshow(im, **kwargs)
55 if title is not None: ax.set_title(title)
56 ax.axis('off')
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1541 def inner(ax, *args, data=None, **kwargs):
1542 if data is None:
-> 1543 return func(ax, *map(sanitize_sequence, args), **kwargs)
1544
1545 bound = new_sig.bind(ax, *args, **kwargs)
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
356 f"%(removal)s. If any parameter follows {name!r}, they "
357 f"should be pass as keyword, not positionally.")
--> 358 return func(*args, **kwargs)
359
360 return wrapper
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
356 f"%(removal)s. If any parameter follows {name!r}, they "
357 f"should be pass as keyword, not positionally.")
--> 358 return func(*args, **kwargs)
359
360 return wrapper
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5611 im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent,
5612 filternorm=filternorm, filterrad=filterrad,
-> 5613 resample=resample, **kwargs)
5614
5615 im.set_data(X)
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/image.py in __init__(self, ax, cmap, norm, interpolation, origin, extent, filternorm, filterrad, resample, **kwargs)
897 filterrad=filterrad,
898 resample=resample,
--> 899 **kwargs
900 )
901
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/image.py in __init__(self, ax, cmap, norm, interpolation, origin, filternorm, filterrad, resample, **kwargs)
259 self._imcache = None
260
--> 261 self.update(kwargs)
262
263 def __getstate__(self):
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/artist.py in update(self, props)
1004
1005 with cbook._setattr_cm(self, eventson=False):
-> 1006 ret = [_update_property(self, k, v) for k, v in props.items()]
1007
1008 if len(ret):
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/artist.py in <listcomp>(.0)
1004
1005 with cbook._setattr_cm(self, eventson=False):
-> 1006 ret = [_update_property(self, k, v) for k, v in props.items()]
1007
1008 if len(ret):
/opt/conda/envs/fastai/lib/python3.7/site-packages/matplotlib/artist.py in _update_property(self, k, v)
1000 if not callable(func):
1001 raise AttributeError('{!r} object has no property {!r}'
-> 1002 .format(type(self).__name__, k))
1003 return func(v)
1004
AttributeError: 'AxesImage' object has no property 'rows'
Thanks folks for suggesting. This was solved using a git pull for the course materials.
Thanks everyone!
If you have any feedback on how to make these sessions better … or if you are in different timezones and are interested in having a session in a more friendly timezone that mine let me know.
Will post video at the top of this thread in the next day or two.
-wg
I had the same problem. I changed ‘rows’ to ‘nrows’ (as it is in the book) and it solved the problem for me.
Answers/Links from last night’s group:
1. How do visualize what the convolutional kernels are learning?
This link to an updated, last year’s, notebook may help. See here. While it describes a technique to see what parts of your image your model is looking it, the ideas could be adapted perhaps into visualizing filters and also what parts of an image they are looking at (just like in the paper mentioned in class).
You may also want to search the forums as previous students may have done this already. If you get something working, put it in a notebook and post a link here! I’d love to see it.
2. What about object detection?
As you know, its not on the table for the first 7 lessons at least. But Zach Mueller has a notebook you can check out as a part of his ongoing lecture series, A Walk with fastai2.
You may also want to check out the forums to see what folks have done with adopting architectures like darknet and SSD in the past.
Along with this I recommend the part 2 from 2 years ago now where Jeremy covers it. The idea is there and then the updated code brings it together
Can you please share the link?
Thanks
Ganesh Bhat
Hi all,
Here are my week 3 questions:
-
I created a tree classifier comparing two similar types of trees. They are a little too similar and model didn’t work well. I change one of the trees, updated the code throughout, and restarted the kernal. But when I run:
fns = get_image_files(path)
fns
the output remains the old jpgs of trees. I’d like to know why my model’s not downloading and showing output of the new tree_type? -
While working on the bear model, I swapped out polar bear for teddy bear. When I ran:
failed = verify_images(fns)
failed
I was getting a message that said "corrupt EXIF data…expecting 12 bytes, but only get 10 bytes. Any idea here? -
How often are you all doing pip installs of fastai, etc to make sure everything is up to date?
Thank you!
Jason
Hi @golz!
Great questions! What kind of trees are you aiming for?
I’m not 100% sure, but did you update the paths of the changed tree?
Also, I’d recommend using some jargon here, especially since trees are a kind of classifier algorithm in ML so it sounds confusing at the first read.
Trees are your classes here (classes for the classifier) , so if you use the term classes, it makes it easier.
Could you please share the complete error stack?
It’s also useful to use backticks to nicely format it.
Once before starting my day/work with the library!
Hope this helps.
Thanks & Regards,
Sanyam.
Just a note that we’ll be running out week 3 session in about 20 minutes for all interested (6:30 PST)
How can I pass two input type to my CNV, one is images and the other is an array of numbers?
What is a “CNV”?
Sorry, CNN
Question about the curriculum vs about this week’s lecture content specifically.
Does anyone know when Jeremy is planning to touch on Natural Language Processing?
Could we clarify what the DataBlock.new is doing exactly?
Did anyone try their own image classifier and get binder working for the web app? Would love a code review for the nb2 web app. I’m hitting a 404 issue with binder. Here’s my setup:
I set up a separate repo here for the app here: https://github.com/megano/snowpeopleApp with the abbreviated .ipynb file, export.pkl, requirements.txt. This is what I’m putting in for binder, inserting the “/voila/render/” into the path URL.
See if this is helpful at all in thinking about a solution to passing disparate types of data (e.g images + numbers) into a model:
This was written for v.1 but the concepts should be applicable to v2.
First thing I’d do, is working on getting your datasets/dataloaders set up correctly using the low-level Datasets API or the higher-leve DataBlock API. Once you have that, I’m glad to help you structure a similar approach to that described in the article that might work pretty well for your task.
I also liked the other idea (forgot who mentioned it) about creating adding another channel to your images that described the other input … the numbers. Worth a try as well.
Can you post a message to the Official Week 3 thread w/r/t the issue with not being able to use search_bing_images
?
The fastai folks will want to see the full stack trace of the error and it might be nice to also print out what versions of fastai2 and fastcore you are coding against. Don’t worry if they stack trace (the error message is gigantic) … just stick it all between two lines … each having ``` and you should be good.
Also, you may want to try this for downloading images.
This is what I’ve used in the past and its been rock solid. lmk if it works if you try it out.