FTE-BTE Food Experiment
amyvanee opened this issue · 0 comments
amyvanee commented
My issue is about running the FTE-BTE Food Experiment
Reproducing code example:
dict_x = {}
for k in range(10):
# Initialize data_x* with the first image in the first class, then concatenate to acquire all images from the first class
food_class = os.listdir(os.path.join(data_dir,foods_sorted[10*k]))
data_xk = [plt.imread(os.path.join(data_dir, foods_sorted[10*k], food_class[0]))]
for i in range(1,1000):
data_xk = np.concatenate([data_xk, [(plt.imread(os.path.join(data_dir, foods_sorted[10*k], food_class[i])))]])
# Add to the initialized data_x* array until it contains all images from the 10 classes
# Concatenating more than 10000 images per batch increases the run time by a lot
for j in range(((k*10)+1),(10*(k+1))):
food_class = os.listdir(os.path.join(data_dir,foods_sorted[j]))
for i in range(0,1000):
data_xk = np.concatenate([data_xk, [(plt.imread(os.path.join(data_dir, foods_sorted[j], food_class[i])))]])
dict_x['data_x' + str(k+1)] = data_xk
Error message
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 308 and the array at index 1 has size 512
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-8ad3416dbc2e> in <module>
6
7 for i in range(1,1000):
----> 8 data_xk = np.concatenate([data_xk, [(plt.imread(os.path.join(data_dir, foods_sorted[10*k], food_class[i])))]])
9
10 # Add to the initialized data_x* array until it contains all images from the 10 classes
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 308 and the array at index 1 has size 512
Version information
- OS: Windows
- Python Version: 3.8.2
- Package Version: 0.0.1
Thank you!