preethamganesh commited on
Commit
281c647
·
1 Parent(s): 6f5184e

updated README.

Browse files

Added Usage section.

Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -44,3 +44,32 @@ The model achieved the following metrics on the test dataset:
44
 
45
  - **Dice Coefficient:** 0.843
46
  - **Intersection over Union (IoU):** 0.609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  - **Dice Coefficient:** 0.843
46
  - **Intersection over Union (IoU):** 0.609
47
+
48
+ ## Usage
49
+
50
+ To use this model for inference, you can load it using the `tensorflow` library.
51
+
52
+ ```bash
53
+ # Clones the repository and install dependencies
54
+ !git clone https://huggingface.co/preethamganesh/bms-flair-abnormality-segmentation-v1.0.0
55
+ !pip install tensorflow
56
+
57
+ # Imports TensorFlow
58
+ import tensorflow as tf
59
+
60
+ # Loads the pre-trained model from the cloned directory
61
+ model_path = "bms-flair-abnormality-segmentation-v1.0.0"
62
+ exported_model = tf.saved_model.load(model_path)
63
+
64
+ # Retrieves the default serving function from the loaded model
65
+ model = exported_model.signatures["serving_default"]
66
+
67
+ # Prepares a dummy input tensor for inference (batch size: 1, height: 256, width: 256, channels: 3)
68
+ input_data = tf.ones((1, 256, 256, 3), dtype=tf.float32)
69
+
70
+ # Performs inference using the model. The output will be a dictionary, with the segmentation map in the key 'output_0'
71
+ output = model(input_data)["output_0"]
72
+
73
+ # Prints the shape of the output tensor for verification
74
+ print("Output shape:", output.shape)
75
+ ```