-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·41 lines (32 loc) · 1.16 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/enc python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 15 13:11:00 2019
@author: ninad
"""
import os
import cv2
import pandas as pd
import sys
import numpy as np
from progressbar import ProgressBar
from data_augmentation import DataAugmentation
from image_process import ImageProcess
image_process = ImageProcess()
data_aug = DataAugmentation()
csv_fname = '/home/mir-lab/Ninad_Thesis/Test/Test.csv'
csv_header = ['image_fname', 'steering_angle']
df = pd.read_csv(csv_fname, names=csv_header, index_col=False)
num_data = len(df)
text = open('/home/mir-lab/Ninad_Thesis/Test/Shift/Shift.txt','w+')
bar = ProgressBar()
for i in bar(range(num_data)):
image_name = df.loc[i]['image_fname']
steering = df.loc[i]['steering_angle']
image_path = '/home/mir-lab/Ninad_Thesis/Test/' + image_name + '.jpg'
image = cv2.imread(image_path)
image = cv2.resize(image, (160, 70))
image = image_process.process(image)
shift_image, shift_steering = data_aug.shift(image, steering)
cv2.imwrite('/home/mir-lab/Ninad_Thesis/Test/Shift/S_' + image_name + '.jpg', shift_image)
text.write('S_' + str(image_name) + '\t' + str(shift_steering) + '\r''\n')