Thanks a lot for great materials here. I used a csv file to (1) create a dictionary with a key of image names and seven values of xmin, xmax, ymin, ymax and a one-hot vector of three elements then (2) change the dictionary to an input file l000_t.pkl (which is equivalent to gt_pascal.pkl here). I wrote down the code below. Then, in the stage of [11] in SSD_training.ipynb [i.e., nb_epoch = 30; history = model.fit_generator(...)], I get an error message "list indices must be integers or slices, not tuple". I wrote down the message below. Is there any way to create a dictionary with a key of image names and seven values of integers or slices? Or do I need to create the input file l000_t.pkl in another way? I really appreciate your kind help!
Code for generating the input data (l000_t.pkl)
f000={}
for line in open("...\l000_t.csv").readlines():
line=line.strip()
line=line.split(",")
key = line[0]
for value in line[1:5]:
f000.setdefault(key,[]).append(value)
for value in line[5:8]:
f000.setdefault(key,[]).append(value)
print(f000)
import pickle
pickle_out = open('l000_t.pkl', 'wb')
pickle.dump(f000, pickle_out)
pickle_out.close()
f001 = '...\l000_t.pkl'
with open(f001, 'rb') as f:
result = pickle.load(f)
f.close()
Exception in thread Thread-7:
Traceback (most recent call last):
File "...\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "...\Anaconda3\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "...\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 630, in data_generator_task
generator_output = next(self._generator)
File "", line 156, in generate
img, y = self.horizontal_flip(img, y)
File "", line 74, in horizontal_flip
y[:, [0, 2]] = 1 - y[:, [2, 0]]
TypeError: list indices must be integers or slices, not tuple
Thanks a lot for great materials here. I used a csv file to (1) create a dictionary with a key of image names and seven values of xmin, xmax, ymin, ymax and a one-hot vector of three elements then (2) change the dictionary to an input file l000_t.pkl (which is equivalent to gt_pascal.pkl here). I wrote down the code below. Then, in the stage of [11] in SSD_training.ipynb [i.e., nb_epoch = 30; history = model.fit_generator(...)], I get an error message "list indices must be integers or slices, not tuple". I wrote down the message below. Is there any way to create a dictionary with a key of image names and seven values of integers or slices? Or do I need to create the input file l000_t.pkl in another way? I really appreciate your kind help!
Code for generating the input data (l000_t.pkl)
f000={} for line in open("...\l000_t.csv").readlines(): line=line.strip() line=line.split(",") key = line[0] for value in line[1:5]: f000.setdefault(key,[]).append(value) for value in line[5:8]: f000.setdefault(key,[]).append(value) print(f000)
import pickle pickle_out = open('l000_t.pkl', 'wb') pickle.dump(f000, pickle_out) pickle_out.close() f001 = '...\l000_t.pkl' with open(f001, 'rb') as f: result = pickle.load(f) f.close()
gt = pickle.load(open('...\l000_t.pkl', 'rb')) keys = sorted(gt.keys()) print(keys)
Error message:
Exception in thread Thread-7: Traceback (most recent call last): File "...\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner self.run() File "...\Anaconda3\lib\threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "...\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 630, in data_generator_task generator_output = next(self._generator) File "", line 156, in generate
img, y = self.horizontal_flip(img, y)
File "", line 74, in horizontal_flip
y[:, [0, 2]] = 1 - y[:, [2, 0]]
TypeError: list indices must be integers or slices, not tuple