pysilcam.silcam_classify module¶
-
pysilcam.silcam_classify.check_model(model_path)¶ Raises errors if classification model is not found, or if it is not a valid file.
- Parameters
model_path (str) – path to particle-classifier e.g. ‘/mnt/ARRAY/classifier/model/particle_classifier.h5’ usually obtained from settings.NNClassify.model_path
-
pysilcam.silcam_classify.get_class_labels(model_path)¶ Read the header file that defines the catagories of particles in the model
- Parameters
model_path (str) – path to particle-classifier e.g. ‘/testdata/model_name/particle_classifier.h5’ usually obtained from settings.NNClassify.model_path
- Returns
labelled catagories which can be predicted
- Return type
class_labels (str)
-
pysilcam.silcam_classify.load_model(model_path)¶ Load the trained tensorflow keras model
- Parameters
model_path (str) – path to particle-classifier e.g. ‘/testdata/model_name/particle_classifier.h5’
- Returns
loaded tf.keras model from load_model()
- Return type
model (tf model object)
-
pysilcam.silcam_classify.predict(img, model)¶ Use tensorflow model to classify particles
- Parameters
img (uint8) – a particle ROI, corrected and treated with the silcam explode_contrast function
model (tf model object) – loaded tfl model from load_model()
- Returns
the probability of the roi belonging to each class
- Return type
prediction (array)