clearml icon indicating copy to clipboard operation
clearml copied to clipboard

how to download debug_examples images from clearml on python API

Open davidenitti opened this issue 3 years ago • 6 comments
trafficstars

Is there a way to download the images saved on clearml for a given task (debug_examples) from python?

davidenitti avatar Aug 30 '22 14:08 davidenitti

any idea?

davidenitti avatar Sep 01 '22 15:09 davidenitti

Hi @davidenitti,

Sorry for the slow reply, this somehow slipped my radar.

Short answer is yes, you can with this code: from clearml import Task from clearml.backend_api.services import events

print(Task._send(Task._get_default_session(), events.DebugImagesRequest([{"task": "3aef190f16b843509056afdf86344077", "metric": "Images"}])))

You should obviously change Task ID, metric and series to your own's. Note that in SDK 1.6.3 and up, there is a bug that might prevent you from using it. If you're using an older version no problem, if not then you might need to wait a few day until we release a new version :)

The long answer BTW is that we'll add a better interface to retrieve debug samples :smile:

erezalg avatar Sep 02 '22 08:09 erezalg

thanks!

davidenitti avatar Sep 02 '22 09:09 davidenitti

it seems that I can see only the last iteration image, is it possible to see also the past iterations?

davidenitti avatar Sep 07 '22 15:09 davidenitti

@davidenitti, you can add iters=X, where X is the iterations window (how many iterations from the last one you'll retrieve).

Let me know if that works

erezalg avatar Sep 13 '22 17:09 erezalg

I get this error:

    raise SendError(res, error_msg)
clearml.backend_interface.session.SendError: Action failed <500/100: events.debug_images/v2.7 (General data error (RequestError(400, 'x_content_parse_exception', '[1:459] [terms] failed to parse field [size]')))> (metrics=[{'task': '601d1e6eb485444da1ca414487a7799a'}], iters=100000)

davidenitti avatar Sep 20 '22 09:09 davidenitti

@erezalg do you know how to fix this?

davidenitti avatar Sep 23 '22 14:09 davidenitti

@davidenitti what size of window did you use?

jkhenning avatar Oct 11 '22 07:10 jkhenning

@jkhenning 1000x1000 or maybe a bit bigger, does it matter? I have the error only if I use inter, e.g. res = Task._send(Task._get_default_session(), events.DebugImagesRequest([{"task":task.id}],iters=1000)) gives the error but this works res = Task._send(Task._get_default_session(), events.DebugImagesRequest([{"task":task.id}]))

dnitti-psee avatar Oct 27 '22 09:10 dnitti-psee

This API does aggregations on the debug image events, and is thus limited by size. You should use the events.GetTaskEventsRequest request. Currently there's no task object interface for that. You can use the private function Task._get_all_events() (although it's not guaranteed to remain there as it's not part of the official interface), or at least take a look at it to see how to call this request 🙂

jkhenning avatar Oct 27 '22 12:10 jkhenning

it kind of works now with res = Task._send(Task._get_default_session(), events.DebugImagesRequest([{"task":task.id}],iters=1000)) but it seems I don't get all the images. can you make en example with the GetTaskEventsRequest and/or _get_all_events? thanks

dnitti-psee avatar Nov 02 '22 11:11 dnitti-psee

@davidenitti

can you try calling and letting me know if it works? res = task._get_all_events(max_events=None, batch_size=10000, event_type="training_debug_image")

erezalg avatar Dec 05 '22 10:12 erezalg

Hey @davidenitti! v1.10.0 is now out, supporting debug sample retrieval using Task.get_debug_samples()

pollfly avatar Apr 04 '23 11:04 pollfly

@davidenitti closing this, please reopen if required.

jkhenning avatar Aug 06 '23 07:08 jkhenning