Repository navigation
Use HTTPS for downloads in download_and_preprocess_coco.sh - #3549
Merged
Merged
Conversation
The COCO preparation script fetched the tensorflow/models repository and the COCO zip archives over plain HTTP. The script then runs Python code from the cloned repository and unzips the archives. Someone on the network path could change these files while they are downloaded. Changes: - Clone tensorflow/models over https://github.com. - Download COCO annotations and images from https://s3.amazonaws.com/images.cocodataset.org. The host name images.cocodataset.org only serves plain HTTP (its TLS certificate does not match), so the script uses the S3 path-style HTTPS URL for the same bucket. The files are the same (same size and ETag). - Use https for the cocodataset.org link in the header comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
tools/datasets/download_and_preprocess_coco.shdownloads code and data over plain HTTP:tensorflow/modelsfromhttp://github.com/...and then runs Python code from that clone (PYTHONPATH=tf-models:tf-models/research).http://images.cocodataset.org/...and unzips them.Plain HTTP is not encrypted or authenticated, so anyone on the network path could change these files while they are downloaded. This PR switches every download in the script to HTTPS.
Modifications
tools/datasets/download_and_preprocess_coco.sh:tensorflow/modelsfromhttps://github.com/tensorflow/models.https://s3.amazonaws.com/images.cocodataset.org/...instead ofhttp://images.cocodataset.org/...(6 URLs: the annotations base URL and the 4 image base URLs, used by 7 downloads in total).https://images.cocodataset.org? That host name serves theimages.cocodataset.orgS3 bucket, but it has no matching TLS certificate, sowgetfails over HTTPS ("no alternative certificate subject name matches"). The S3 path-style URL serves the same bucket over HTTPS with a valid certificate. A short comment in the script explains this.https://cocodataset.org/#overviewfor the link in the header comment.No other behavior changes: same files, same output directories, same TFRecord conversion.
Tests
The full script needs
sudo apt, about 50 GB of disk and hours of conversion, so I checked each changed part on its own:bash -nsyntax checkannotations_trainval2017,image_info_test2017,image_info_unlabeled2017,train2017,val2017,test2017,unlabeled2017) over the new HTTPS URLContent-LengthandETagof the old HTTP URL and the new HTTPS URL for all 7 fileshttps://images.cocodataset.org/...)wget --spideron a new URL (the script useswget)wget -nd -c+unzip -nqofimage_info_test2017.zip(same commands the script uses)image_info_test2017.jsonandimage_info_test-dev2017.jsonextractedgit clone https://github.com/tensorflow/modelsresearch/object_detection/protospresentAccuracy / speed tests
Not applicable. This only changes where the script downloads from. The downloaded files are byte-for-byte the same (same size and ETag), so the generated TFRecords don't change.
Possible follow-ups (not in this PR)
tensorflow/modelsto a fixed commit, so a future upstream change can't break or alter the conversion step.