Skip to content

Instantly share code, notes, and snippets.

View adriacabeza's full-sized avatar
🤖
tuturuuuuu

adri adriacabeza

🤖
tuturuuuuu
View GitHub Profile
@adriacabeza
adriacabeza / spawn_threads_decorator.py
Created February 12, 2021 11:07
Quickly spawn threads:
from threading import Thread
from functools import wraps
def spawns(func):
@wraps(func)
def spawned(*args, **kwargs):
thread = Thread(target=func, args=args, kwargs=kwargs)
thread.start()
return thread
return spawned
@adriacabeza
adriacabeza / get_files_subdirectory.sh
Created November 25, 2020 10:52
Get number of files of each subdirectory
find . -type f | cut -d/ -f2 | sort | uniq -c
#find. -type f to find all items of the type file
#cut -d/ -f2 to cut out their specific folder
#sort to sort the list of foldernames
#uniq -c to return the number of times each foldername has been counted
@adriacabeza
adriacabeza / get_layers_caffe.py
Created October 23, 2020 08:35
Get layers and shape of a Caffe model
import caffe
import numpy as np
mean = np.load('mean.npy').mean(1).mean(1)
image_dims = (224, 244)
model = 'deploy.prototxt'
weights = 'resnet-50.caffemodel'
net = caffe.Classifier(model, weights, image_dims=image_dims, mean=mean, raw_scale=255, channel_swap=[2, 1, 0])