sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| # USAGE | |
| # python face_detection.py --image face1.jpg | |
| # import the necessary packages | |
| # from imutils import face_utils | |
| # import numpy as np | |
| import argparse | |
| import imutils | |
| import dlib | |
| import cv2 |
| import torch | |
| from torch.autograd import Variable | |
| # new way with `init` module | |
| w = torch.Tensor(3, 5) | |
| torch.nn.init.normal(w) | |
| # work for Variables also | |
| w2 = Variable(w) | |
| torch.nn.init.normal(w2) | |
| # old styled direct access to tensors data attribute |
| # from https://www.kaggle.com/nothxplz/dogs-vs-cats-redux-kernels-edition/cats-vs-dogs-05-pytorch-example/run/761413 | |
| from __future__ import print_function | |
| import argparse | |
| import csv | |
| import os | |
| import os.path | |
| import shutil | |
| import time |
| from keras.models import Sequential | |
| from keras.layers import Dense | |
| x, y = ... | |
| x_val, y_val = ... | |
| # 1-dimensional MSE linear regression in Keras | |
| model = Sequential() | |
| model.add(Dense(1, input_dim=x.shape[1])) | |
| model.compile(optimizer='rmsprop', loss='mse') |
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |
| # | |
| # mnist_cnn_bn.py date. 5/21/2016 | |
| # date. 6/2/2017 check TF 1.1 compatibility | |
| # | |
| from __future__ import absolute_import | |
| from __future__ import division | |
| from __future__ import print_function | |
| import os |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |