That's useful to know! But actually in this case I want to just test if the code works (run 2 epochs and see if it works). I don't want this to be logged, so I don't Task.init
in those cases.
I don't want the code to crash on Trains in those cases.
I see that Task.current_task()
returns None if no task is running, so I can use that with an if statement 🙂
With offline mode,
Later if you need you can actually import the execution (including artifacts etc.) you just need the zip file it creates when you are done.
Aah, I couldn't find it under PLOTS, but indeed it's there under DEBUG SAMPLES.
With PyTorch Lightning, I only use this line at the beginning of a Jup Notebook:Task.init(project_name=project_name, task_name=task_name)
The code to log the confusion matrix is in some .py file though that does not have any Trains code.
Is it possible to log it in a TB compatible way, that will be automatically picked up by Trains? I prefer to keep the .py Trains free.
Based on your code snippet:Logger.current_logger().report_confusion_matrix(title='confusion', series=confusion', value=confmat_tensor.cpu().numpy(), iteration=i)
or Task.current_task().get_logger()
which is the same as Logger.current_logger()
Good news, there is an offline mode.Task.set_offline(True)
If you want your code to be aware, you can do:from trains import Task if Task.current_task(): Task.current_task().get_logger().report_confusion_matrix(...)
AgitatedDove14 TB has the confusion matrix like this:
So if I want it under plots, I would need to call e.g. report_confusion_matrix
right?
I mean using Trains:Logger.current_logger().report_confusion_matrix(...)
AgitatedDove14 There is only a events.out.tfevents.1604567610.system.30991.0
file.
If I open this with a text editor, most is unreadable, but I do find a the letters "PNG" close to the name of the confusion matrix. So it looks like the image is encoded inside the TB log file?
The reason is because it is logged as an image, not a plot 🙂
DefeatedCrab47 yes that is correct. I actually meant if you see it on the tensorboard's UI 🙂
Anyhow if it there, you should find it in the Tasks Results Debug Samples
I have a numpy array, but I indeed didn't see a TB way of doing it. I guess that's not really an issue to add. The code should also be usable without Trains. How should I test if there is a current task? (I need a VPN on to log to TRAINS, which can be annoying for small tests)
I'm not sure TB support confusion matrix regardless, from anywhere in your code you can do:from trains import Task Task.current_task().get_logger().report_confusion_matrix(...)
DefeatedCrab47 if TB has it as image, you should find it under "debug_samples" as image.
Can you locate it there ?