Skip to content

Instantly share code, notes, and snippets.

View Svtter's full-sized avatar

修昊 Svtter

View GitHub Profile
@Svtter
Svtter / compute.py
Created February 28, 2025 09:24
compute sha256sum of files under folder.
"""Tools to compute sha256 of files and find duplicate files"""
import hashlib
import os
f = open("sha256.txt", "w")
def compute_sha256(file):
with open(file, "rb") as f:
@Svtter
Svtter / img_enhance.py
Created January 17, 2019 10:55
[img enhance] image enhance checker #keras
import matplotlib.pyplot as plt
from keras.preprocessing import image
inx = 5000
x = x_train[inx]
x = x.reshape((1, ) + x.shape)
i = 1
@Svtter
Svtter / App.vue
Created November 6, 2018 06:12
vue-cli instant prototyping example file.
<template>
<div id="app">
<h1>test</h1>
<p>{{ greeting }} world!</p>
</div>
</template>
<script>
export default {
data: function () {
@Svtter
Svtter / readme.md
Created September 6, 2018 02:43
[npz vs npy] a difference between them #npz #npy

The .npz file format is a zipped archive of files named after the variables they contain. The archive is not compressed and each file in the archive contains one variable in .npy format. For a description of the .npy format, see numpy.lib.format.

When opening the saved .npz file with load a NpzFile object is returned. This is a dictionary-like object which can be queried for its list of arrays (with the .files attribute), and for the arrays themselves.

@Svtter
Svtter / test.py
Created September 5, 2018 13:14
[test tensorflow] test tensorflow installation #tensorflow
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
@Svtter
Svtter / shuffle.py
Created September 5, 2018 03:00
[shuffle data] shuffle the dataset when its ordered 打乱数据 #python #numpy
import numpy as np
# shuffle the data.
idx = np.random.permutation(len(x_all))
x_all, y_all = x_all[idx], y_all[idx]
@Svtter
Svtter / func.cc
Created July 10, 2018 03:24
opencv threshold cal
#include <opencv/cv.h>
#include <iostream>
using namespace cv;
// sum up given row
long int sumup(Mat row, int width)
{
std::cout << "Sumup" << std::endl;
long int total = 0;
@Svtter
Svtter / keras.markdown
Created February 6, 2018 06:39
Three useful network
# Put in const.py...:
# python2
class _const:
class ConstError(TypeError): pass
def __setattr__(self,name,value):
if self.__dict__.has_key(name):
raise self.ConstError, "Can't rebind const(%s)"%name
self.__dict__[name]=value
import sys
sys.modules[__name__]=_const()
@Svtter
Svtter / ros-tensorflow.py
Created December 22, 2017 01:50 — forked from bigsnarfdude/gist:4cbf171dd1ab0c13edfad3eaa5506745
[self-driving-car] ros tensorflow
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
from tensorflow.models.image.imagenet import classify_image