apollo icon indicating copy to clipboard operation
apollo copied to clipboard

The code style and bugs of the e2e module

Open gengqx opened this issue 9 years ago • 7 comments

As we have ready know, the e2e module is preleased ahead of the schedule.But the released version is not pecfect,even we can say it's not a good example.I‘m sorry for say those impolite words.I try run the code,and find those:

  1. The code is mix with tensorflow and keras.I guess the original model is used tensorflow,in order to release a public model,then rewrite the model in keras,It seems like this code
with tf.device("/gpu:0/"):

is kind of tensorflow code style,and it did not work with keras model and would raise fault.

  1. The batch_size setting seems unwork, the current batch_size is used to generate batch_size data,but in keras the method model.fit did not specialized the batch_size,when run the model,I set the batch size to be 256,but the GPU memory would just using about 3GB,I it would be effective if using model.fit(...,batch_size = 256,...),I'm not sure the caculating speed of those two seting.According to keras,if you did not sepcialized batch_size,the default would be 32,but indeed,I can see the image number incease from 1 to 256,not jump by 32.

  2. The data read and training pipeline did not have multiprocessing,If I set the batch size to be 4096,and the real traing batch_size is 256,means that an epoch have 16 step.But the data loading from the disk seems very long,about 3 second while the GPU usage is very low.

  3. There need to check if there existed a folder of 'log' and 'modules',if not,make one.

I try my best to run those code,and I'm not really good at codding,I have success train the model.if no one update those code ,I will try to merge my version,but I really hope you guys could make those code peffect.

gengqx avatar Sep 24 '17 05:09 gengqx

Thanks very much for your comments. Please make a pull request of your version and we will add e2e people to review it.

lianglia-apollo avatar Sep 24 '17 10:09 lianglia-apollo

  1. In our platform, if you have created “logs” and “models” directory, the code is running without any errors, Keras on the multi-GPU and distributed support is done through the tensorflow. If there any errors, please post it , together to solve it.
  2. The focus of this open source is the data, so the code is to help developers to quickly understand the open source data format and how to use the open source data. Follow-up we will continue to open our models and algorithms. Of course, you can make a pull request.
  3. The "logs" and "modles" directories have been created and the code is updated.

yanys1 avatar Sep 27 '17 07:09 yanys1

@yanys1 Thank you for the reply, I wonder Where could I find the tensorflow and keras version you are using,currently I'm using tensorflow 1.3 and keras 2.0.8. I see you update your code,and I see you remove the code

with tf.device("/gpu:0"):

but you did not upgrade the multiprocessing code, I implement an version that have multiprocessing,due to the speed of my hard disk is very slow compaired to the compute time by GTX1080 ti,it decrease the computing time by 10~15%.you said that this code is just to understand the data,Do we need to make the code as simple as possible?

gengqx avatar Sep 27 '17 09:09 gengqx

After I run the code and see the code implementation of keras, I found that the default batch_size is 32 and it is effect, just because the number increase so quickly,indeed it is increase by 32.

gengqx avatar Sep 27 '17 09:09 gengqx

@gengqx i'm using tensorflow 1.2 and keras 2.0.7. The jpg decode more time consuming, it is recommended that put the source data and programs on an SSD disk, it will be faster. And you can use the "fit_generator" function to train model.The generator is run in parallel to the model, for efficiency. For instance, this allows you to do real-time data augmentation on images on CPU in parallel to training your model on GPU.

yanys1 avatar Sep 28 '17 07:09 yanys1

@yanys1 Thank you,As I said,I have already implement an version that have multiprocessing.Indeed I referenced the 'fit_generator' method. Here I want to say: We could not use 'fit_generator' method directly.There are two reason for this.
First,Using 'fit_generator',it need the generator to loop over the all the data infinitely,apparently the current generator in Apollo does not satisfy. Second,using 'fit_generator',you need to specify the samples per epoch,currently we did not know how many are the images compared to the other pubic dataset having fixed and known data shape.

gengqx avatar Sep 28 '17 09:09 gengqx

@gengqx The trainsets has 5246135 samples, the testsets is have 125043 samples.

yanys1 avatar Sep 29 '17 10:09 yanys1