I noticed that the create_func argument was removed from the datablock. Is there another way to do this now through another method? Would there be an example of this?
from the changes.md in the repo for version 1.0.28 this is listed as breaking change:
create_funcis removed in the data API; subclass and change the
getmethod instead (in vision, you can subclass the
openmethod if you want to change how the images are opened).
Just remembered that I read that a few days ago, have not tried myself but maybe it points you in the right direction…
I have found it helpful to check this document often lately, lots of things breaking…
That’s exactly what I needed. My only regret is that I have just one like to give.
In case anybody else has this issue, here is what my code looks like to fix it:
Here is the create_func that was being used (This is from Radek’s Quickdraw Starter):
def create_func(path): with open(path) as f: j = json.load(f) drawing = list2drawing(j['drawing'], size=sz) tensor = drawing2tensor(drawing) return Image(tensor.div_(255))
What I had to use is:
class JSONImageItemList(ImageItemList): def open(self,fn): with io.open(fn) as f: j = json.load(f) drawing = list2drawing(j['drawing'], size=sz) tensor = drawing2tensor(drawing) return Image(tensor.div_(255))
So I had to import io so I could do
io.open, but besides that, I didn’t have to change anything else. Here is what my item_list call looks like now:
item_list = JSONImageItemList.from_folder(PATH/'train', extensions=[".txt"])
Hopefully this can help somebody else that is having similar issues.