Skip to content

Instantly share code, notes, and snippets.

View kkk324's full-sized avatar
🌴
I may be slow to respond.

kkk324

🌴
I may be slow to respond.
View GitHub Profile
def listen(self):
import ipdb
#ipdb.set_trace()
pa = PyAudio()
stream = pa.open(format=paInt16, channels=1,
rate=self.SAMPLING_RATE, input=True,
frames_per_buffer=self.NUM_SAMPLES)
time_count = self.TIME_COUNT
# plot
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
import skimage.io as io
IMAGE_HEIGHT = 240
IMAGE_WIDTH = 320
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2018 * Ltd. All rights reserved.
#
# Editor : Pycharm
# File name : encode_tfrecord.py
# Author : CR-Ko
# Created date: 2019-01-08 16:29:23
# Description :
import numpy as np
import imgaug as ia
from imgaug import augmenters as iaa
import cv2
import glob
import xml.etree.ElementTree as ET
import os
from random import randint
from matplotlib import pyplot as plt
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
# --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import xml.etree.ElementTree as ET
import os
#import cPickle
import _pickle as cPickle
#!/usr/bin/env python
# Adapt from ->
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# <- Written by Yaping Sun
model_restore_var = [v for v in tf.global_variables()]
for v in model_restore_var:
print(v.name)
print ('--------- ckpt --------')
checkpoint_dir = ckpt_path
for var_name, _ in tf.contrib.framework.list_variables(checkpoint_dir):
# Load the variable
var = tf.contrib.framework.load_variable(checkpoint_dir, var_name)
print(var_name)
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def convert_suffix_torch2tf_op(str):
suffix_torch_list = ['0.0' , '0.1' , '1.0' , '1.1' , '1.3' , '1.4' , '2.0' , '2.1' , '2.3' , '2.4' , '3.0' , '3.1' , '3.3' , '3.4']
suffix_tf_list = ['Conv' , 'BatchNorm', 'Conv_1', 'BatchNorm_1', 'Conv_2', 'BatchNorm_2', 'Conv_3', 'BatchNorm_3', 'Conv_4', 'BatchNorm_4', 'Conv_5', 'BatchNorm_5', 'Conv_6', 'BatchNorm_6']
h = str.split('.')[0]
num = '.'.join(str.split('.')[1:3])
end = str.split('.')[3]
for i in range(14):
if num == suffix_torch_list[i]:
num = num.replace(num, suffix_tf_list[i])
out = h + '/' + num + '/' + end