This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.onnx | |
from networks import EmbeddingNetwork | |
sample_batch_size = 1 | |
channel = 3 | |
height = 224 | |
width = 224 | |
def load(file_path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import argparse | |
import numpy as np | |
import cv2 | |
def load_graph(frozen_graph_filename): | |
with tf.gfile.GFile(frozen_graph_filename, "rb") as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import onnx | |
from onnx_tf.backend import prepare | |
import tensorflow as tf | |
from tensorflow.python.client import timeline | |
import time | |
# Prepare the inputs, here we use numpy to generate some random inputs for demo purpose | |
import numpy as np | |
img = np.random.randn(1, 3, 224, 224).astype(np.float32) |