dipti commited on
Commit
eb79240
·
1 Parent(s): 84649f1

in-built preprocessing layer

Browse files
trash_classification_using_ResNet.ipynb CHANGED
@@ -673,12 +673,10 @@
673
  },
674
  {
675
  "cell_type": "code",
676
- "execution_count": 19,
677
  "metadata": {},
678
  "outputs": [],
679
  "source": [
680
- "preprocess_layer = tf.keras.layers.Lambda(preprocess_input)\n",
681
- "\n",
682
  "def build_model():\n",
683
  " pretrained_model = ResNet50(\n",
684
  " input_shape=(224, 224, 3),\n",
@@ -690,8 +688,9 @@
690
  " pretrained_model.trainable = False # Phase 1: freeze backbone\n",
691
  "\n",
692
  " inputs = Input(shape=(*IMAGE_SIZE, 3))\n",
693
- " x = tf.keras.layers.Resizing(*IMAGE_SIZE)(inputs)\n",
694
- " x = preprocess_layer(x) # standardized input pipeline\n",
 
695
  "\n",
696
  " x = pretrained_model(x, training=False)\n",
697
  "\n",
 
673
  },
674
  {
675
  "cell_type": "code",
676
+ "execution_count": null,
677
  "metadata": {},
678
  "outputs": [],
679
  "source": [
 
 
680
  "def build_model():\n",
681
  " pretrained_model = ResNet50(\n",
682
  " input_shape=(224, 224, 3),\n",
 
688
  " pretrained_model.trainable = False # Phase 1: freeze backbone\n",
689
  "\n",
690
  " inputs = Input(shape=(*IMAGE_SIZE, 3))\n",
691
+ " x = Resizing(*IMAGE_SIZE)(inputs)\n",
692
+ " x = Rescaling(1./255)(x) # Rescale to [-1, 1]\n",
693
+ " x = preprocess_input(x) # standardized input pipeline\n",
694
  "\n",
695
  " x = pretrained_model(x, training=False)\n",
696
  "\n",