Skip to content

Instantly share code, notes, and snippets.

Eric A. Scuccimarra escuccim

Block or report user

Report or block escuccim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andrewjong /
Last active Nov 17, 2019
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
omoindrot /
Last active Oct 17, 2019
Example TensorFlow script for fine-tuning a VGG model (uses
Example TensorFlow script for finetuning a VGG model on your own data.
Uses module which is in release v1.2
Based on PyTorch example from Justin Johnson
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
alceufc /
Created Jan 24, 2016
Compute Softmax function using numpy.
import numpy as np
def softmax(x):
Compute softmax values for each sets of scores in x.
Rows are scores for each class.
Columns are predictions (samples).
scoreMatExp = np.exp(np.asarray(x))
vladignatyev /
Last active Oct 27, 2019
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
juice49 / UniqueFilename
Created Jul 2, 2014
Laravel unique filename
View UniqueFilename
* Creates a unique filename by appending a number
* i.e. if image.jpg already exists, returns
* image2.jpg
function uniqueFilename($path, $name, $ext) {
$output = $name;
$basename = basename($name, '.' . $ext);
ramhiser /
Last active Dec 15, 2018
Jaccard cluster similarity in Python
import itertools
def jaccard(labels1, labels2):
Computes the Jaccard similarity between two sets of clustering labels.
The value returned is between 0 and 1, inclusively. A value of 1 indicates
perfect agreement between two clustering algorithms, whereas a value of 0
indicates no agreement. For details on the Jaccard index, see:
smithdanielle / check.packages.r
Created Apr 1, 2014
Check if multiple R packages are installed. Install them if they are not,then load them into the R session.
View check.packages.r
# check.packages function: install and load multiple R packages.
# Check to see if packages are installed. Install them if they are not, then load them into the R session.
check.packages <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
# Usage example
You can’t perform that action at this time.