This is a guide on how to install Caffe for Ubuntu 16.04 and above, without GPU support (No CUDA required).
sudo apt-get install libopencv-dev python-opencv
import random | |
import math | |
import os | |
PATH=os.getcwd() | |
print("This is where the train, val and test files will be at {}".format(PATH)) | |
DATASET_FILE = '/home/Pictures/udacity_driving_datasets/labels_trainval.csv' | |
FILE_TRAIN = os.path.join(PATH, 'train.csv') |
import csv | |
PATH='/home/udacity_driving_datasets' | |
f1 = open('/home/quest/train.csv') | |
csv_f = csv.reader(f1) | |
import csv | |
PATH='/home/quest' | |
f1 = open('/home/train.csv') | |
csv_f = csv.reader(f1) | |
for row in csv_f: | |
name=row[0] | |
listt='' |
import matplotlib.pyplot as plt | |
import cv2 | |
import os | |
import csv | |
from skimage.draw import random_shapes | |
PATH='/home/generated_shapes' | |
# result = random_shapes((128, 128), max_shapes=1, shape='rectangle', |
from keras.models import Sequential | |
from keras.optimizers import SGD | |
from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, merge, Reshape, Activation | |
from sklearn.metrics import log_loss | |
def vgg16_model(img_rows, img_cols, channel=1, num_classes=None): | |
"""VGG 16 Model for Keras |
import os | |
try: | |
import Augmentor | |
except ImportError: | |
os.system('pip install Augmentor') | |
PATH="/path/to/image/folder" # path for images to be augmented | |
n=200 # no of images after augmentation |
# Image Loading Code used for these examples | |
from PIL import Image | |
import numpy as np | |
import matplotlib.pyplot as plt | |
img = Image.open('/home/cat.jpg') | |
img = np.array(img) | |
plt.imshow(img) | |
plt.show() |
# Parameters | |
# image : ndarray | |
# Input image data. Will be converted to float. | |
# mode : str | |
# One of the following strings, selecting the type of noise to add: | |
# 'gauss' Gaussian-distributed additive noise. | |
# 'poisson' Poisson-distributed noise generated from the data. | |
# 'saltandpepper' Replaces random pixels with 0 or 1. |
from PIL import Image | |
import matplotlib.pyplot as plt | |
class pixel_transformation: | |
def __init__(self): | |
self.red_added=0 | |
self.green_added=0 | |
self.blue_added=0 | |
self.red_sub=0 |