Skip to content

Instantly share code, notes, and snippets.

from sklearn.ensemble import BaggingClassifier
def bootstrap_predictions(estimator, X, y, X_test, n_bootstrap=101):
"""Bootstrap a given classifier.
Parameters
----------
estimator : object
A classifier instance with sklearn-compatible interface.
class CaptionNet(nn.Module):
def __init__(self, n_tokens=n_tokens, emb_size=128, lstm_units=256, cnn_feature_size=2048):
""" A recurrent 'head' network for image captioning. See scheme above. """
super(self.__class__, self).__init__()
# a layer that converts conv features to
self.cnn_to_h0 = nn.Linear(cnn_feature_size, lstm_units)
self.cnn_to_c0 = nn.Linear(cnn_feature_size, lstm_units)
# recurrent part, please create the layers as per scheme above.
@PhanDuc
PhanDuc / working_with_google_ngram.ipynb
Created May 21, 2018 19:29
Experiment with Google Ngram
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PhanDuc
PhanDuc / readExcel.py
Created August 1, 2018 11:40 — forked from armaandhir/readExcel.py
Reading data from excel using openpyxl
#
# I hate the documentation of openpyxl and it took me a while to undertand their stuff. So I decided to write down this code.
# Has some wrapper functions that reads all rows from the excel sheet and also a function to read a particular row.
# Add some code to the functions if you wish to do something on fly like adding values to list and sorting them later.
#
# Date: 28/09/2015
from openpyxl import load_workbook
# Reads all rows
#Save numpy data to tfrecord
import numpy as np
import tensorflow as tf
#Generate Test data
# a float array and int array each with shape (2,2,2)
f_array = np.array([[[1., 2.],
Nowadays, using the stare-of-art algorithm, it is possible to create a system that helps people in-
crease the performance of work, avoid spending too much time on mundane tasks so they can
concentrate on work that requires human skills. Deep learning methods can complete tasks that
previously took human a lot of time to do.
Fresh food in supermarkets such as fruit, vegetables are sold quickly that why employ-
ees should re-fill the empty boxes with fresh fruit, vegetables as soon as possible. In the current
workflows, employees need to check manually and it is very time-consuming.
The goal of the thesis is to demonstrate that computer vision and deep learning can solve the
"""
Script to eveluation model
Usage:
python evaluate.py --dataset /path/to/folder/images --checkpoint /point/to/model
Example:
python evaluate.py --dataset /dataset/val --checkpoint /box20190222T1237/mask_rcnn_box_0019.h5
"""
import json