Skip to content

Instantly share code, notes, and snippets.

@androuino
Last active October 22, 2020 06:24
Show Gist options
  • Save androuino/f62c6878e1c3482b97874f15b34300aa to your computer and use it in GitHub Desktop.
Save androuino/f62c6878e1c3482b97874f15b34300aa to your computer and use it in GitHub Desktop.
import os
import time
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import cv2 as cv
from altusi.utils.logger import *
import altusi.utils.visualizer as vis
import mxnet as mx
import gluoncv as gcv
from gluoncv import data as gdata
from gluoncv.utils import export_block
ctx = mx.context.gpu(0) if mx.context.num_gpus() else mx.context.cpu()
LOG(INFO, 'Device in Use:', ctx)
ctx = mx.context.gpu(0) if mx.context.num_gpus() else mx.context.cpu()
LOG(INFO, 'Device in Use:', ctx)
net = gcv.model_zoo.get_model('ssd_300_vgg16_atrous_voc', pretrained=False, ctx=ctx)
net.load_parameters('ssd_300_vgg16_atrous_voc_best.params')
net.hybridize()
x = np.zeros([1,3,300,300])
x = mx.nd.array(x)
net.forward(x)
net.export('vgg16_atrous_custom')
export_block('vgg16_atrous_custom_eb', net)
print('Done.')
net.collect_params().reset_ctx(ctx)
LOG(INFO, 'SSDFace Model loading done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment