Skip to content

Instantly share code, notes, and snippets.

View HanaanY's full-sized avatar

Hanaan Yousaf HanaanY

  • Manchester, United Kingdom
View GitHub Profile
from Project.DenseNet.densenet import densenet121_model
from Project.ss150.ss150 import DataGenerator
from keras.utils.io_utils import HDF5Matrix
from keras.utils import multi_gpu_model
from keras.optimizers import SGD
from keras import backend as K
from sklearn import metrics
import random
@HanaanY
HanaanY / naani.md
Last active September 6, 2018 03:43

image

FNs image image

FP image image

from keras.utils.io_utils import HDF5Matrix
import random
import numpy as np
random.seed(52)
sub_sample = 0.01
data_path = '/home/naan/SnapshotSerengeti/data/SnapshotSerengeti224.h5'
def remove_repeats(df):
df = df.assign(is_giraffe=lambda x: x.Species == 'giraffe')
df = df.sort_values('is_giraffe')
df = df.drop_duplicates(['URL_Info'], keep='last')
return df
clean_df = remove_repeats(test)
!ls -1 '/home/naan/SnapshotSerengeti/data/resized/' | wc -l
import csv
import os.path
import itertools
from collections import defaultdict
data_path = '/home/naan/SnapshotSerengeti/data/'
def raw_sampler(rawfile, outfile, n=500):
raw_path = os.path.join(data_path, rawfile)
sample_path = os.path.join(data_path, outfile)
import csv
from collections import defaultdict
#rawdate is format of ['CaptureEventID', 'ClassificationID', 'UserID', 'Species', 'Count', 'Standing', 'Resting', 'Moving', 'Eating', 'Interacting', 'Babies']
#requires raw_data, and all_images
#lets remove the instances where there is more than 1 animal in a still and when there is a human
with open('D:\SnapshotSerengeti\consensus_data.csv', newline='') as rawdata,\
open('D:\SnapshotSerengeti\curated.csv','w', newline='') as curated,\
open('D:\SnapshotSerengeti\\all_images.csv', newline='') as images:
@HanaanY
HanaanY / register.js
Last active May 26, 2017 00:19
line 16 goes through even though I 'm seeing it hit line 20 first :(
'use strict';
var Promise = require('bluebird');
var sqlite3 = require('sqlite3');
var db = new sqlite3.Database('testDB.db');
var validator = require('validator');
var has = require('has');
exports.index = function(req, res){
res.render('register', {title: 'register'});
};
@HanaanY
HanaanY / makefile
Last active January 22, 2017 23:35
parser makefile
CFLAGS = -lm -lrt
INCS = parser.h
TARGET = test_parser
SOURCES = parser.c $(TARGET).c
CC = gcc
all: $(TARGET)
$(TARGET): $(SOURCES) $(INCS)
$(CC) $(SOURCES) -o $(TARGET) $(CFLAGS)
@HanaanY
HanaanY / game.py
Last active April 7, 2016 00:00
Game.py is the game engine and includes I/O , Tradesimulator.py creates players for the game and behaviour classes for bots
#!python3
import random
import tradesimulator as ts
import sys
behaviourarray = {
'takerisk': ts.TakeRisk(),
'avoidrisk': ts.AvoidRisk(),
'findarbs': ts.FindArbs(),
}
data = load('ex1data2.txt'); % loads from array of 47x3 (x1, x2, y)
X = data(:, 1:2); % takes first two columns from the array we loaded
X_norm = X;
mu = zeros(1, size(X, 2)); % work out mean for each column in X
sigma = zeros(1, size(X, 2)); % work out stdev for each column in X
for i = 1:size(X,2)
mu(1,i) = mean(X(:,i)) % find mean for each column of X