Import the trained Apeer model outside of Apeer web interface

Hello,

I have a trained model which gives me nice predictions in the Apeer interface. However, I need to perform image processing post segmentation and I already have the code, so I would like to import the trained model in either R or Python.

I have been trying for a few hours to load the “model.h5” obtained from the Apeer Segmentation training module. I tried to load it with Keras and Tensorflow in Python and in R and no sucess, I always end up with:
Input:
from tensorflow.keras.models import Sequential, save_model, load_model
import numpy as np
loaded_model = load_model(
‘D:/model/model.h5’,
custom_objects=None,
compile=True
)
Output:
ValueError: Unknown layer: FixedDropout

Trying some solutions online, nothing worked.
Does someone has the same problem and fixed it or am I doing everything wrong?? Or is it not possible to export the model for use outside Apeer?

Thanks

Hello,

Thank you for posting your question in our Forum.

Currently, customized layers in the APEER models are not opensource. That’s why loading the “model.h5” is not so easy.
We are discussing a possible export as ONNX in the future. In the meantime, you can download the images segmented on APEER and do the postprocessing afterwards. You could also create a new APEER module for your postprocessing.

Cheers
Oguzhan