File size: 559 Bytes
ce4b573
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import csv
from os import listdir
from os.path import join

base_dir = '/home/mjc/sdc/CarND-Behavioral-Cloning/data/mrg/IMG'

img_files = listdir('data/mrg/IMG/')
with open('data/mrg/driving_log_clean_hal.csv', 'w') as wf:
    with open('data/mrg/driving_log.csv', 'r') as rf:
        reader = csv.reader(rf)
        writer = csv.writer(wf)
        for row in reader:
            rel_path = row[0].split('\\')[-1]
            if rel_path in img_files:
                real_path = join(base_dir, rel_path)

                writer.writerow([real_path, row[3]])