MLflow Project Setup
MLflow Overview
MLflow is an open-source platform designed to manage the machine learning lifecycle, including experimentation, reproducibility, deployment.
Usage
Import mlflow library
import mlflow
Set the remote tracking URI to log experiments to mlflow server
remote_server_uri = "http://your-mlflow-server:5001"
mlflow.set_tracking_uri(remote_server_uri)
Experiment Tracking
Set the experiment name to organize runs
mlflow.set_experiment("jetson_orin_exp")
Logging Parameters, Metrics, and Artifacts
with mlflow.start_run(run_name=model_name + "_" + video_name_short + "_" + str(round)) as active_run:
# Log parameters
mlflow.log_param("model_path", model_name)
...
result = model.predict(frame,device=0,conf=0.25,verbose=False)
...
# Log metrics
mlflow.log_metric("fps", fps)
Bulk logging of metrics
from mlflow.tracking import MlflowClient
from mlflow.entities import Metric
with mlflow.start_run() as active_run:
mlflow_client = MlflowClient()
all_metrics = []
for metric_name in history.history:
for i in history.epoch:
metric = Metric(
key="track_"+metric_name,
value=history.history[metric_name][i],
timestamp=0,
step=i,
)
all_metrics.append(metric)
mlflow_client.log_batch(run_id=active_run.info.run_id, metrics=all_metrics)
Enjoy Reading This Article?
Here are some more articles you might like to read next: