Does anyone know how I can run Tensorboard in Jupyter notebook TF Lite Model Maker Objectdetection

Have anyone know I can get open tensorboard and show the accuracy plot and etc in Object Detection TFLITE Model Maker that I have trained Locally I just run


This is what I just run on my jupyernotebook

and this is the train.py

-- coding: utf-8 --

“”"train.py

Automatically generated by Colaboratory.

“”"

Imports

import numpy as np
import os

from tflite_model_maker.config import ExportFormat, QuantizationConfig
from tflite_model_maker import model_spec
from tflite_model_maker import object_detector

from tflite_support import metadata

import tensorflow as tf
assert tf.version.startswith(‘2’)

tf.get_logger().setLevel(‘ERROR’)
from absl import logging
logging.set_verbosity(logging.ERROR)

Confirm TF Version

print(“\nTensorflow Version:”)
print(tf.version)
print()

Load Dataset

train_data = object_detector.DataLoader.from_pascal_voc(
‘20detection/train’,
‘20detection/train’,
[‘bellpepper’, ‘bittergourd’, ‘broccoli’, ‘cabbage’, ‘carrot’, ‘chicken’, ‘egg’, ‘eggplant’, ‘garlic’, ‘ginger’, ‘okra’, ‘onion’, ‘pork’, ‘potato’, ‘radish’, ‘shrimp’, ‘tofu’, ‘tomato’, ‘fish’, ‘chayote’]
)

val_data = object_detector.DataLoader.from_pascal_voc(
‘20detection/valid’,
‘20detection/valid’,
[‘bellpepper’, ‘bittergourd’, ‘broccoli’, ‘cabbage’, ‘carrot’, ‘chicken’, ‘egg’, ‘eggplant’, ‘garlic’, ‘ginger’, ‘okra’, ‘onion’, ‘pork’, ‘potato’, ‘radish’, ‘shrimp’, ‘tofu’, ‘tomato’, ‘fish’, ‘chayote’]
)

Load model spec

spec = object_detector.EfficientDetSpec(
model_name=‘efficientdet-lite2’,
uri=‘TensorFlow Hub’,
model_dir=‘/content/checkpoints’,
hparams=‘’)

Train the model

model = object_detector.create(train_data, model_spec=spec, batch_size=4, train_whole_model=True, epochs=10, validation_data=val_data)

Evaluate the model

eval_result = model.evaluate(val_data)

Print COCO metrics

print(“mMAP Metrics:”)
for label, metric_value in eval_result.items():
print(f"{label}: {metric_value}")

Add a line break after all the items have been printed

print()

Export the model

model.export(export_dir=‘.’, tflite_filename=‘EfficientDet2.tflite’)

Evaluate the tflite model

#tflite_eval_result = model.evaluate_tflite(‘EfficientDet2.tflite’, val_data)

Print COCO metrics for tflite

#print(“mMAP metrics tflite”)
#for label, metric_value in tflite_eval_result.items():

print(f"{label}: {metric_value}")

I wanted to get graphs like this

image

I hope some can help me I am newbiew in this I am really lost I don’t know what to do

Hi @Syncro_Tech ,

Can you check this following tutorial to get an idea on how to use the tensorboard in jupyter notebook from the TF Model Garden object detection tutorial.

I hope this help!

Thanks

1 Like

Thanks, I will try it :sweat_smile: but I am 100% I am not going to get it since I am really new to this type of things haha

1 Like

For anyone who is a newbie too like me I hope this helps

I have figured it out
I changed my model_dir=‘/content/checkpoints’ to the path example is C:\Users\jcnit\Downloads\EFF training\checkpoints

my mistake here is I didn’t change the model directory since I first run this on google colab but failed to finish training.

model_dir=‘/content/checkpoints’ to model_dir='C:\Users\jcnit\Downloads\EFF training\checkpoints ’

And then when the you start training the model you can now proceed by:

  1. Open Anaconda Prompt
  2. Activate Environment where you are training your model in my case I am using py39 (name of anaconda environment)
  3. activate py39
  4. cd (the path where you put your model_dir) in my case cd C:\Users\jcnit\Downloads\EFF training\checkpoints
  5. tensorboard --logdir C:\Users\jcnit\Downloads\EFF
  6. and here you go you will see the AP, Recall and etc.