GDL_code icon indicating copy to clipboard operation
GDL_code copied to clipboard

Divide by zero error when running 04_01_gan_camel_train, missing data?

Open justinwiley opened this issue 5 years ago • 3 comments

I opened the Jupyter notebook, clicked "Run all cells". Execution failed at:

(x_train, y_train) = load_safari(DATA_NAME)

...with the error:

---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-5-595832a29a8f> in <module>
----> 1 (x_train, y_train) = load_safari(DATA_NAME)

~/lab/GDL_code/utils/loaders.py in load_safari(folder)
    188 
    189     slice_train = int(80000/len(txt_name_list))  ###Setting value to be 80000 for the final dataset
--> 190     i = 0
    191     seed = np.random.randint(1, 10e6)
    192 

ZeroDivisionError: division by zero

It looks like there's no data in the data diretory, which leads txt_name_list to be an empty array. Is there some step necessary to pull the data?

justinwiley avatar Nov 30 '19 00:11 justinwiley

It turns out this was answered 5 months ago in the first issue: https://github.com/davidADSP/GDL_code/issues/10.

@davidADSP would it be possible to update the README with additional instructions about data setup?

justinwiley avatar Dec 01 '19 18:12 justinwiley

@justinwiley I have the same problem, do you solve it?

JokerZhang66 avatar Dec 04 '21 13:12 JokerZhang66

I solve by applying try and except ZeroDivisionError code below

try: slice_train = int(80000/len(txt_name_list)) ###Setting value to be 80000 for the final dataset except ZeroDivisionError: return 0 i = 0 seed = np.random.randint(1, 10e6)

servasadolph avatar Apr 07 '22 02:04 servasadolph