Object detection in fast.ai v1

That’s exactly what I almost recommended. There’s an excellent thread on the forum that shows how to do that with any pretrained model :slight_smile:

1 Like

Thanks @muellerzr for your reply! Do you might sharing a link to that thread or do you remember how it was named so I can search for that? :slight_smile:

Here :slight_smile:

That was quick, thank you! :slight_smile:

I use it so much, it’s bookmarked :wink:

1 Like

IIRC part of it needs to be refactored a bit (let me know if you get any issues), I’m going to get to it for the study group so I’ll definitely have that in the next week or two. It has to do with sometimes the model has an optimizer and a model in the state_dict so we want to just modify the second.

hey, can you share the link for extra lessons for using object detection using fastai v1.
Thanks,
Harshit

Hey Everyone,
Does anyone know how can we save the databunch objects that we have created, I tried saving them using the databunch.save method but it gives me ctype error?
ERROR:
ValueError Traceback (most recent call last)
in
----> 1 data.save(“test_data_bs8.pkl”)

3 frames
/usr/local/lib/python3.7/dist-packages/fastai/basic_data.py in save(self, file)
153 warn(“Serializing the DataBunch only works when you created it using the data block API.”)
154 return
→ 155 try_save(self.label_list, self.path, file)
156
157 def add_test(self, items:Iterator, label:Any=None, tfms=None, tfm_y=None)->None:

/usr/local/lib/python3.7/dist-packages/fastai/torch_core.py in try_save(state, path, file)
414 #To avoid the warning that come from PyTorch about model not being checked
415 warnings.simplefilter(“ignore”)
→ 416 torch.save(state, target)
417 except OSError as e:
418 raise Exception(f"{e}\n Can’t write {path/file}. Pass an absolute writable pathlib obj fname.")

/usr/local/lib/python3.7/dist-packages/torch/serialization.py in save(obj, f, pickle_module, pickle_protocol, _use_new_zipfile_serialization)
378 if _use_new_zipfile_serialization:
379 with _open_zipfile_writer(opened_file) as opened_zipfile:
→ 380 _save(obj, opened_zipfile, pickle_module, pickle_protocol)
381 return
382 _legacy_save(obj, opened_file, pickle_module, pickle_protocol)

/usr/local/lib/python3.7/dist-packages/torch/serialization.py in _save(obj, zip_file, pickle_module, pickle_protocol)
587 pickler = pickle_module.Pickler(data_buf, protocol=pickle_protocol)
588 pickler.persistent_id = persistent_id
→ 589 pickler.dump(obj)
590 data_value = data_buf.getvalue()
591 zip_file.write_record(‘data.pkl’, data_value, len(data_value))

ValueError: ctypes objects containing pointers cannot be pickled