{"action":"created","issue":{"url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/128","repository_url":"https://api.github.com/repos/pierluigiferrari/ssd_keras","labels_url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/128/comments","events_url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/128/events","html_url":"https://github.com/pierluigiferrari/ssd_keras/issues/128","id":328365336,"node_id":"MDU6SXNzdWUzMjgzNjUzMzY=","number":128,"title":"SSD DataGenerator in parallel and Prediction with different sizes of images","user":{"login":"quangdtsc","id":30741785,"node_id":"MDQ6VXNlcjMwNzQxNzg1","avatar_url":"https://avatars0.githubusercontent.com/u/30741785?v=4","gravatar_id":"","url":"https://api.github.com/users/quangdtsc","html_url":"https://github.com/quangdtsc","followers_url":"https://api.github.com/users/quangdtsc/followers","following_url":"https://api.github.com/users/quangdtsc/following{/other_user}","gists_url":"https://api.github.com/users/quangdtsc/gists{/gist_id}","starred_url":"https://api.github.com/users/quangdtsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quangdtsc/subscriptions","organizations_url":"https://api.github.com/users/quangdtsc/orgs","repos_url":"https://api.github.com/users/quangdtsc/repos","events_url":"https://api.github.com/users/quangdtsc/events{/privacy}","received_events_url":"https://api.github.com/users/quangdtsc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-01T03:09:38Z","updated_at":"2018-06-04T18:17:03Z","closed_at":"2018-06-04T18:17:03Z","author_association":"NONE","body":"A question that is **specific to this SSD implementation**.\r\n\r\nThank you so much for such a great work, Ferrari. It supports us a lot in the way of understanding SSD. \r\n\r\nA. **SSD DataGenerator**\r\nTo the best of my knowledge, in Keras, we can generate batches of data for training and evaluating a model by setting the parameter `workers` is some values > 1 in `fit_generator` and `evaluate_generator` methods of the model. After doing that with the Keras SSD model on my machine, I figured out it even slowers the training process. \r\n\r\n1. I'm wondering whether the implementation of DataGenerator for SSD in `object_detection_2d_data_generator.py` can trigger multiple CPUs working to generate batch during training and evaluating the model? If not, how should we modify the code to make it run in parallel seamlessly?\r\n\r\n2. How much time to train a full epoch on PASCAL VOC with SSD512 (The train/val data has 11,530 images containing 27,450 ROI annotated objects of 20 classes.) on average from your experience? The training time on my machine when I set `workers=1` as default using `SSDDataAugmentation` chain as the original paper takes about 1 hour 35 minutes per epoch (the training data size = 11,530 I take all train/val data as train data). My machine configuration: GPU - GeForce GTX 1080 (8GB), 64GB RAM, and CPU E5-2630 (8 cores).\r\n\r\nB. **FULLY CONVOLUTIONAL NETWORK**\r\nAs I witness, SSD might be considered as a fully connected convolutional network which allows us to pass images with different sizes. It is obvious that we should train the model with a fixed image size to take the advantages of training in batch for GPU computation. \r\nHowever, when we want to make a prediction on a new image with arbitrary size, in fact, we don't need to resize the image to feed into the fully CNN model. In Keras implementation, to make this work, we can set the `input_shape = (None, None, 3)` for the input, and build the model like `model = Model(inputs= x, outputs=prediction)`. Then, we load the trained weights for the model without any incompatibility. From this point, we can use the model for making prediction on any images of different sizes.\r\n\r\nIn Caffe implementation, I see that the SSD model works compatibly with any size of images for prediction. But in Keras, we have to specify`img_size` into the `ssd_300` function to build the model. This is because we need this param for passing into `AnchorBox Layer`. \r\nAnytime I need to make a prediction with different size of images, I must define a new model and `load_weights` or `set_weights` for it. A **solution** for it is that we can resize it to the fixed size as training. However, it's somehow better if we can make a prediction on the real scale of objects in images without distortion.\r\n\r\n**So, is there any way to overcome this problem to reduce the overhead of buiding a model and loading weights for it every time on new image?** If possible, I think it will be robust for prediction phase.\r\n\r\nMany thanks for reading this issue."},"comment":{"url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/comments/394449413","html_url":"https://github.com/pierluigiferrari/ssd_keras/issues/128#issuecomment-394449413","issue_url":"https://api.github.com/repos/pierluigiferrari/ssd_keras/issues/128","id":394449413,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDQ0OTQxMw==","user":{"login":"pierluigiferrari","id":17439178,"node_id":"MDQ6VXNlcjE3NDM5MTc4","avatar_url":"https://avatars1.githubusercontent.com/u/17439178?v=4","gravatar_id":"","url":"https://api.github.com/users/pierluigiferrari","html_url":"https://github.com/pierluigiferrari","followers_url":"https://api.github.com/users/pierluigiferrari/followers","following_url":"https://api.github.com/users/pierluigiferrari/following{/other_user}","gists_url":"https://api.github.com/users/pierluigiferrari/gists{/gist_id}","starred_url":"https://api.github.com/users/pierluigiferrari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierluigiferrari/subscriptions","organizations_url":"https://api.github.com/users/pierluigiferrari/orgs","repos_url":"https://api.github.com/users/pierluigiferrari/repos","events_url":"https://api.github.com/users/pierluigiferrari/events{/privacy}","received_events_url":"https://api.github.com/users/pierluigiferrari/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T18:17:03Z","updated_at":"2018-06-04T18:17:03Z","author_association":"OWNER","body":"Anytime. I'll close this for now."}}
{"actor":{"display_login":"pierluigiferrari"}}