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 io | |
import os | |
import numpy as np | |
from PIL import Image | |
from pymongo import MongoClient | |
from torch.utils.data import Dataset, DataLoader | |
from torchvision import transforms | |
def pil_loader(f): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 torch as th | |
class NLL_OHEM(th.nn.NLLLoss): | |
""" Online hard example mining. | |
Needs input from nn.LogSotmax() """ | |
def __init__(self, ratio): | |
super(NLL_OHEM, self).__init__(None, True) | |
self.ratio = ratio |
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
git show-branch \ | |
| sed "s/].*//" \ | |
| grep "\*" \ | |
| grep -v "$(git rev-parse --abbrev-ref HEAD)" \ | |
| head -n1 \ | |
| sed "s/^.*\[//" |
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
/* | |
Linked_list implementation for cracking the code | |
questions | |
*/ | |
#include <iostream> | |
#include <stdlib.h> /* srand, rand */ | |
#include <map> | |
using namespace std; | |
template <typename dataType> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#include <vector> | |
#include <iostream> | |
using namespace std; | |
int main(){ | |
// This initialization is available at C++11 support compiler | |
// For lower version C++ support check the reference document | |
vector<int> arr (9); | |
arr = {1,2,3,4,5,6,7,8,9}; | |
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
#include "caffeclassifier.h" | |
CaffeClassifier::CaffeClassifier(const string& model_file, | |
const string& trained_file, | |
const string& mean_file, | |
const string& label_file, | |
const bool use_GPU, | |
const int batch_size) { | |
if (use_GPU) | |
Caffe::set_mode(Caffe::GPU); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
function[binary_codes,G_vecs] = WTA_kernel_binary(X,G_vecs,G, K) | |
% G is number of permutation vectors | |
% K is the insterest span | |
if size(G_vecs,1) == 0 | |
G_vec = zeros(G,size(X,2)); | |
for i = 1:G | |
G_vecs(i,:) = randperm(size(X,2),size(X,2)); | |
end | |
end |
NewerOlder