Replies: 1 comment 14 replies
-
Thanks for raising it. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am sorry if I missed an already existing feature but I could not find an option to use the event filter option (https://pytorch.org/ignite/generated/ignite.engine.events.Events.html paragraphs starts with Since v0.3.0) for
monai.handler.StatsHandler
.Originally I only wanted to log the stats for every Xth iteration but wanted to use the default logger. I solved this with a lambda function which refers to to the created
StatsHandler
:stats_handler = StatsHandler(iteration_print_logger=lambda engine: stats_handler._default_iteration_print(engine) if engine.state.iteration % iteration_log_interval == 0 else None, tag_name='Mean Squared Error', output_transform=from_engine(['loss'], first=True))
But this feels a little clunky to me. As a solution I had the idea to expose the ignite.event_filter feature to the user by adding an
iteration_filter
and anepoch_filter
argument to theStatsHandler
Class. These would enable setting specifying event filters for both theITERATION_COMPLETED
andEPOCH_COMPLETED
events in the attach functionMONAI/monai/handlers/stats_handler.py
Lines 122 to 142 in cdac033
iteration_log
orepoch_log
is 'True'). It is currently possible to solve this problem by writing a new logger function (more or less what I did above) and handle the event_filtering there but to me it feels like exposing the ignite.event_filter feature is the better solution to keep the logging and filter functionality separated.This idea of exposing the ignite.event_filter feature to the user might also apply to other
monai.handlers
.Beta Was this translation helpful? Give feedback.
All reactions