CheckpointWrapper on annotator, saving the original dataset images as well as the annotations - waste of sapce!
Hello,
When choosing to checkpoint in the pipeline, the annotator folder will contain the original images of the dataset instead of the annotations (face landmarks for example). One solution is the wrap a CheckpointWrapper around the annotator. This will save the annotations in the annotator folder, but it will also save the original images, because now it is wrapped twice!
This problem comes from the _wrap function in the wrappers module.
Thanks to @cecabert, who pointed that in this function, there is no test whether the estimator
is already an instance of CheckpointWrapper or not! One possible solution could be as follows (tested it and it is working for my pipelines):
def _wrap(estimator, **kwargs):
# wrap the object and pass the kwargs
for w_class in bases:
valid_params = w_class._get_param_names()
params = {k: kwargs.pop(k) for k in valid_params if k in kwargs}
if estimator is None:
estimator = w_class(**params)
else:
if not isinstance(estimator, w_class):
estimator = w_class(estimator, **params)
return estimator, kwargs