Skip to content

Instantly share code, notes, and snippets.

View wawaa's full-sized avatar

哇哇 wawaa

  • ChangSha, Hunan, China
View GitHub Profile
@crypt3lx2k
crypt3lx2k / 0-model.py
Last active September 2, 2021 07:59
Training model in tensorflow for tflite with 8-bit integer quantization
#! /usr/bin/env python
import tensorflow as tf
def inference_fn(x, training=False):
net = x
net = tf.layers.flatten(net)
net = tf.layers.dense(net, 512, activation=tf.nn.relu)
net = tf.layers.dropout(net, 0.2, training=training)
@jeremyjordan
jeremyjordan / sgdr.py
Last active December 4, 2023 13:41
Keras Callback for implementing Stochastic Gradient Descent with Restarts
from keras.callbacks import Callback
import keras.backend as K
import numpy as np
class SGDRScheduler(Callback):
'''Cosine annealing learning rate scheduler with periodic restarts.
# Usage
```python
schedule = SGDRScheduler(min_lr=1e-5,
@alsrgv
alsrgv / pbtxt_to_pb.py
Created March 15, 2018 02:51
Converter of graph.pbtxt to binary graph.pb
from __future__ import print_function
import os
import sys
import tensorflow as tf
from google.protobuf import text_format
from tensorflow.python.framework import graph_io
if len(sys.argv) < 2:
print('Usage: %s <filename prefix>' % sys.argv[0])