Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fit_generator throws error on validation data being float data type #37

Open
adityak6798 opened this issue Feb 7, 2018 · 2 comments
Open

Comments

@adityak6798
Copy link

I'm trying to run CUHK03 Person Re-ID script.
Error text reads as follows:

TypeError Traceback (most recent call last)
in ()
----> 1 main("E:\DL\cuhk-03.h5")

in main(dataset_path)
17 model = generate_model()
18 model = compile_model(model)
---> 19 train(model, dataset_path)
20
21 def train(model,

in train(model, h5_path, weights_name, train_num, one_epoch, epoch_num, flag_random, random_pattern, flag_train, flag_val, which_val_data, nb_val_samples)
39 rand_x = np.random.rand()
40 flag_train = random_pattern(rand_x)
---> 41 model.fit_generator(Data_Generator.flow(f,flag = flag_train),one_epoch,epoch_num,validation_data=Data_Generator.flow(f,train_or_validation=which_val_data,flag=flag_val),nb_val_samples=nb_val_samples)
42 Rank1s.append(round(cmc(model)[0],2))
43 print (Rank1s)

~\Anaconda3\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 ' call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper

~\Anaconda3\lib\site-packages\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
2023 epoch = initial_epoch
2024
-> 2025 do_validation = bool(validation_data)
2026 self._make_train_function()
2027 if do_validation:

TypeError: 'float' object cannot be interpreted as an integer

I am using Jupyter Notebook in Anaconda on Windows 10(x86).
Keras version 2.1.3
Python version 3.6.3
Tensorflow backend (1.4.0)

@bmiftah
Copy link

bmiftah commented Feb 12, 2018

I am not gonna give targeted solution but I guess keras version may be giving you some of the problems .. my bugs were different from your but i was having keras 2.1 > ... I downgrade it to 2.0.0 and issues with keras version were solved... Also , I see your Tensorflow version is also different version to the one on which the model was developed ... you may consider checking the development environment the contributor tested the code on as given here https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID

@abhigoku10
Copy link

@adityak6798 you need to use the keras version 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants