Hello all!
About a year ago, I wrote a Fiji plugin which deploys a tensorflow network to count cells. The plugin worked just fine until about a month and a half ago, when the code I was using to download the model stopped working properly.
This is the code in question, which I borrowed from the function used by ctrueden et al in their microscope image quality assessment tool:
The model is hosted in my google drive as a .zip file, along the loadModel guidelines. However, it seems like the model is not being downloaded properly, as the code only populates the downloaded models folder with this:
and that model_1 folder is empty. The zip file uploaded has the .pb file and everything else properly saved, so I am pretty sure this is a download issue.
I tried switching to
LoadChachedModel
, but maven does not recognize net.imagej.tensorflow.CachedModelBundle:
, despite recognizing other net.imagej.tensorflow objects.
I would appreciate any tips about how to resolve this- thank you so much in advance and please let me know if you need any more information. This is the project github:
https://github.com/ethier-lab/AxoNet-fiji
For reference, here is the error trace:
Hi
@matthew-ritch
, I can’t tell you for sure what’s happening but I took a minute to clone the repo and here are some quick notes:
switching to
loadCachedModel
worked fine with these changes:
change line 515 in
AxoNet.java
to this:
try {model = tensorFlowService.loadCachedModel(source, MODEL_NAME, MODEL_TAG).model();}
add this to properties
in pom.xml
:<imagej-tensorflow.version>1.1.6</imagej-tensorflow.version>
I had problems with the caching as well in the past, read this issue. For our plugins I now add the last changed
timestamp of the ZIP file to MODEL_NAME
which ensures that whenever the model changes, a new cached version is created. A simple test for you would be to delete anything in the cache directory and try again. The cache directory is in Fiji.app/models/
by default but this is different if you start it from IntelliJ / Eclipse. I think the path is printed to console when loading the model.
The second point might have nothing to do with your problem though. Maybe I can find more time soon to actually run the plugin for a test.
Thank you for your help @frauzufall! I made the changes you suggested, but I am still getting a similar error:
I have been clearing the model cache every time I update the plugin- your suggestion to change the name at each iteration will save me time, thank you. Unfortunately, it still looks like the downloaded model is being unpacked into the cache improperly.
Do you have any ideas about ways I can ensure that my model is downloaded and unpacked properly? Thank you again for your help!