Files
CUDANet/examples/inception_v3/inception_v3.py
2024-09-04 21:32:05 +02:00

25 lines
636 B
Python

import torchvision
import sys
sys.path.append("../../tools") # Ugly hack
from utils import export_model_weights, print_model_parameters, predict
import torch
if __name__ == "__main__":
weights = torchvision.models.Inception_V3_Weights.DEFAULT
inception = torchvision.models.inception_v3(
weights=weights,
transform_input=False
)
inception.transform_input = False
inception.eval()
export_model_weights(inception, "inception_v3_weights.bin")
# class_labels = weights.meta["categories"]
# prediction = predict(inception, "bird.jpg")
# print(prediction, class_labels[prediction])