I installed the requirements and the demo for object detection works fine.
Is there a way how I can save and reload a trained model after the task.fit call?
detector = task.fit(dataset_train,
num_trials=2,
epochs=epochs,
lr=ag.Categorical(5e-4, 1e-4),
ngpus_per_trial=1,
time_limits=time_limits)
I also tried to set a resume to False to initialize the task to predict directly, but training is always started from the beginng.
?
That's good question. We should improve the documentation.
When calling task.fit(...), the training will start. If resume=True, it will start will the existing search history.
If you would like to save/load the trained model, please use detector.save('detector.ag') and detector= Detector .load('detector.ag')
Thanks @zhanghang1989 for your response. It seems that save method in detector is not implemented yet?
I tried to call the save method after training, but receive an error.
# start training
detector = task.fit(dataset_train,
num_trials=2,
epochs=epochs,
lr=ag.Categorical(5e-4, 1e-4),
ngpus_per_trial=1,
time_limits=time_limits)
# save model
detector.save("motorbike.ag")
Error message:
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp
Traceback (most recent call last):
File "demo_eval.py", line 24, in
detector.save("motorbike.ag")
File "/home/user/.local/lib/python3.7/site-packages/autogluon/task/object_detection/detector.py", line 154, in save
raise NotImplemented
TypeError: exceptions must derive from BaseException
def load(cls, checkpoint):
raise NotImplemented
def save(self, checkpoint):
raise NotImplemented
Thanks for the feedback @rebotnix . We will prioritize the implementation of save/load method.
Most helpful comment
Thanks for the feedback @rebotnix . We will prioritize the implementation of save/load method.