This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Benchmarking two techniques for compressing numpy arrays with python-blosc. | |
""" | |
import numpy | |
import numpy.random | |
import time | |
import blosc | |
import blosc.blosc_extension as ext | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gc () { | |
LBUFFER="git commit -m \"" | |
RBUFFER="\"" | |
} | |
zle -N gc gc | |
bindkey '^gc' gc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias gib="git branch" | |
alias branch="git branch" | |
alias gil="git log" | |
# log is a zsh builtin | |
alias gid="git diff" | |
alias gidc="git diff --cached" | |
alias giw="git wdiff" | |
# diff is a unix utility | |
alias gis="git status --ignored" | |
alias status="git status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color] | |
ui = auto | |
branch = auto | |
diff = auto | |
status = auto | |
[core] | |
excludesfile = ~/.gitignore | |
whitespace = trailing-space,space-before-tab,cr-at-eol | |
abbrev = 10 | |
[merge] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import moto | |
@moto.mock_ec2 | |
def expose(): | |
ec2 = boto3.resource('ec2') | |
blue, green = ec2.create_instances( | |
ImageId='ANY_ID', MinCount=2, MaxCount=2) | |
ec2.create_tags(Resources=[blue.instance_id], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import the main interface for reading | |
from gulpio import GulpDirectory | |
# instantiate the GulpDirectory | |
gulp_directory = GulpDirectory('/tmp/something_something_gulps') | |
# iterate over all chunks | |
for chunk in gulp_directory: | |
# for each 'video' get the metadata and all frames | |
for frames, meta in chunk: | |
# do something with the metadata | |
for i, f in enumerate(frames): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gulpio.dataset import GulpImageDataset | |
from gulpio.loader import DataLoader | |
from gulpio.transforms import Scale, CenterCrop, Compose, UnitNorm | |
# define data augmentations. Notice that there are different functions for videos and images | |
transforms = Compose([ | |
Scale(28), # resize image by the shortest edge | |
CenterCrop(28), | |
UnitNorm(), # instance wise mean and std norm | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adapter = Custom20BNCsvJpegAdapter(input_csv, jpeg_path, output_folder, | |
shuffle=shuffle, | |
frame_size=img_size, | |
shm_dir_path=shm_dir | |
) | |
ingestor = GulpIngestor(adapter, output_folder, videos_per_chunk, | |
num_workers=num_workers) | |
ingestor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AbstractDatasetAdapter(ABC): | |
""" Base class adapter for gulping (video) datasets. | |
Inherit from this class and implement the `iter_data` method. This method | |
should iterate over your entire dataset and for each element return a | |
dictionary with the following fields: | |
id : a unique(?) ID for the element. | |
frames : a list of frames (PIL images, numpy arrays..) | |
meta : a dictionary with arbitrary metadata (labels, start_time...) | |
For examples, see the custom adapters below. | |
""" |