Skip to content

Instantly share code, notes, and snippets.

@Hiromi-nee
Hiromi-nee / stablediffusionwalk.py
Created August 19, 2022 09:08 — forked from karpathy/stablediffusionwalk.py
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@Hiromi-nee
Hiromi-nee / README-CodiMD-Restore.md
Created July 21, 2022 14:34 — forked from Himura2la/README-CodiMD-Restore.md
CodiMD Backup and Restore
import glob, os
import sys
def yolo_reader(annotation_file):
with open(annotation_file, 'r') as f:
data = f.read()
data = data.split("\n")
return data
import numpy as np
from sklearn.metrics import confusion_matrix
import itertools
class_names = list(range(200))
import matplotlib.pyplot as plt
def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
#### Function Examples ####
## New Function Introduction: isinstance(variable, type)
## Given a variable (e.g.: a,b,c) and a specific type (int, float, bool, str, list, dict, etc)
## isinstance(variable, type) checks if variable is of the specified type and returns True or False
## e.g.:
## a = 1
## isinstance(a, int) --returns--> True
## isinstance(a, str) --returns--> False
## Note the following:
@Hiromi-nee
Hiromi-nee / key.md
Created February 28, 2019 01:17
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@Hiromi-nee
Hiromi-nee / colab code
Last active October 23, 2018 01:30
google colab snippets
# Mount google drive
# https://colab.research.google.com/notebooks/io.ipynb#scrollTo=RWSJpsyKqHjH
from google.colab import drive
drive.mount('/content/gdrive')
# This assumes your model is ready to be called with .predict()
sess = keras.get_session()
graph = sess.graph
graph_dev = graph.as_graph_def()
frozen_graph = tf.graph_util.convert_variables_to_constants(
sess, graph_def, nodes_to_output)
encoded_frozen_graph = frozen_graph.SerializeToString()
@Hiromi-nee
Hiromi-nee / aug.py
Created June 22, 2018 03:47
[Intel AI DevCamp] image aug
#%%bash
#echo "Start resizing to 227x227"
#parallel -j 200 convert {} -resize 227x227 -filter spline -unsharp 0x6+0.5+0 -background black -gravity center -extent 227x227 {} ::: *.jpg
#echo "Resizing done"
#mkdir flop
#echo "Start augmentation 1"
#parallel -j 200 convert {} -flop flop/{.}-flop.jpg ::: *.jpg
#echo "Finish augmetation 1"
import requests
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
token = get_confirm_token(response)