Skip to content

Instantly share code, notes, and snippets.

# 199 line in PostProcessIR_v11.py file
# 요게 원본 소스코드
# 고정된 min, max 온도에 맞게 컬러를 scaling하지 않고
# 이미지별 min, max 온도 값을 기준으로 컬러를 scaling함.
def raw_to_8bit(data):
cv2.normalize(data, data, 0, 65535, cv2.NORM_MINMAX)
np.right_shift(data, 8, data)
return cv2.cvtColor(np.uint8(data), cv2.COLOR_GRAY2RGB)
@jireh-father
jireh-father / ffmpeg.md
Created September 20, 2019 01:49 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

net = tf.layers.conv2d(inputs, 64, 11, 4, padding="VALID", activation=tf.nn.relu, name="conv1")
net = tf.layers.max_pooling2d(net, 3, 2, name="max_pool1")
attention_mask = tf.layers.conv2d(net, 1, 1, padding="SAME")
shape = attention_mask.get_shape()
features = tf.reshape(tf.transpose(attention_mask, [0, 3, 1, 2]),
[config.batch_size * int(shape[3]), int(shape[1]) * int(
shape[2])])
spatial_softmax = tf.nn.softmax(features)
@jireh-father
jireh-father / weight_initialization_variance_example.py
Created February 26, 2018 08:17
weight_initialization_variance_example
import numpy as np
# input x
x = np.array([[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]])
print("input x: %f" % x.var())
# high variance w1
w1 = np.random.randn(10, 10)
w1[0][0] = 100
print("parameter w1 high variance : %f" % w1.var())
import numpy as np
# high variance input x1
x1 = np.array([[1], [2], [3], [4], [5], [6], [7], [8], [9], [100]])
# low variance input x2
x2 = np.array([[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]])
print("input x1 high variance : %f" % x1.var())
print("input x2 low variance : %f" % x2.var())
# gaussian distribution weights w
# import tensorflow as tf
import numpy as np
# x1 = np.random.random_integers(5, size=(3,2))
x1 = np.array([[1], [2], [3], [4], [5], [6], [7], [8], [9], [100]])
x2 = np.array([[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]])
print(x1.var(), x2.var())
w1 = np.random.randn(10, 10)
w2 = np.random.randn(10, 10)
w2[0][0] = 100
def plotNNFilter(units):
filters = units.shape[3]
plt.figure(1, figsize=(20,20))
n_columns = 6
n_rows = math.ceil(tmp.shape[3] / n_columns)
for i in range(0, filters):
plt.subplot(n_rows, n_columns, i+1)
plt.title('Filter ' + str(i))
plt.imshow(units[0,:,:,i], interpolation="nearest", cmap="gray")