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

SyntaxError in the file "src/handlers/data_generator.py" #16

Closed
chenjw851009 opened this issue Nov 30, 2018 · 4 comments
Closed

SyntaxError in the file "src/handlers/data_generator.py" #16

chenjw851009 opened this issue Nov 30, 2018 · 4 comments

Comments

@chenjw851009
Copy link

hi , when I run the src code "train.py" ,one error report. this is:

File "/work/imageQuality/image-quality-assessment-master/src/handlers/data_generator.py", line 39
X = np.empty((len(batch_samples), *self.img_crop_dims, 3))

the parameter numbers is 3 or 2 in the function np.empty ?

I just learn python, so may be this is a very simple question for you.
sweet smile! thanks

@chenjw851009
Copy link
Author

the parameter "img_crop_dims=(224,224)",what do the parameter"*self.img_crop_dims"mean?

@chenjw851009
Copy link
Author

I install keras of version 2.1.2, when I train my own model, some error report like this:

=================================================================
Total params: 3,239,114
Trainable params: 10,250
Non-trainable params: 3,228,864


train.py:83: UserWarning: Update your fit_generator call to the Keras 2 API: fit_generator(verbose=1, generator=<handlers...., workers=8, validation_data=<handlers...., epochs=25, callbacks=[<utils.ke..., max_queue_size=30, use_multiprocessing=True)
callbacks=[tensorboard, model_checkpointer])
Epoch 1/25
Traceback (most recent call last):
File "train.py", line 127, in
train(samples=samples, job_dir=job_dir, image_dir=image_dir, **config)
File "train.py", line 83, in train
callbacks=[tensorboard, model_checkpointer])
File "/usr/local/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/keras/engine/training.py", line 2115, in fit_generator
generator_output = next(output_generator)
File "/usr/local/lib/python2.7/site-packages/keras/utils/data_utils.py", line 557, in get
six.raise_from(StopIteration(e), e)
File "/usr/local/lib/python2.7/site-packages/six.py", line 737, in raise_from
raise value
StopIteration: 'module' object has no attribute 'image'

when I run train.py without docker, it ask two other files, "samples.json" and "config.json" ,I copy them from you have provided, but one para in the "config.json" is: "docker_image": "nima-cpu",

{
"train_env": "TID2013",
"s3_bucket": "ds-hotel-image-assessment",
"docker_image": "nima-cpu",
"base_model_name": "MobileNet",
"existing_weights": null,
"n_classes": 10,
"batch_size": 64,
"epochs_train_dense": 25,
"learning_rate_dense": 0.001,
"decay_dense": 0,
"epochs_train_all": 25,
"learning_rate_all": 0.0000003,
"decay_all": 0,
"dropout_rate": 0.75,
"multiprocessing_data_load": true,
"num_workers_data_load": 8,
"img_format": "bmp"
}
there are some para about docker, but I use python without docker, so what I should modify the config.json?? can you tell me how to do?
thanks very much!!!

@chenjw851009
Copy link
Author

I have fixed this issue, but it seems that there is a bug in your source file code which named "data_generator.py",in the line 39.
besides, I run the train.py successfully in the version tensorflow:1.12.0 ,Keras:2.1.6 and python:2.7.12.
however, thanks very much.

@clennan
Copy link
Collaborator

clennan commented Dec 5, 2018

Hi, glad that you got the train.py script running. It seems all your issues are package version related, which is why I recommend to use the provided Docker images for training and predicting.

Line 39 in data_generator.py has no bug I believe, it works fine with the numpy version in the Docker image.

@clennan clennan closed this as completed Dec 5, 2018
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

2 participants