Imagej-tensorflow now with command to change TensorFlow library version / switch to GPU

Hi all,

the newest imagej-tensorflow version (1.1.4), out since a few weeks, contains a command which might be interesting to some of you: It change the version of the TensorFlow Java bindings for you.


In the most recent CSBDeep version this is already integrated. Here is how to use it:

  1. Open Edit > Options > TensorFlow...
  2. Choose the TensorFlow version matching your system / model
  3. Wait until the library is downloaded and installed (a popup will tell you when it’s done)
  4. Restart Fiji
  5. Run any CSBDeep plugin

That’s it!

What to change for a plugin depending on imagej-tensorflow

If you are developing a plugin which is using imagej-tensorflow (ping @ctrueden) , you can add these lines:

	TensorFlowService tensorFlowService;

	CommandService commandService;

	public void run() {
		if (tensorFlowService.getStatus().isLoaded()) {
		} else {
			logService.error("Could not load TensorFlow. Check previous errors and warnings for details.");
					"<html>Could not load TensorFlow.<br/>Opening the TensorFlow Library Management tool.</html>",
					"Loading TensorFlow failed",
					JOptionPane.ERROR_MESSAGE);, true);


This snippet loads the library installed by the TF library management command, checks which version is loaded and, if the library could not be loaded for some reason, opens the TF library management command. This will give more information why the loading failed and give the user the chance to switch the version.



Strange behaviour of the plugin


Great plugin! But, when I add the Tensorflow site from the “Manage update sites” menu, I don’t get the function until I un-tick it again. If I tick it and search for the function in the search bar it is non-existing - it only gets installed after I un-tick it…


Hi Thomas,

thank you for reporting! Yes, the TensorFlow update site as an old version of imagej-tensorflow not including this command… The CSBDeep update site ships the newest imagej-tensorflow version. You don’t need the TensorFlow update site. But I agree this is unfortunate, we will sort this out ASAP so that the TensorFlow update site also has the newest version and this does not happen…


1 Like