<jupyter_start><jupyter_text>Now the data pipeline is ready. We can feed this pipeline to train the model<jupyter_code>mobile_net = tf.keras.applications.MobileNetV2(input_shape=(192, 192, 3), include_top=False)
mobile_net.trainable=False
image_batch, label_batch = next(iter(ds))
feature_map_batch = mobile_net(image_batch)
print(feature_map_batch.shape)
model = tf.keras.Sequential([
  mobile_net,
  tf.keras.layers.GlobalAveragePooling2D(),
  tf.keras.layers.Dense(len(label_names))])
model.compile(optimizer=tf.keras.optimizers.Adam(),
              loss='sparse_categorical_crossentropy',
              metrics=["accuracy"])
model.summary()
model.fit(ds,epochs=1, steps_per_epoch= tf.math.ceil(len(image_path_list)/32).numpy())<jupyter_output>4/115 [>.............................] - ETA: 3:00 - loss: 1.6094 - accuracy: 0.3047
{'fraction_non_alphanumeric': 0.1658653846153846, 'fraction_numerical': 0.03485576923076923, 'mean_word_length': 4.744827586206896, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '639372', 'license': 'MIT', 'n_tokens_mistral': 312, 'n_tokens_neox': 294, 'n_words': 44, 'path': 'input_data_pipeline/DataPipeline_w_images.ipynb', 'repo_name': 'khan-farhan/input-data-pipeline-tensorflow', 'size': '832'}