Skip to content

Instantly share code, notes, and snippets.

View csiki's full-sized avatar
🕟
10 minutes in

Viktor Tóth csiki

🕟
10 minutes in
View GitHub Profile
@csiki
csiki / clip_filter_wds.py
Last active March 2, 2023 02:00
Rewrite of rom1504/clip-retrieval/clip_retrieval/clip_filter.py to handle webdataset filtering locally or on s3
"""clip filter is a tool to use a knn index and a image/text collection to extract interesting subsets"""
# updated it for handling webdataset tar files
import fire
import boto3
import os, sys
from botocore.exceptions import ClientError
#include "zcommon.acs"
#define KILL_REWARD 100.0
#define EXIT_REWARD 500.0
// these variables are exposed to ViZDoom
global int 0:reward;
global int 1:killCount; // number of monsters killed
global int 2:xpos; // player's position
import torch
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from controller.controller import Controller # hardware control code
from vizdoom import DoomGame, Button, GameVariable, ScreenFormat, ScreenResolution, AutomapMode
while y > 6:
if y == 5:
x += y*2
if x < 42:
x += y*3
ProfStart('output.prof')
# ... Python code that calls C extension you intend to profile ...
ProfFlush()
ProfStop()
from distutils.core import setup
from Cython.Build import cythonize
setup(
name = 'gperftools_wrapped',
ext_modules = cythonize("gperftools_wrapped.pyx"),
)
cdef extern from "gperftools/profiler.h":
int ProfilerStart(char* fname)
void ProfilerStop()
void ProfilerFlush()
def ProfStart(fname):
return ProfilerStart(fname)
def ProfStop():
ProfilerStop()
function feature = alpha_feature(EEG)
% constants
alpha = 7 : 12;
left_channels = 1 : 4;
right_channels = 11 : 14;
% left mean alpha power for every channel
left_alpha_power_avg = 0;
for chan = left_channels