Skip to content

Instantly share code, notes, and snippets.

View Attila94's full-sized avatar

Attila Lengyel Attila94

View GitHub Profile
@Attila94
Attila94 / cropExDark.py
Created May 30, 2019 05:56
Make 96*96 square crops from bounding boxes of ExDark dataset.
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 14:33:10 2019
Make 96*96 square crops from bounding boxes of ExDark dataset.
@author: Attila Lengyel
"""
import numpy as np
@Attila94
Attila94 / es_mintarget.py
Last active June 6, 2019 00:07
Keras Early Stopping callback with minimum target to reach before starting to monitor target value.
class MyEarlyStopping(EarlyStopping):
def __init__(self, minimum_target=None, **kwargs):
self.minimum_target = minimum_target
super(MyEarlyStopping, self).__init__(**kwargs)
def on_epoch_end(self, epoch, logs):
current = logs.get(self.monitor)
if self.minimum_target and self.monitor_op(self.minimum_target, current):
super(MyEarlyStopping, self).on_epoch_end(epoch, logs)
@Attila94
Attila94 / log2xyz.py
Created March 25, 2019 00:29
Extract atom coordinates from Gaussian .log file and compute covergence
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 19:56:58 2019
@author: Attila Lengyel
attila@lengyel.nl
"""
import numpy as np
import os
@Attila94
Attila94 / pytorch.yml
Last active May 2, 2023 08:03
Default PyTorch conda environment for TU Delft HPC.
name: pytorch
channels:
- conda-forge
- pytorch
- nvidia
dependencies:
- pytorch::pytorch
- pytorch::torchvision
@Attila94
Attila94 / receptive_field.py
Created June 28, 2023 13:05
Receptive field computation for a PyTorch model. Note: only supports some layer types.
import torch
import torch.nn as nn
from torch.autograd import Variable
from collections import OrderedDict
import numpy as np
def check_same(stride):
if isinstance(stride, (list, tuple)):
@Attila94
Attila94 / read_hdf5.py
Last active August 7, 2023 07:55
Function to read saved Keras (tensorflow) weights from hdf5 file. Returns dict of layer names and weights.
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 11 10:31:43 2019
@author: Attila Lengyel
"""
import h5py
def read_hdf5(path):