├── .Python ├── .gitignore ├── README.md ├── bin ├── activate ├── activate.csh ├── activate.fish ├── activate_this.py ├── easy_install ├── easy_install-3.6 ├── f2py ├── flask ├── freeze_graph ├── iptest ├── iptest3 ├── ipython ├── ipython3 ├── jsonschema ├── jupyter ├── jupyter-bundlerextension ├── jupyter-console ├── jupyter-kernel ├── jupyter-kernelspec ├── jupyter-migrate ├── jupyter-nbconvert ├── jupyter-nbextension ├── jupyter-notebook ├── jupyter-qtconsole ├── jupyter-run ├── jupyter-serverextension ├── jupyter-troubleshoot ├── jupyter-trust ├── markdown_py ├── pip ├── pip3 ├── pip3.6 ├── pygmentize ├── python ├── python-config ├── python3 ├── python3.6 ├── saved_model_cli ├── tensorboard ├── tflite_convert ├── toco ├── toco_from_protos └── wheel ├── data └── label_map.pbtxt ├── image1.jpg ├── include └── python3.6m ├── object_detection ├── CONTRIBUTING.md ├── README.md ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-36.pyc │ ├── __init__.cpython-37.pyc │ └── exporter.cpython-36.pyc ├── anchor_generators │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── grid_anchor_generator.cpython-36.pyc │ │ ├── grid_anchor_generator.cpython-37.pyc │ │ ├── multiple_grid_anchor_generator.cpython-36.pyc │ │ ├── multiple_grid_anchor_generator.cpython-37.pyc │ │ ├── multiscale_grid_anchor_generator.cpython-36.pyc │ │ └── multiscale_grid_anchor_generator.cpython-37.pyc │ ├── grid_anchor_generator.py │ ├── grid_anchor_generator_test.py │ ├── multiple_grid_anchor_generator.py │ ├── multiple_grid_anchor_generator_test.py │ ├── multiscale_grid_anchor_generator.py │ └── multiscale_grid_anchor_generator_test.py ├── box_coders │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── faster_rcnn_box_coder.cpython-36.pyc │ │ ├── faster_rcnn_box_coder.cpython-37.pyc │ │ ├── keypoint_box_coder.cpython-36.pyc │ │ ├── keypoint_box_coder.cpython-37.pyc │ │ ├── mean_stddev_box_coder.cpython-36.pyc │ │ ├── mean_stddev_box_coder.cpython-37.pyc │ │ ├── square_box_coder.cpython-36.pyc │ │ └── square_box_coder.cpython-37.pyc │ ├── faster_rcnn_box_coder.py │ ├── faster_rcnn_box_coder_test.py │ ├── keypoint_box_coder.py │ ├── keypoint_box_coder_test.py │ ├── mean_stddev_box_coder.py │ ├── mean_stddev_box_coder_test.py │ ├── square_box_coder.py │ └── square_box_coder_test.py ├── builders │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── anchor_generator_builder.cpython-36.pyc │ │ ├── anchor_generator_builder.cpython-37.pyc │ │ ├── box_coder_builder.cpython-36.pyc │ │ ├── box_coder_builder.cpython-37.pyc │ │ ├── box_predictor_builder.cpython-36.pyc │ │ ├── box_predictor_builder.cpython-37.pyc │ │ ├── dataset_builder.cpython-36.pyc │ │ ├── dataset_builder.cpython-37.pyc │ │ ├── graph_rewriter_builder.cpython-36.pyc │ │ ├── graph_rewriter_builder.cpython-37.pyc │ │ ├── hyperparams_builder.cpython-36.pyc │ │ ├── image_resizer_builder.cpython-36.pyc │ │ ├── losses_builder.cpython-36.pyc │ │ ├── matcher_builder.cpython-36.pyc │ │ ├── model_builder.cpython-36.pyc │ │ ├── model_builder.cpython-37.pyc │ │ ├── optimizer_builder.cpython-36.pyc │ │ ├── post_processing_builder.cpython-36.pyc │ │ ├── preprocessor_builder.cpython-36.pyc │ │ └── region_similarity_calculator_builder.cpython-36.pyc │ ├── anchor_generator_builder.py │ ├── anchor_generator_builder_test.py │ ├── box_coder_builder.py │ ├── box_coder_builder_test.py │ ├── box_predictor_builder.py │ ├── box_predictor_builder_test.py │ ├── dataset_builder.py │ ├── dataset_builder_test.py │ ├── graph_rewriter_builder.py │ ├── graph_rewriter_builder_test.py │ ├── hyperparams_builder.py │ ├── hyperparams_builder_test.py │ ├── image_resizer_builder.py │ ├── image_resizer_builder_test.py │ ├── input_reader_builder.py │ ├── input_reader_builder_test.py │ ├── losses_builder.py │ ├── losses_builder_test.py │ ├── matcher_builder.py │ ├── matcher_builder_test.py │ ├── model_builder.py │ ├── model_builder_test.py │ ├── optimizer_builder.py │ ├── optimizer_builder_test.py │ ├── post_processing_builder.py │ ├── post_processing_builder_test.py │ ├── preprocessor_builder.py │ ├── preprocessor_builder_test.py │ ├── region_similarity_calculator_builder.py │ └── region_similarity_calculator_builder_test.py ├── core │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── anchor_generator.cpython-36.pyc │ │ ├── anchor_generator.cpython-37.pyc │ │ ├── balanced_positive_negative_sampler.cpython-36.pyc │ │ ├── batcher.cpython-36.pyc │ │ ├── box_coder.cpython-36.pyc │ │ ├── box_coder.cpython-37.pyc │ │ ├── box_list.cpython-36.pyc │ │ ├── box_list.cpython-37.pyc │ │ ├── box_list_ops.cpython-36.pyc │ │ ├── box_list_ops.cpython-37.pyc │ │ ├── box_predictor.cpython-36.pyc │ │ ├── box_predictor.cpython-37.pyc │ │ ├── data_decoder.cpython-36.pyc │ │ ├── data_decoder.cpython-37.pyc │ │ ├── freezable_batch_norm.cpython-36.pyc │ │ ├── keypoint_ops.cpython-36.pyc │ │ ├── losses.cpython-36.pyc │ │ ├── matcher.cpython-36.pyc │ │ ├── minibatch_sampler.cpython-36.pyc │ │ ├── model.cpython-36.pyc │ │ ├── post_processing.cpython-36.pyc │ │ ├── prefetcher.cpython-36.pyc │ │ ├── preprocessor.cpython-36.pyc │ │ ├── preprocessor_cache.cpython-36.pyc │ │ ├── region_similarity_calculator.cpython-36.pyc │ │ ├── standard_fields.cpython-36.pyc │ │ ├── standard_fields.cpython-37.pyc │ │ └── target_assigner.cpython-36.pyc │ ├── anchor_generator.py │ ├── balanced_positive_negative_sampler.py │ ├── balanced_positive_negative_sampler_test.py │ ├── batcher.py │ ├── batcher_test.py │ ├── box_coder.py │ ├── box_coder_test.py │ ├── box_list.py │ ├── box_list_ops.py │ ├── box_list_ops_test.py │ ├── box_list_test.py │ ├── box_predictor.py │ ├── data_decoder.py │ ├── data_parser.py │ ├── freezable_batch_norm.py │ ├── freezable_batch_norm_test.py │ ├── keypoint_ops.py │ ├── keypoint_ops_test.py │ ├── losses.py │ ├── losses_test.py │ ├── matcher.py │ ├── matcher_test.py │ ├── minibatch_sampler.py │ ├── minibatch_sampler_test.py │ ├── model.py │ ├── post_processing.py │ ├── post_processing_test.py │ ├── prefetcher.py │ ├── prefetcher_test.py │ ├── preprocessor.py │ ├── preprocessor_cache.py │ ├── preprocessor_test.py │ ├── region_similarity_calculator.py │ ├── region_similarity_calculator_test.py │ ├── standard_fields.py │ ├── target_assigner.py │ └── target_assigner_test.py ├── data │ ├── ava_label_map_v2.1.pbtxt │ ├── kitti_label_map.pbtxt │ ├── mscoco_label_map.pbtxt │ ├── oid_bbox_trainable_label_map.pbtxt │ ├── oid_object_detection_challenge_500_label_map.pbtxt │ ├── pascal_label_map.pbtxt │ └── pet_label_map.pbtxt ├── data_decoders │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── tf_example_decoder.cpython-36.pyc │ │ └── tf_example_decoder.cpython-37.pyc │ ├── tf_example_decoder.py │ └── tf_example_decoder_test.py ├── dataset_tools │ ├── __init__.py │ ├── create_coco_tf_record.py │ ├── create_coco_tf_record_test.py │ ├── create_kitti_tf_record.py │ ├── create_kitti_tf_record_test.py │ ├── create_oid_tf_record.py │ ├── create_pascal_tf_record.py │ ├── create_pascal_tf_record_test.py │ ├── create_pet_tf_record.py │ ├── create_pycocotools_package.sh │ ├── download_and_preprocess_mscoco.sh │ ├── oid_hierarchical_labels_expansion.py │ ├── oid_hierarchical_labels_expansion_test.py │ ├── oid_tfrecord_creation.py │ ├── oid_tfrecord_creation_test.py │ ├── tf_record_creation_util.py │ └── tf_record_creation_util_test.py ├── dockerfiles │ └── android │ │ ├── Dockerfile │ │ └── README.md ├── eval.py ├── eval_util.py ├── eval_util_test.py ├── evaluator.py ├── export_inference_graph.py ├── export_tflite_ssd_graph.py ├── export_tflite_ssd_graph_lib.py ├── export_tflite_ssd_graph_lib_test.py ├── exporter.py ├── exporter_test.py ├── g3doc │ ├── challenge_evaluation.md │ ├── configuring_jobs.md │ ├── defining_your_own_model.md │ ├── detection_model_zoo.md │ ├── evaluation_protocols.md │ ├── exporting_models.md │ ├── faq.md │ ├── img │ │ ├── dataset_explorer.png │ │ ├── dogs_detections_output.jpg │ │ ├── example_cat.jpg │ │ ├── groupof_case_eval.png │ │ ├── kites_detections_output.jpg │ │ ├── kites_with_segment_overlay.png │ │ ├── nongroupof_case_eval.png │ │ ├── oid_bus_72e19c28aac34ed8.jpg │ │ ├── oid_monkey_3b4168c89cecbc5b.jpg │ │ ├── oxford_pet.png │ │ ├── tensorboard.png │ │ ├── tensorboard2.png │ │ └── tf-od-api-logo.png │ ├── installation.md │ ├── instance_segmentation.md │ ├── oid_inference_and_evaluation.md │ ├── preparing_inputs.md │ ├── running_locally.md │ ├── running_notebook.md │ ├── running_on_cloud.md │ ├── running_on_mobile_tensorflowlite.md │ ├── running_pets.md │ ├── tpu_compatibility.md │ └── using_your_own_dataset.md ├── inference │ ├── __init__.py │ ├── detection_inference.py │ ├── detection_inference_test.py │ └── infer_detections.py ├── inputs.py ├── inputs_test.py ├── legacy │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── train.cpython-37.pyc │ │ └── trainer.cpython-36.pyc │ ├── eval.py │ ├── evaluator.py │ ├── train.py │ ├── trainer.py │ └── trainer_test.py ├── matchers │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── argmax_matcher.cpython-36.pyc │ │ └── bipartite_matcher.cpython-36.pyc │ ├── argmax_matcher.py │ ├── argmax_matcher_test.py │ ├── bipartite_matcher.py │ └── bipartite_matcher_test.py ├── meta_architectures │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── faster_rcnn_meta_arch.cpython-36.pyc │ │ ├── rfcn_meta_arch.cpython-36.pyc │ │ └── ssd_meta_arch.cpython-36.pyc │ ├── faster_rcnn_meta_arch.py │ ├── faster_rcnn_meta_arch_test.py │ ├── faster_rcnn_meta_arch_test_lib.py │ ├── rfcn_meta_arch.py │ ├── rfcn_meta_arch_test.py │ ├── ssd_meta_arch.py │ └── ssd_meta_arch_test.py ├── metrics │ ├── __init__.py │ ├── coco_evaluation.py │ ├── coco_evaluation_test.py │ ├── coco_tools.py │ ├── coco_tools_test.py │ ├── io_utils.py │ ├── offline_eval_map_corloc.py │ ├── offline_eval_map_corloc_test.py │ ├── oid_od_challenge_evaluation.py │ ├── oid_od_challenge_evaluation_utils.py │ ├── oid_od_challenge_evaluation_utils_test.py │ ├── oid_vrd_challenge_evaluation.py │ ├── oid_vrd_challenge_evaluation_utils.py │ ├── oid_vrd_challenge_evaluation_utils_test.py │ ├── tf_example_parser.py │ └── tf_example_parser_test.py ├── model_hparams.py ├── model_lib.py ├── model_lib_test.py ├── model_main.py ├── model_tpu_main.py ├── models │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── embedded_ssd_mobilenet_v1_feature_extractor.cpython-36.pyc │ │ ├── faster_rcnn_inception_resnet_v2_feature_extractor.cpython-36.pyc │ │ ├── faster_rcnn_inception_v2_feature_extractor.cpython-36.pyc │ │ ├── faster_rcnn_nas_feature_extractor.cpython-36.pyc │ │ ├── faster_rcnn_pnas_feature_extractor.cpython-36.pyc │ │ ├── faster_rcnn_resnet_v1_feature_extractor.cpython-36.pyc │ │ ├── feature_map_generators.cpython-36.pyc │ │ ├── ssd_inception_v2_feature_extractor.cpython-36.pyc │ │ ├── ssd_inception_v3_feature_extractor.cpython-36.pyc │ │ ├── ssd_mobilenet_v1_feature_extractor.cpython-36.pyc │ │ ├── ssd_mobilenet_v1_fpn_feature_extractor.cpython-36.pyc │ │ ├── ssd_mobilenet_v1_ppn_feature_extractor.cpython-36.pyc │ │ ├── ssd_mobilenet_v2_feature_extractor.cpython-36.pyc │ │ ├── ssd_resnet_v1_fpn_feature_extractor.cpython-36.pyc │ │ └── ssd_resnet_v1_ppn_feature_extractor.cpython-36.pyc │ ├── embedded_ssd_mobilenet_v1_feature_extractor.py │ ├── embedded_ssd_mobilenet_v1_feature_extractor_test.py │ ├── faster_rcnn_inception_resnet_v2_feature_extractor.py │ ├── faster_rcnn_inception_resnet_v2_feature_extractor_test.py │ ├── faster_rcnn_inception_v2_feature_extractor.py │ ├── faster_rcnn_inception_v2_feature_extractor_test.py │ ├── faster_rcnn_mobilenet_v1_feature_extractor.py │ ├── faster_rcnn_mobilenet_v1_feature_extractor_test.py │ ├── faster_rcnn_nas_feature_extractor.py │ ├── faster_rcnn_nas_feature_extractor_test.py │ ├── faster_rcnn_pnas_feature_extractor.py │ ├── faster_rcnn_pnas_feature_extractor_test.py │ ├── faster_rcnn_resnet_v1_feature_extractor.py │ ├── faster_rcnn_resnet_v1_feature_extractor_test.py │ ├── feature_map_generators.py │ ├── feature_map_generators_test.py │ ├── ssd_feature_extractor_test.py │ ├── ssd_inception_v2_feature_extractor.py │ ├── ssd_inception_v2_feature_extractor_test.py │ ├── ssd_inception_v3_feature_extractor.py │ ├── ssd_inception_v3_feature_extractor_test.py │ ├── ssd_mobilenet_v1_feature_extractor.py │ ├── ssd_mobilenet_v1_feature_extractor_test.py │ ├── ssd_mobilenet_v1_fpn_feature_extractor.py │ ├── ssd_mobilenet_v1_fpn_feature_extractor_test.py │ ├── ssd_mobilenet_v1_ppn_feature_extractor.py │ ├── ssd_mobilenet_v1_ppn_feature_extractor_test.py │ ├── ssd_mobilenet_v2_feature_extractor.py │ ├── ssd_mobilenet_v2_feature_extractor_test.py │ ├── ssd_resnet_v1_fpn_feature_extractor.py │ ├── ssd_resnet_v1_fpn_feature_extractor_test.py │ ├── ssd_resnet_v1_fpn_feature_extractor_testbase.py │ ├── ssd_resnet_v1_ppn_feature_extractor.py │ ├── ssd_resnet_v1_ppn_feature_extractor_test.py │ └── ssd_resnet_v1_ppn_feature_extractor_testbase.py ├── object_detection_tutorial.ipynb ├── object_detection_tutorial.py ├── output.jpg ├── output1.jpg ├── predictors │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── convolutional_box_predictor.cpython-36.pyc │ │ ├── convolutional_box_predictor.cpython-37.pyc │ │ ├── mask_rcnn_box_predictor.cpython-36.pyc │ │ └── rfcn_box_predictor.cpython-36.pyc │ ├── convolutional_box_predictor.py │ ├── convolutional_box_predictor_test.py │ ├── heads │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── box_head.cpython-36.pyc │ │ │ ├── class_head.cpython-36.pyc │ │ │ ├── head.cpython-36.pyc │ │ │ └── mask_head.cpython-36.pyc │ │ ├── box_head.py │ │ ├── box_head_test.py │ │ ├── class_head.py │ │ ├── class_head_test.py │ │ ├── head.py │ │ ├── keypoint_head.py │ │ ├── keypoint_head_test.py │ │ ├── mask_head.py │ │ └── mask_head_test.py │ ├── mask_rcnn_box_predictor.py │ ├── mask_rcnn_box_predictor_test.py │ ├── rfcn_box_predictor.py │ └── rfcn_box_predictor_test.py ├── protos │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-37.pyc │ │ ├── anchor_generator_pb2.cpython-36.pyc │ │ ├── anchor_generator_pb2.cpython-37.pyc │ │ ├── argmax_matcher_pb2.cpython-36.pyc │ │ ├── bipartite_matcher_pb2.cpython-36.pyc │ │ ├── box_coder_pb2.cpython-36.pyc │ │ ├── box_coder_pb2.cpython-37.pyc │ │ ├── box_predictor_pb2.cpython-36.pyc │ │ ├── eval_pb2.cpython-36.pyc │ │ ├── faster_rcnn_box_coder_pb2.cpython-36.pyc │ │ ├── faster_rcnn_box_coder_pb2.cpython-37.pyc │ │ ├── faster_rcnn_pb2.cpython-36.pyc │ │ ├── graph_rewriter_pb2.cpython-36.pyc │ │ ├── grid_anchor_generator_pb2.cpython-36.pyc │ │ ├── grid_anchor_generator_pb2.cpython-37.pyc │ │ ├── hyperparams_pb2.cpython-36.pyc │ │ ├── image_resizer_pb2.cpython-36.pyc │ │ ├── input_reader_pb2.cpython-36.pyc │ │ ├── input_reader_pb2.cpython-37.pyc │ │ ├── keypoint_box_coder_pb2.cpython-36.pyc │ │ ├── keypoint_box_coder_pb2.cpython-37.pyc │ │ ├── losses_pb2.cpython-36.pyc │ │ ├── matcher_pb2.cpython-36.pyc │ │ ├── mean_stddev_box_coder_pb2.cpython-36.pyc │ │ ├── mean_stddev_box_coder_pb2.cpython-37.pyc │ │ ├── model_pb2.cpython-36.pyc │ │ ├── multiscale_anchor_generator_pb2.cpython-36.pyc │ │ ├── multiscale_anchor_generator_pb2.cpython-37.pyc │ │ ├── optimizer_pb2.cpython-36.pyc │ │ ├── pipeline_pb2.cpython-36.pyc │ │ ├── post_processing_pb2.cpython-36.pyc │ │ ├── preprocessor_pb2.cpython-36.pyc │ │ ├── region_similarity_calculator_pb2.cpython-36.pyc │ │ ├── square_box_coder_pb2.cpython-36.pyc │ │ ├── square_box_coder_pb2.cpython-37.pyc │ │ ├── ssd_anchor_generator_pb2.cpython-36.pyc │ │ ├── ssd_anchor_generator_pb2.cpython-37.pyc │ │ ├── ssd_pb2.cpython-36.pyc │ │ ├── string_int_label_map_pb2.cpython-36.pyc │ │ ├── string_int_label_map_pb2.cpython-37.pyc │ │ └── train_pb2.cpython-36.pyc │ ├── anchor_generator.proto │ ├── anchor_generator_pb2.py │ ├── argmax_matcher.proto │ ├── argmax_matcher_pb2.py │ ├── bipartite_matcher.proto │ ├── bipartite_matcher_pb2.py │ ├── box_coder.proto │ ├── box_coder_pb2.py │ ├── box_predictor.proto │ ├── box_predictor_pb2.py │ ├── eval.proto │ ├── eval_pb2.py │ ├── faster_rcnn.proto │ ├── faster_rcnn_box_coder.proto │ ├── faster_rcnn_box_coder_pb2.py │ ├── faster_rcnn_pb2.py │ ├── graph_rewriter.proto │ ├── graph_rewriter_pb2.py │ ├── grid_anchor_generator.proto │ ├── grid_anchor_generator_pb2.py │ ├── hyperparams.proto │ ├── hyperparams_pb2.py │ ├── image_resizer.proto │ ├── image_resizer_pb2.py │ ├── input_reader.proto │ ├── input_reader_pb2.py │ ├── keypoint_box_coder.proto │ ├── keypoint_box_coder_pb2.py │ ├── losses.proto │ ├── losses_pb2.py │ ├── matcher.proto │ ├── matcher_pb2.py │ ├── mean_stddev_box_coder.proto │ ├── mean_stddev_box_coder_pb2.py │ ├── model.proto │ ├── model_pb2.py │ ├── multiscale_anchor_generator.proto │ ├── multiscale_anchor_generator_pb2.py │ ├── optimizer.proto │ ├── optimizer_pb2.py │ ├── pipeline.proto │ ├── pipeline_pb2.py │ ├── post_processing.proto │ ├── post_processing_pb2.py │ ├── preprocessor.proto │ ├── preprocessor_pb2.py │ ├── region_similarity_calculator.proto │ ├── region_similarity_calculator_pb2.py │ ├── square_box_coder.proto │ ├── square_box_coder_pb2.py │ ├── ssd.proto │ ├── ssd_anchor_generator.proto │ ├── ssd_anchor_generator_pb2.py │ ├── ssd_pb2.py │ ├── string_int_label_map.proto │ ├── string_int_label_map_pb2.py │ ├── train.proto │ └── train_pb2.py ├── templates │ └── index.html ├── test_data │ └── pets_examples.record ├── test_images │ ├── image.jpg │ ├── image1.jpg │ ├── image2.jpg │ └── image_info.txt ├── train.py ├── trainer.py ├── trainer_test.py └── utils │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-36.pyc │ ├── __init__.cpython-37.pyc │ ├── config_util.cpython-36.pyc │ ├── context_manager.cpython-36.pyc │ ├── dataset_util.cpython-36.pyc │ ├── dataset_util.cpython-37.pyc │ ├── label_map_util.cpython-36.pyc │ ├── label_map_util.cpython-37.pyc │ ├── learning_schedules.cpython-36.pyc │ ├── ops.cpython-36.pyc │ ├── ops.cpython-37.pyc │ ├── shape_utils.cpython-36.pyc │ ├── shape_utils.cpython-37.pyc │ ├── static_shape.cpython-36.pyc │ ├── static_shape.cpython-37.pyc │ ├── variables_helper.cpython-36.pyc │ ├── visualization_utils.cpython-36.pyc │ └── visualization_utils.cpython-37.pyc │ ├── category_util.py │ ├── category_util_test.py │ ├── config_util.py │ ├── config_util_test.py │ ├── context_manager.py │ ├── context_manager_test.py │ ├── dataset_util.py │ ├── dataset_util_test.py │ ├── json_utils.py │ ├── json_utils_test.py │ ├── label_map_util.py │ ├── label_map_util_test.py │ ├── learning_schedules.py │ ├── learning_schedules_test.py │ ├── metrics.py │ ├── metrics_test.py │ ├── np_box_list.py │ ├── np_box_list_ops.py │ ├── np_box_list_ops_test.py │ ├── np_box_list_test.py │ ├── np_box_mask_list.py │ ├── np_box_mask_list_ops.py │ ├── np_box_mask_list_ops_test.py │ ├── np_box_mask_list_test.py │ ├── np_box_ops.py │ ├── np_box_ops_test.py │ ├── np_mask_ops.py │ ├── np_mask_ops_test.py │ ├── object_detection_evaluation.py │ ├── object_detection_evaluation_test.py │ ├── ops.py │ ├── ops_test.py │ ├── per_image_evaluation.py │ ├── per_image_evaluation_test.py │ ├── per_image_vrd_evaluation.py │ ├── per_image_vrd_evaluation_test.py │ ├── shape_utils.py │ ├── shape_utils_test.py │ ├── static_shape.py │ ├── static_shape_test.py │ ├── test_case.py │ ├── test_utils.py │ ├── test_utils_test.py │ ├── variables_helper.py │ ├── variables_helper_test.py │ ├── visualization_utils.py │ ├── visualization_utils_test.py │ ├── vrd_evaluation.py │ └── vrd_evaluation_test.py ├── output.jpg └── run.py /.Python: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/.Python -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DeepFashion2 2 | Retrained SSD-resnet50 model to detect multiple fashion items 3 | 4 |

5 | 6 | 7 |

8 | -------------------------------------------------------------------------------- /bin/activate: -------------------------------------------------------------------------------- 1 | # This file must be used with "source bin/activate" *from bash* 2 | # you cannot run it directly 3 | 4 | deactivate () { 5 | unset -f pydoc >/dev/null 2>&1 6 | 7 | # reset old environment variables 8 | # ! [ -z ${VAR+_} ] returns true if VAR is declared at all 9 | if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then 10 | PATH="$_OLD_VIRTUAL_PATH" 11 | export PATH 12 | unset _OLD_VIRTUAL_PATH 13 | fi 14 | if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then 15 | PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" 16 | export PYTHONHOME 17 | unset _OLD_VIRTUAL_PYTHONHOME 18 | fi 19 | 20 | # This should detect bash and zsh, which have a hash command that must 21 | # be called to get it to forget past commands. Without forgetting 22 | # past commands the $PATH changes we made may not be respected 23 | if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then 24 | hash -r 2>/dev/null 25 | fi 26 | 27 | if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then 28 | PS1="$_OLD_VIRTUAL_PS1" 29 | export PS1 30 | unset _OLD_VIRTUAL_PS1 31 | fi 32 | 33 | unset VIRTUAL_ENV 34 | if [ ! "${1-}" = "nondestructive" ] ; then 35 | # Self destruct! 36 | unset -f deactivate 37 | fi 38 | } 39 | 40 | # unset irrelevant variables 41 | deactivate nondestructive 42 | 43 | VIRTUAL_ENV="/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0" 44 | export VIRTUAL_ENV 45 | 46 | _OLD_VIRTUAL_PATH="$PATH" 47 | PATH="$VIRTUAL_ENV/bin:$PATH" 48 | export PATH 49 | 50 | # unset PYTHONHOME if set 51 | if ! [ -z "${PYTHONHOME+_}" ] ; then 52 | _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" 53 | unset PYTHONHOME 54 | fi 55 | 56 | if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then 57 | _OLD_VIRTUAL_PS1="$PS1" 58 | if [ "x" != x ] ; then 59 | PS1="$PS1" 60 | else 61 | PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1" 62 | fi 63 | export PS1 64 | fi 65 | 66 | # Make sure to unalias pydoc if it's already there 67 | alias pydoc 2>/dev/null >/dev/null && unalias pydoc 68 | 69 | pydoc () { 70 | python -m pydoc "$@" 71 | } 72 | 73 | # This should detect bash and zsh, which have a hash command that must 74 | # be called to get it to forget past commands. Without forgetting 75 | # past commands the $PATH changes we made may not be respected 76 | if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then 77 | hash -r 2>/dev/null 78 | fi 79 | -------------------------------------------------------------------------------- /bin/activate.csh: -------------------------------------------------------------------------------- 1 | # This file must be used with "source bin/activate.csh" *from csh*. 2 | # You cannot run it directly. 3 | # Created by Davide Di Blasi . 4 | 5 | alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc' 6 | 7 | # Unset irrelevant variables. 8 | deactivate nondestructive 9 | 10 | setenv VIRTUAL_ENV "/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0" 11 | 12 | set _OLD_VIRTUAL_PATH="$PATH" 13 | setenv PATH "$VIRTUAL_ENV/bin:$PATH" 14 | 15 | 16 | 17 | if ("" != "") then 18 | set env_name = "" 19 | else 20 | set env_name = `basename "$VIRTUAL_ENV"` 21 | endif 22 | 23 | # Could be in a non-interactive environment, 24 | # in which case, $prompt is undefined and we wouldn't 25 | # care about the prompt anyway. 26 | if ( $?prompt ) then 27 | set _OLD_VIRTUAL_PROMPT="$prompt" 28 | set prompt = "[$env_name] $prompt" 29 | endif 30 | 31 | unset env_name 32 | 33 | alias pydoc python -m pydoc 34 | 35 | rehash 36 | 37 | -------------------------------------------------------------------------------- /bin/activate.fish: -------------------------------------------------------------------------------- 1 | # This file must be used using `. bin/activate.fish` *within a running fish ( http://fishshell.com ) session*. 2 | # Do not run it directly. 3 | 4 | function deactivate -d 'Exit virtualenv mode and return to the normal environment.' 5 | # reset old environment variables 6 | if test -n "$_OLD_VIRTUAL_PATH" 7 | set -gx PATH $_OLD_VIRTUAL_PATH 8 | set -e _OLD_VIRTUAL_PATH 9 | end 10 | 11 | if test -n "$_OLD_VIRTUAL_PYTHONHOME" 12 | set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME 13 | set -e _OLD_VIRTUAL_PYTHONHOME 14 | end 15 | 16 | if test -n "$_OLD_FISH_PROMPT_OVERRIDE" 17 | # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`. 18 | set -l fish_function_path 19 | 20 | # Erase virtualenv's `fish_prompt` and restore the original. 21 | functions -e fish_prompt 22 | functions -c _old_fish_prompt fish_prompt 23 | functions -e _old_fish_prompt 24 | set -e _OLD_FISH_PROMPT_OVERRIDE 25 | end 26 | 27 | set -e VIRTUAL_ENV 28 | 29 | if test "$argv[1]" != 'nondestructive' 30 | # Self-destruct! 31 | functions -e pydoc 32 | functions -e deactivate 33 | end 34 | end 35 | 36 | # Unset irrelevant variables. 37 | deactivate nondestructive 38 | 39 | set -gx VIRTUAL_ENV "/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0" 40 | 41 | set -gx _OLD_VIRTUAL_PATH $PATH 42 | set -gx PATH "$VIRTUAL_ENV/bin" $PATH 43 | 44 | # Unset `$PYTHONHOME` if set. 45 | if set -q PYTHONHOME 46 | set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME 47 | set -e PYTHONHOME 48 | end 49 | 50 | function pydoc 51 | python -m pydoc $argv 52 | end 53 | 54 | if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" 55 | # Copy the current `fish_prompt` function as `_old_fish_prompt`. 56 | functions -c fish_prompt _old_fish_prompt 57 | 58 | function fish_prompt 59 | # Save the current $status, for fish_prompts that display it. 60 | set -l old_status $status 61 | 62 | # Prompt override provided? 63 | # If not, just prepend the environment name. 64 | if test -n "" 65 | printf '%s%s' "" (set_color normal) 66 | else 67 | printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV") 68 | end 69 | 70 | # Restore the original $status 71 | echo "exit $old_status" | source 72 | _old_fish_prompt 73 | end 74 | 75 | set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" 76 | end 77 | -------------------------------------------------------------------------------- /bin/activate_this.py: -------------------------------------------------------------------------------- 1 | """By using execfile(this_file, dict(__file__=this_file)) you will 2 | activate this virtualenv environment. 3 | 4 | This can be used when you must use an existing Python interpreter, not 5 | the virtualenv bin/python 6 | """ 7 | 8 | try: 9 | __file__ 10 | except NameError: 11 | raise AssertionError( 12 | "You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))") 13 | import sys 14 | import os 15 | 16 | old_os_path = os.environ.get('PATH', '') 17 | os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path 18 | base = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 19 | if sys.platform == 'win32': 20 | site_packages = os.path.join(base, 'Lib', 'site-packages') 21 | else: 22 | site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages') 23 | prev_sys_path = list(sys.path) 24 | import site 25 | site.addsitedir(site_packages) 26 | sys.real_prefix = sys.prefix 27 | sys.prefix = base 28 | # Move the added items to the front of the path: 29 | new_sys_path = [] 30 | for item in list(sys.path): 31 | if item not in prev_sys_path: 32 | new_sys_path.append(item) 33 | sys.path.remove(item) 34 | sys.path[:0] = new_sys_path 35 | -------------------------------------------------------------------------------- /bin/easy_install: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from setuptools.command.easy_install import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/easy_install-3.6: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from setuptools.command.easy_install import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/f2py: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | # See http://cens.ioc.ee/projects/f2py2e/ 3 | from __future__ import division, print_function 4 | 5 | import os 6 | import sys 7 | for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: 8 | try: 9 | i = sys.argv.index("--" + mode) 10 | del sys.argv[i] 11 | break 12 | except ValueError: 13 | pass 14 | os.environ["NO_SCIPY_IMPORT"] = "f2py" 15 | if mode == "g3-numpy": 16 | sys.stderr.write("G3 f2py support is not implemented, yet.\\n") 17 | sys.exit(1) 18 | elif mode == "2e-numeric": 19 | from f2py2e import main 20 | elif mode == "2e-numarray": 21 | sys.argv.append("-DNUMARRAY") 22 | from f2py2e import main 23 | elif mode == "2e-numpy": 24 | from numpy.f2py import main 25 | else: 26 | sys.stderr.write("Unknown mode: " + repr(mode) + "\\n") 27 | sys.exit(1) 28 | main() 29 | -------------------------------------------------------------------------------- /bin/flask: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from flask.cli import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/freeze_graph: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorflow.python.tools.freeze_graph import run_main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(run_main()) 12 | -------------------------------------------------------------------------------- /bin/iptest: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from IPython.testing.iptestcontroller import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/iptest3: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from IPython.testing.iptestcontroller import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/ipython: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from IPython import start_ipython 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(start_ipython()) 12 | -------------------------------------------------------------------------------- /bin/ipython3: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from IPython import start_ipython 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(start_ipython()) 12 | -------------------------------------------------------------------------------- /bin/jsonschema: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jsonschema.cli import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_core.command import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-bundlerextension: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from notebook.bundler.bundlerextensions import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-console: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_console.app import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-kernel: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_client.kernelapp import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-kernelspec: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_client.kernelspecapp import KernelSpecApp 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(KernelSpecApp.launch_instance()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-migrate: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_core.migrate import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-nbconvert: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from nbconvert.nbconvertapp import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-nbextension: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from notebook.nbextensions import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-notebook: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from notebook.notebookapp import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-qtconsole: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from qtconsole.qtconsoleapp import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-run: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_client.runapp import RunApp 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(RunApp.launch_instance()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-serverextension: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from notebook.serverextensions import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-troubleshoot: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from jupyter_core.troubleshoot import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/jupyter-trust: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from nbformat.sign import TrustNotebookApp 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(TrustNotebookApp.launch_instance()) 12 | -------------------------------------------------------------------------------- /bin/markdown_py: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from markdown.__main__ import run 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(run()) 12 | -------------------------------------------------------------------------------- /bin/pip: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from pip._internal import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/pip3: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from pip._internal import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/pip3.6: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from pip._internal import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/pygmentize: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from pygments.cmdline import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/python: -------------------------------------------------------------------------------- 1 | python3 -------------------------------------------------------------------------------- /bin/python-config: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python 2 | 3 | import sys 4 | import getopt 5 | import sysconfig 6 | 7 | valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 8 | 'ldflags', 'help'] 9 | 10 | if sys.version_info >= (3, 2): 11 | valid_opts.insert(-1, 'extension-suffix') 12 | valid_opts.append('abiflags') 13 | if sys.version_info >= (3, 3): 14 | valid_opts.append('configdir') 15 | 16 | 17 | def exit_with_usage(code=1): 18 | sys.stderr.write("Usage: {0} [{1}]\n".format( 19 | sys.argv[0], '|'.join('--'+opt for opt in valid_opts))) 20 | sys.exit(code) 21 | 22 | try: 23 | opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) 24 | except getopt.error: 25 | exit_with_usage() 26 | 27 | if not opts: 28 | exit_with_usage() 29 | 30 | pyver = sysconfig.get_config_var('VERSION') 31 | getvar = sysconfig.get_config_var 32 | 33 | opt_flags = [flag for (flag, val) in opts] 34 | 35 | if '--help' in opt_flags: 36 | exit_with_usage(code=0) 37 | 38 | for opt in opt_flags: 39 | if opt == '--prefix': 40 | print(sysconfig.get_config_var('prefix')) 41 | 42 | elif opt == '--exec-prefix': 43 | print(sysconfig.get_config_var('exec_prefix')) 44 | 45 | elif opt in ('--includes', '--cflags'): 46 | flags = ['-I' + sysconfig.get_path('include'), 47 | '-I' + sysconfig.get_path('platinclude')] 48 | if opt == '--cflags': 49 | flags.extend(getvar('CFLAGS').split()) 50 | print(' '.join(flags)) 51 | 52 | elif opt in ('--libs', '--ldflags'): 53 | abiflags = getattr(sys, 'abiflags', '') 54 | libs = ['-lpython' + pyver + abiflags] 55 | libs += getvar('LIBS').split() 56 | libs += getvar('SYSLIBS').split() 57 | # add the prefix/lib/pythonX.Y/config dir, but only if there is no 58 | # shared library in prefix/lib/. 59 | if opt == '--ldflags': 60 | if not getvar('Py_ENABLE_SHARED'): 61 | libs.insert(0, '-L' + getvar('LIBPL')) 62 | if not getvar('PYTHONFRAMEWORK'): 63 | libs.extend(getvar('LINKFORSHARED').split()) 64 | print(' '.join(libs)) 65 | 66 | elif opt == '--extension-suffix': 67 | ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') 68 | if ext_suffix is None: 69 | ext_suffix = sysconfig.get_config_var('SO') 70 | print(ext_suffix) 71 | 72 | elif opt == '--abiflags': 73 | if not getattr(sys, 'abiflags', None): 74 | exit_with_usage() 75 | print(sys.abiflags) 76 | 77 | elif opt == '--configdir': 78 | print(sysconfig.get_config_var('LIBPL')) 79 | -------------------------------------------------------------------------------- /bin/python3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/bin/python3 -------------------------------------------------------------------------------- /bin/python3.6: -------------------------------------------------------------------------------- 1 | python3 -------------------------------------------------------------------------------- /bin/saved_model_cli: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorflow.python.tools.saved_model_cli import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/tensorboard: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorboard.main import run_main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(run_main()) 12 | -------------------------------------------------------------------------------- /bin/tflite_convert: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorflow.contrib.lite.python.tflite_convert import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/toco: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorflow.contrib.lite.python.tflite_convert import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/toco_from_protos: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from tensorflow.contrib.lite.toco.python.toco_from_protos import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /bin/wheel: -------------------------------------------------------------------------------- 1 | #!/Users/tzekeonglim/tensorflow-for-poets-2/DeepFashionV2.0/bin/python3 2 | 3 | # -*- coding: utf-8 -*- 4 | import re 5 | import sys 6 | 7 | from wheel.tool import main 8 | 9 | if __name__ == '__main__': 10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 11 | sys.exit(main()) 12 | -------------------------------------------------------------------------------- /data/label_map.pbtxt: -------------------------------------------------------------------------------- 1 | item { 2 | id: 1 3 | name: 't-shirt' 4 | } 5 | item { 6 | id: 2 7 | name: 'plaid-shirt' 8 | } 9 | item { 10 | id: 3 11 | name: 'dress-shirt' 12 | } 13 | item { 14 | id: 4 15 | name: 'polo-shirt' 16 | } 17 | item { 18 | id: 5 19 | name: 'hoodie' 20 | } 21 | item { 22 | id: 6 23 | name: 'sweater' 24 | } 25 | item { 26 | id: 7 27 | name: 'cardigan' 28 | } 29 | item { 30 | id: 8 31 | name: 'blouse' 32 | } 33 | item { 34 | id: 9 35 | name: 'top' 36 | } 37 | item { 38 | id: 10 39 | name: 'dress' 40 | } 41 | item { 42 | id: 11 43 | name: 'jeans' 44 | } 45 | item { 46 | id: 12 47 | name: 'pants' 48 | } 49 | item { 50 | id: 13 51 | name: 'sweatpants' 52 | } 53 | item { 54 | id: 14 55 | name: 'shorts' 56 | } 57 | item { 58 | id: 15 59 | name: 'skirt' 60 | } 61 | item { 62 | id: 16 63 | name: 'dress-pants' 64 | } 65 | item { 66 | id: 17 67 | name: 'leggings' 68 | } 69 | item { 70 | id: 18 71 | name: 'bomber-jacket' 72 | } 73 | item { 74 | id: 19 75 | name: 'midweight-jacket' 76 | } 77 | item { 78 | id: 20 79 | name: 'denim-jacket' 80 | } 81 | item { 82 | id: 21 83 | name: 'leather-jacket' 84 | } 85 | item { 86 | id: 22 87 | name: 'parka' 88 | } 89 | item { 90 | id: 23 91 | name: 'puffer' 92 | } 93 | item { 94 | id: 24 95 | name: 'vest' 96 | } 97 | item { 98 | id: 25 99 | name: 'coat' 100 | } 101 | item { 102 | id: 26 103 | name: 'suit-jacket' 104 | } 105 | item { 106 | id: 27 107 | name: 'suit-vest' 108 | } 109 | 110 | -------------------------------------------------------------------------------- /image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/image1.jpg -------------------------------------------------------------------------------- /include/python3.6m: -------------------------------------------------------------------------------- 1 | /Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -------------------------------------------------------------------------------- /object_detection/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the Tensorflow Object Detection API 2 | 3 | Patches to Tensorflow Object Detection API are welcome! 4 | 5 | We require contributors to fill out either the individual or corporate 6 | Contributor License Agreement (CLA). 7 | 8 | * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). 9 | * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). 10 | 11 | Please follow the 12 | [Tensorflow contributing guidelines](https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md) 13 | when submitting pull requests. 14 | -------------------------------------------------------------------------------- /object_detection/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/__pycache__/exporter.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/__pycache__/exporter.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__init__.py -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/grid_anchor_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/grid_anchor_generator.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/grid_anchor_generator.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/grid_anchor_generator.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/multiple_grid_anchor_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/multiple_grid_anchor_generator.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/multiple_grid_anchor_generator.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/multiple_grid_anchor_generator.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/multiscale_grid_anchor_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/multiscale_grid_anchor_generator.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/anchor_generators/__pycache__/multiscale_grid_anchor_generator.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/anchor_generators/__pycache__/multiscale_grid_anchor_generator.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__init__.py -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/faster_rcnn_box_coder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/faster_rcnn_box_coder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/faster_rcnn_box_coder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/faster_rcnn_box_coder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/keypoint_box_coder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/keypoint_box_coder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/keypoint_box_coder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/keypoint_box_coder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/mean_stddev_box_coder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/mean_stddev_box_coder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/mean_stddev_box_coder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/mean_stddev_box_coder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/square_box_coder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/square_box_coder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/__pycache__/square_box_coder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/box_coders/__pycache__/square_box_coder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/box_coders/mean_stddev_box_coder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Mean stddev box coder. 17 | 18 | This box coder use the following coding schema to encode boxes: 19 | rel_code = (box_corner - anchor_corner_mean) / anchor_corner_stddev. 20 | """ 21 | from object_detection.core import box_coder 22 | from object_detection.core import box_list 23 | 24 | 25 | class MeanStddevBoxCoder(box_coder.BoxCoder): 26 | """Mean stddev box coder.""" 27 | 28 | def __init__(self, stddev=0.01): 29 | """Constructor for MeanStddevBoxCoder. 30 | 31 | Args: 32 | stddev: The standard deviation used to encode and decode boxes. 33 | """ 34 | self._stddev = stddev 35 | 36 | @property 37 | def code_size(self): 38 | return 4 39 | 40 | def _encode(self, boxes, anchors): 41 | """Encode a box collection with respect to anchor collection. 42 | 43 | Args: 44 | boxes: BoxList holding N boxes to be encoded. 45 | anchors: BoxList of N anchors. 46 | 47 | Returns: 48 | a tensor representing N anchor-encoded boxes 49 | 50 | Raises: 51 | ValueError: if the anchors still have deprecated stddev field. 52 | """ 53 | box_corners = boxes.get() 54 | if anchors.has_field('stddev'): 55 | raise ValueError("'stddev' is a parameter of MeanStddevBoxCoder and " 56 | "should not be specified in the box list.") 57 | means = anchors.get() 58 | return (box_corners - means) / self._stddev 59 | 60 | def _decode(self, rel_codes, anchors): 61 | """Decode. 62 | 63 | Args: 64 | rel_codes: a tensor representing N anchor-encoded boxes. 65 | anchors: BoxList of anchors. 66 | 67 | Returns: 68 | boxes: BoxList holding N bounding boxes 69 | 70 | Raises: 71 | ValueError: if the anchors still have deprecated stddev field and expects 72 | the decode method to use stddev value from that field. 73 | """ 74 | means = anchors.get() 75 | if anchors.has_field('stddev'): 76 | raise ValueError("'stddev' is a parameter of MeanStddevBoxCoder and " 77 | "should not be specified in the box list.") 78 | box_corners = rel_codes * self._stddev + means 79 | return box_list.BoxList(box_corners) 80 | -------------------------------------------------------------------------------- /object_detection/box_coders/mean_stddev_box_coder_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.box_coder.mean_stddev_boxcoder.""" 17 | 18 | import tensorflow as tf 19 | 20 | from object_detection.box_coders import mean_stddev_box_coder 21 | from object_detection.core import box_list 22 | 23 | 24 | class MeanStddevBoxCoderTest(tf.test.TestCase): 25 | 26 | def testGetCorrectRelativeCodesAfterEncoding(self): 27 | box_corners = [[0.0, 0.0, 0.5, 0.5], [0.0, 0.0, 0.5, 0.5]] 28 | boxes = box_list.BoxList(tf.constant(box_corners)) 29 | expected_rel_codes = [[0.0, 0.0, 0.0, 0.0], [-5.0, -5.0, -5.0, -3.0]] 30 | prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5], [0.5, 0.5, 1.0, 0.8]]) 31 | priors = box_list.BoxList(prior_means) 32 | 33 | coder = mean_stddev_box_coder.MeanStddevBoxCoder(stddev=0.1) 34 | rel_codes = coder.encode(boxes, priors) 35 | with self.test_session() as sess: 36 | rel_codes_out = sess.run(rel_codes) 37 | self.assertAllClose(rel_codes_out, expected_rel_codes) 38 | 39 | def testGetCorrectBoxesAfterDecoding(self): 40 | rel_codes = tf.constant([[0.0, 0.0, 0.0, 0.0], [-5.0, -5.0, -5.0, -3.0]]) 41 | expected_box_corners = [[0.0, 0.0, 0.5, 0.5], [0.0, 0.0, 0.5, 0.5]] 42 | prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5], [0.5, 0.5, 1.0, 0.8]]) 43 | priors = box_list.BoxList(prior_means) 44 | 45 | coder = mean_stddev_box_coder.MeanStddevBoxCoder(stddev=0.1) 46 | decoded_boxes = coder.decode(rel_codes, priors) 47 | decoded_box_corners = decoded_boxes.get() 48 | with self.test_session() as sess: 49 | decoded_out = sess.run(decoded_box_corners) 50 | self.assertAllClose(decoded_out, expected_box_corners) 51 | 52 | 53 | if __name__ == '__main__': 54 | tf.test.main() 55 | -------------------------------------------------------------------------------- /object_detection/builders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__init__.py -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/anchor_generator_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/anchor_generator_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/anchor_generator_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/anchor_generator_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/box_coder_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/box_coder_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/box_coder_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/box_coder_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/box_predictor_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/box_predictor_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/box_predictor_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/box_predictor_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/dataset_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/dataset_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/dataset_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/dataset_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/graph_rewriter_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/graph_rewriter_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/graph_rewriter_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/graph_rewriter_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/hyperparams_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/hyperparams_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/image_resizer_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/image_resizer_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/losses_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/losses_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/matcher_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/matcher_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/model_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/model_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/model_builder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/model_builder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/optimizer_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/optimizer_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/post_processing_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/post_processing_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/preprocessor_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/preprocessor_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/__pycache__/region_similarity_calculator_builder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/builders/__pycache__/region_similarity_calculator_builder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/builders/box_coder_builder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """A function to build an object detection box coder from configuration.""" 17 | from object_detection.box_coders import faster_rcnn_box_coder 18 | from object_detection.box_coders import keypoint_box_coder 19 | from object_detection.box_coders import mean_stddev_box_coder 20 | from object_detection.box_coders import square_box_coder 21 | from object_detection.protos import box_coder_pb2 22 | 23 | 24 | def build(box_coder_config): 25 | """Builds a box coder object based on the box coder config. 26 | 27 | Args: 28 | box_coder_config: A box_coder.proto object containing the config for the 29 | desired box coder. 30 | 31 | Returns: 32 | BoxCoder based on the config. 33 | 34 | Raises: 35 | ValueError: On empty box coder proto. 36 | """ 37 | if not isinstance(box_coder_config, box_coder_pb2.BoxCoder): 38 | raise ValueError('box_coder_config not of type box_coder_pb2.BoxCoder.') 39 | 40 | if box_coder_config.WhichOneof('box_coder_oneof') == 'faster_rcnn_box_coder': 41 | return faster_rcnn_box_coder.FasterRcnnBoxCoder(scale_factors=[ 42 | box_coder_config.faster_rcnn_box_coder.y_scale, 43 | box_coder_config.faster_rcnn_box_coder.x_scale, 44 | box_coder_config.faster_rcnn_box_coder.height_scale, 45 | box_coder_config.faster_rcnn_box_coder.width_scale 46 | ]) 47 | if box_coder_config.WhichOneof('box_coder_oneof') == 'keypoint_box_coder': 48 | return keypoint_box_coder.KeypointBoxCoder( 49 | box_coder_config.keypoint_box_coder.num_keypoints, 50 | scale_factors=[ 51 | box_coder_config.keypoint_box_coder.y_scale, 52 | box_coder_config.keypoint_box_coder.x_scale, 53 | box_coder_config.keypoint_box_coder.height_scale, 54 | box_coder_config.keypoint_box_coder.width_scale 55 | ]) 56 | if (box_coder_config.WhichOneof('box_coder_oneof') == 57 | 'mean_stddev_box_coder'): 58 | return mean_stddev_box_coder.MeanStddevBoxCoder( 59 | stddev=box_coder_config.mean_stddev_box_coder.stddev) 60 | if box_coder_config.WhichOneof('box_coder_oneof') == 'square_box_coder': 61 | return square_box_coder.SquareBoxCoder(scale_factors=[ 62 | box_coder_config.square_box_coder.y_scale, 63 | box_coder_config.square_box_coder.x_scale, 64 | box_coder_config.square_box_coder.length_scale 65 | ]) 66 | raise ValueError('Empty box coder.') 67 | -------------------------------------------------------------------------------- /object_detection/builders/graph_rewriter_builder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Functions for quantized training and evaluation.""" 16 | 17 | import tensorflow as tf 18 | 19 | 20 | def build(graph_rewriter_config, is_training): 21 | """Returns a function that modifies default graph based on options. 22 | 23 | Args: 24 | graph_rewriter_config: graph_rewriter_pb2.GraphRewriter proto. 25 | is_training: whether in training of eval mode. 26 | """ 27 | def graph_rewrite_fn(): 28 | """Function to quantize weights and activation of the default graph.""" 29 | if (graph_rewriter_config.quantization.weight_bits != 8 or 30 | graph_rewriter_config.quantization.activation_bits != 8): 31 | raise ValueError('Only 8bit quantization is supported') 32 | 33 | # Quantize the graph by inserting quantize ops for weights and activations 34 | if is_training: 35 | tf.contrib.quantize.create_training_graph( 36 | input_graph=tf.get_default_graph(), 37 | quant_delay=graph_rewriter_config.quantization.delay) 38 | else: 39 | tf.contrib.quantize.create_eval_graph(input_graph=tf.get_default_graph()) 40 | 41 | tf.contrib.layers.summarize_collection('quant_vars') 42 | return graph_rewrite_fn 43 | -------------------------------------------------------------------------------- /object_detection/builders/graph_rewriter_builder_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Tests for graph_rewriter_builder.""" 16 | import mock 17 | import tensorflow as tf 18 | from object_detection.builders import graph_rewriter_builder 19 | from object_detection.protos import graph_rewriter_pb2 20 | 21 | 22 | class QuantizationBuilderTest(tf.test.TestCase): 23 | 24 | def testQuantizationBuilderSetsUpCorrectTrainArguments(self): 25 | with mock.patch.object( 26 | tf.contrib.quantize, 'create_training_graph') as mock_quant_fn: 27 | with mock.patch.object(tf.contrib.layers, 28 | 'summarize_collection') as mock_summarize_col: 29 | graph_rewriter_proto = graph_rewriter_pb2.GraphRewriter() 30 | graph_rewriter_proto.quantization.delay = 10 31 | graph_rewriter_proto.quantization.weight_bits = 8 32 | graph_rewriter_proto.quantization.activation_bits = 8 33 | graph_rewrite_fn = graph_rewriter_builder.build( 34 | graph_rewriter_proto, is_training=True) 35 | graph_rewrite_fn() 36 | _, kwargs = mock_quant_fn.call_args 37 | self.assertEqual(kwargs['input_graph'], tf.get_default_graph()) 38 | self.assertEqual(kwargs['quant_delay'], 10) 39 | mock_summarize_col.assert_called_with('quant_vars') 40 | 41 | def testQuantizationBuilderSetsUpCorrectEvalArguments(self): 42 | with mock.patch.object(tf.contrib.quantize, 43 | 'create_eval_graph') as mock_quant_fn: 44 | with mock.patch.object(tf.contrib.layers, 45 | 'summarize_collection') as mock_summarize_col: 46 | graph_rewriter_proto = graph_rewriter_pb2.GraphRewriter() 47 | graph_rewriter_proto.quantization.delay = 10 48 | graph_rewrite_fn = graph_rewriter_builder.build( 49 | graph_rewriter_proto, is_training=False) 50 | graph_rewrite_fn() 51 | _, kwargs = mock_quant_fn.call_args 52 | self.assertEqual(kwargs['input_graph'], tf.get_default_graph()) 53 | mock_summarize_col.assert_called_with('quant_vars') 54 | 55 | 56 | if __name__ == '__main__': 57 | tf.test.main() 58 | -------------------------------------------------------------------------------- /object_detection/builders/matcher_builder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """A function to build an object detection matcher from configuration.""" 17 | 18 | from object_detection.matchers import argmax_matcher 19 | from object_detection.matchers import bipartite_matcher 20 | from object_detection.protos import matcher_pb2 21 | 22 | 23 | def build(matcher_config): 24 | """Builds a matcher object based on the matcher config. 25 | 26 | Args: 27 | matcher_config: A matcher.proto object containing the config for the desired 28 | Matcher. 29 | 30 | Returns: 31 | Matcher based on the config. 32 | 33 | Raises: 34 | ValueError: On empty matcher proto. 35 | """ 36 | if not isinstance(matcher_config, matcher_pb2.Matcher): 37 | raise ValueError('matcher_config not of type matcher_pb2.Matcher.') 38 | if matcher_config.WhichOneof('matcher_oneof') == 'argmax_matcher': 39 | matcher = matcher_config.argmax_matcher 40 | matched_threshold = unmatched_threshold = None 41 | if not matcher.ignore_thresholds: 42 | matched_threshold = matcher.matched_threshold 43 | unmatched_threshold = matcher.unmatched_threshold 44 | return argmax_matcher.ArgMaxMatcher( 45 | matched_threshold=matched_threshold, 46 | unmatched_threshold=unmatched_threshold, 47 | negatives_lower_than_unmatched=matcher.negatives_lower_than_unmatched, 48 | force_match_for_each_row=matcher.force_match_for_each_row, 49 | use_matmul_gather=matcher.use_matmul_gather) 50 | if matcher_config.WhichOneof('matcher_oneof') == 'bipartite_matcher': 51 | matcher = matcher_config.bipartite_matcher 52 | return bipartite_matcher.GreedyBipartiteMatcher(matcher.use_matmul_gather) 53 | raise ValueError('Empty matcher.') 54 | -------------------------------------------------------------------------------- /object_detection/builders/region_similarity_calculator_builder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Builder for region similarity calculators.""" 17 | 18 | from object_detection.core import region_similarity_calculator 19 | from object_detection.protos import region_similarity_calculator_pb2 20 | 21 | 22 | def build(region_similarity_calculator_config): 23 | """Builds region similarity calculator based on the configuration. 24 | 25 | Builds one of [IouSimilarity, IoaSimilarity, NegSqDistSimilarity] objects. See 26 | core/region_similarity_calculator.proto for details. 27 | 28 | Args: 29 | region_similarity_calculator_config: RegionSimilarityCalculator 30 | configuration proto. 31 | 32 | Returns: 33 | region_similarity_calculator: RegionSimilarityCalculator object. 34 | 35 | Raises: 36 | ValueError: On unknown region similarity calculator. 37 | """ 38 | 39 | if not isinstance( 40 | region_similarity_calculator_config, 41 | region_similarity_calculator_pb2.RegionSimilarityCalculator): 42 | raise ValueError( 43 | 'region_similarity_calculator_config not of type ' 44 | 'region_similarity_calculator_pb2.RegionsSimilarityCalculator') 45 | 46 | similarity_calculator = region_similarity_calculator_config.WhichOneof( 47 | 'region_similarity') 48 | if similarity_calculator == 'iou_similarity': 49 | return region_similarity_calculator.IouSimilarity() 50 | if similarity_calculator == 'ioa_similarity': 51 | return region_similarity_calculator.IoaSimilarity() 52 | if similarity_calculator == 'neg_sq_dist_similarity': 53 | return region_similarity_calculator.NegSqDistSimilarity() 54 | if similarity_calculator == 'thresholded_iou_similarity': 55 | return region_similarity_calculator.ThresholdedIouSimilarity( 56 | region_similarity_calculator_config.thresholded_iou_similarity.threshold 57 | ) 58 | 59 | raise ValueError('Unknown region similarity calculator.') 60 | -------------------------------------------------------------------------------- /object_detection/builders/region_similarity_calculator_builder_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for region_similarity_calculator_builder.""" 17 | 18 | import tensorflow as tf 19 | 20 | from google.protobuf import text_format 21 | from object_detection.builders import region_similarity_calculator_builder 22 | from object_detection.core import region_similarity_calculator 23 | from object_detection.protos import region_similarity_calculator_pb2 as sim_calc_pb2 24 | 25 | 26 | class RegionSimilarityCalculatorBuilderTest(tf.test.TestCase): 27 | 28 | def testBuildIoaSimilarityCalculator(self): 29 | similarity_calc_text_proto = """ 30 | ioa_similarity { 31 | } 32 | """ 33 | similarity_calc_proto = sim_calc_pb2.RegionSimilarityCalculator() 34 | text_format.Merge(similarity_calc_text_proto, similarity_calc_proto) 35 | similarity_calc = region_similarity_calculator_builder.build( 36 | similarity_calc_proto) 37 | self.assertTrue(isinstance(similarity_calc, 38 | region_similarity_calculator.IoaSimilarity)) 39 | 40 | def testBuildIouSimilarityCalculator(self): 41 | similarity_calc_text_proto = """ 42 | iou_similarity { 43 | } 44 | """ 45 | similarity_calc_proto = sim_calc_pb2.RegionSimilarityCalculator() 46 | text_format.Merge(similarity_calc_text_proto, similarity_calc_proto) 47 | similarity_calc = region_similarity_calculator_builder.build( 48 | similarity_calc_proto) 49 | self.assertTrue(isinstance(similarity_calc, 50 | region_similarity_calculator.IouSimilarity)) 51 | 52 | def testBuildNegSqDistSimilarityCalculator(self): 53 | similarity_calc_text_proto = """ 54 | neg_sq_dist_similarity { 55 | } 56 | """ 57 | similarity_calc_proto = sim_calc_pb2.RegionSimilarityCalculator() 58 | text_format.Merge(similarity_calc_text_proto, similarity_calc_proto) 59 | similarity_calc = region_similarity_calculator_builder.build( 60 | similarity_calc_proto) 61 | self.assertTrue(isinstance(similarity_calc, 62 | region_similarity_calculator. 63 | NegSqDistSimilarity)) 64 | 65 | 66 | if __name__ == '__main__': 67 | tf.test.main() 68 | -------------------------------------------------------------------------------- /object_detection/core/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /object_detection/core/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/anchor_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/anchor_generator.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/anchor_generator.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/anchor_generator.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/balanced_positive_negative_sampler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/balanced_positive_negative_sampler.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/batcher.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/batcher.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_coder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_coder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_coder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_coder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_list.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_list.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_list.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_list.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_list_ops.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_list_ops.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_list_ops.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_list_ops.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_predictor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_predictor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/box_predictor.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/box_predictor.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/data_decoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/data_decoder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/data_decoder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/data_decoder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/freezable_batch_norm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/freezable_batch_norm.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/keypoint_ops.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/keypoint_ops.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/losses.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/losses.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/matcher.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/matcher.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/minibatch_sampler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/minibatch_sampler.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/model.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/post_processing.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/post_processing.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/prefetcher.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/prefetcher.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/preprocessor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/preprocessor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/preprocessor_cache.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/preprocessor_cache.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/region_similarity_calculator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/region_similarity_calculator.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/standard_fields.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/standard_fields.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/standard_fields.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/standard_fields.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/core/__pycache__/target_assigner.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/core/__pycache__/target_assigner.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/core/box_coder_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.core.box_coder.""" 17 | 18 | import tensorflow as tf 19 | 20 | from object_detection.core import box_coder 21 | from object_detection.core import box_list 22 | 23 | 24 | class MockBoxCoder(box_coder.BoxCoder): 25 | """Test BoxCoder that encodes/decodes using the multiply-by-two function.""" 26 | 27 | def code_size(self): 28 | return 4 29 | 30 | def _encode(self, boxes, anchors): 31 | return 2.0 * boxes.get() 32 | 33 | def _decode(self, rel_codes, anchors): 34 | return box_list.BoxList(rel_codes / 2.0) 35 | 36 | 37 | class BoxCoderTest(tf.test.TestCase): 38 | 39 | def test_batch_decode(self): 40 | mock_anchor_corners = tf.constant( 41 | [[0, 0.1, 0.2, 0.3], [0.2, 0.4, 0.4, 0.6]], tf.float32) 42 | mock_anchors = box_list.BoxList(mock_anchor_corners) 43 | mock_box_coder = MockBoxCoder() 44 | 45 | expected_boxes = [[[0.0, 0.1, 0.5, 0.6], [0.5, 0.6, 0.7, 0.8]], 46 | [[0.1, 0.2, 0.3, 0.4], [0.7, 0.8, 0.9, 1.0]]] 47 | 48 | encoded_boxes_list = [mock_box_coder.encode( 49 | box_list.BoxList(tf.constant(boxes)), mock_anchors) 50 | for boxes in expected_boxes] 51 | encoded_boxes = tf.stack(encoded_boxes_list) 52 | decoded_boxes = box_coder.batch_decode( 53 | encoded_boxes, mock_box_coder, mock_anchors) 54 | 55 | with self.test_session() as sess: 56 | decoded_boxes_result = sess.run(decoded_boxes) 57 | self.assertAllClose(expected_boxes, decoded_boxes_result) 58 | 59 | 60 | if __name__ == '__main__': 61 | tf.test.main() 62 | -------------------------------------------------------------------------------- /object_detection/core/data_decoder.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Interface for data decoders. 17 | 18 | Data decoders decode the input data and return a dictionary of tensors keyed by 19 | the entries in core.reader.Fields. 20 | """ 21 | from abc import ABCMeta 22 | from abc import abstractmethod 23 | 24 | 25 | class DataDecoder(object): 26 | """Interface for data decoders.""" 27 | __metaclass__ = ABCMeta 28 | 29 | @abstractmethod 30 | def decode(self, data): 31 | """Return a single image and associated labels. 32 | 33 | Args: 34 | data: a string tensor holding a serialized protocol buffer corresponding 35 | to data for a single image. 36 | 37 | Returns: 38 | tensor_dict: a dictionary containing tensors. Possible keys are defined in 39 | reader.Fields. 40 | """ 41 | pass 42 | -------------------------------------------------------------------------------- /object_detection/core/data_parser.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Interface for data parsers. 16 | 17 | Data parser parses input data and returns a dictionary of numpy arrays 18 | keyed by the entries in standard_fields.py. Since the parser parses records 19 | to numpy arrays (materialized tensors) directly, it is used to read data for 20 | evaluation/visualization; to parse the data during training, DataDecoder should 21 | be used. 22 | """ 23 | from abc import ABCMeta 24 | from abc import abstractmethod 25 | 26 | 27 | class DataToNumpyParser(object): 28 | __metaclass__ = ABCMeta 29 | 30 | @abstractmethod 31 | def parse(self, input_data): 32 | """Parses input and returns a numpy array or a dictionary of numpy arrays. 33 | 34 | Args: 35 | input_data: an input data 36 | 37 | Returns: 38 | A numpy array or a dictionary of numpy arrays or None, if input 39 | cannot be parsed. 40 | """ 41 | pass 42 | -------------------------------------------------------------------------------- /object_detection/core/prefetcher.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Provides functions to prefetch tensors to feed into models.""" 17 | import tensorflow as tf 18 | 19 | 20 | def prefetch(tensor_dict, capacity): 21 | """Creates a prefetch queue for tensors. 22 | 23 | Creates a FIFO queue to asynchronously enqueue tensor_dicts and returns a 24 | dequeue op that evaluates to a tensor_dict. This function is useful in 25 | prefetching preprocessed tensors so that the data is readily available for 26 | consumers. 27 | 28 | Example input pipeline when you don't need batching: 29 | ---------------------------------------------------- 30 | key, string_tensor = slim.parallel_reader.parallel_read(...) 31 | tensor_dict = decoder.decode(string_tensor) 32 | tensor_dict = preprocessor.preprocess(tensor_dict, ...) 33 | prefetch_queue = prefetcher.prefetch(tensor_dict, capacity=20) 34 | tensor_dict = prefetch_queue.dequeue() 35 | outputs = Model(tensor_dict) 36 | ... 37 | ---------------------------------------------------- 38 | 39 | For input pipelines with batching, refer to core/batcher.py 40 | 41 | Args: 42 | tensor_dict: a dictionary of tensors to prefetch. 43 | capacity: the size of the prefetch queue. 44 | 45 | Returns: 46 | a FIFO prefetcher queue 47 | """ 48 | names = list(tensor_dict.keys()) 49 | dtypes = [t.dtype for t in tensor_dict.values()] 50 | shapes = [t.get_shape() for t in tensor_dict.values()] 51 | prefetch_queue = tf.PaddingFIFOQueue(capacity, dtypes=dtypes, 52 | shapes=shapes, 53 | names=names, 54 | name='prefetch_queue') 55 | enqueue_op = prefetch_queue.enqueue(tensor_dict) 56 | tf.train.queue_runner.add_queue_runner(tf.train.queue_runner.QueueRunner( 57 | prefetch_queue, [enqueue_op])) 58 | tf.summary.scalar('queue/%s/fraction_of_%d_full' % (prefetch_queue.name, 59 | capacity), 60 | tf.to_float(prefetch_queue.size()) * (1. / capacity)) 61 | return prefetch_queue 62 | -------------------------------------------------------------------------------- /object_detection/data/kitti_label_map.pbtxt: -------------------------------------------------------------------------------- 1 | item { 2 | id: 1 3 | name: 'car' 4 | } 5 | 6 | item { 7 | id: 2 8 | name: 'pedestrian' 9 | } 10 | -------------------------------------------------------------------------------- /object_detection/data/pascal_label_map.pbtxt: -------------------------------------------------------------------------------- 1 | item { 2 | id: 1 3 | name: 'aeroplane' 4 | } 5 | 6 | item { 7 | id: 2 8 | name: 'bicycle' 9 | } 10 | 11 | item { 12 | id: 3 13 | name: 'bird' 14 | } 15 | 16 | item { 17 | id: 4 18 | name: 'boat' 19 | } 20 | 21 | item { 22 | id: 5 23 | name: 'bottle' 24 | } 25 | 26 | item { 27 | id: 6 28 | name: 'bus' 29 | } 30 | 31 | item { 32 | id: 7 33 | name: 'car' 34 | } 35 | 36 | item { 37 | id: 8 38 | name: 'cat' 39 | } 40 | 41 | item { 42 | id: 9 43 | name: 'chair' 44 | } 45 | 46 | item { 47 | id: 10 48 | name: 'cow' 49 | } 50 | 51 | item { 52 | id: 11 53 | name: 'diningtable' 54 | } 55 | 56 | item { 57 | id: 12 58 | name: 'dog' 59 | } 60 | 61 | item { 62 | id: 13 63 | name: 'horse' 64 | } 65 | 66 | item { 67 | id: 14 68 | name: 'motorbike' 69 | } 70 | 71 | item { 72 | id: 15 73 | name: 'person' 74 | } 75 | 76 | item { 77 | id: 16 78 | name: 'pottedplant' 79 | } 80 | 81 | item { 82 | id: 17 83 | name: 'sheep' 84 | } 85 | 86 | item { 87 | id: 18 88 | name: 'sofa' 89 | } 90 | 91 | item { 92 | id: 19 93 | name: 'train' 94 | } 95 | 96 | item { 97 | id: 20 98 | name: 'tvmonitor' 99 | } 100 | -------------------------------------------------------------------------------- /object_detection/data/pet_label_map.pbtxt: -------------------------------------------------------------------------------- 1 | item { 2 | id: 1 3 | name: 'Abyssinian' 4 | } 5 | 6 | item { 7 | id: 2 8 | name: 'american_bulldog' 9 | } 10 | 11 | item { 12 | id: 3 13 | name: 'american_pit_bull_terrier' 14 | } 15 | 16 | item { 17 | id: 4 18 | name: 'basset_hound' 19 | } 20 | 21 | item { 22 | id: 5 23 | name: 'beagle' 24 | } 25 | 26 | item { 27 | id: 6 28 | name: 'Bengal' 29 | } 30 | 31 | item { 32 | id: 7 33 | name: 'Birman' 34 | } 35 | 36 | item { 37 | id: 8 38 | name: 'Bombay' 39 | } 40 | 41 | item { 42 | id: 9 43 | name: 'boxer' 44 | } 45 | 46 | item { 47 | id: 10 48 | name: 'British_Shorthair' 49 | } 50 | 51 | item { 52 | id: 11 53 | name: 'chihuahua' 54 | } 55 | 56 | item { 57 | id: 12 58 | name: 'Egyptian_Mau' 59 | } 60 | 61 | item { 62 | id: 13 63 | name: 'english_cocker_spaniel' 64 | } 65 | 66 | item { 67 | id: 14 68 | name: 'english_setter' 69 | } 70 | 71 | item { 72 | id: 15 73 | name: 'german_shorthaired' 74 | } 75 | 76 | item { 77 | id: 16 78 | name: 'great_pyrenees' 79 | } 80 | 81 | item { 82 | id: 17 83 | name: 'havanese' 84 | } 85 | 86 | item { 87 | id: 18 88 | name: 'japanese_chin' 89 | } 90 | 91 | item { 92 | id: 19 93 | name: 'keeshond' 94 | } 95 | 96 | item { 97 | id: 20 98 | name: 'leonberger' 99 | } 100 | 101 | item { 102 | id: 21 103 | name: 'Maine_Coon' 104 | } 105 | 106 | item { 107 | id: 22 108 | name: 'miniature_pinscher' 109 | } 110 | 111 | item { 112 | id: 23 113 | name: 'newfoundland' 114 | } 115 | 116 | item { 117 | id: 24 118 | name: 'Persian' 119 | } 120 | 121 | item { 122 | id: 25 123 | name: 'pomeranian' 124 | } 125 | 126 | item { 127 | id: 26 128 | name: 'pug' 129 | } 130 | 131 | item { 132 | id: 27 133 | name: 'Ragdoll' 134 | } 135 | 136 | item { 137 | id: 28 138 | name: 'Russian_Blue' 139 | } 140 | 141 | item { 142 | id: 29 143 | name: 'saint_bernard' 144 | } 145 | 146 | item { 147 | id: 30 148 | name: 'samoyed' 149 | } 150 | 151 | item { 152 | id: 31 153 | name: 'scottish_terrier' 154 | } 155 | 156 | item { 157 | id: 32 158 | name: 'shiba_inu' 159 | } 160 | 161 | item { 162 | id: 33 163 | name: 'Siamese' 164 | } 165 | 166 | item { 167 | id: 34 168 | name: 'Sphynx' 169 | } 170 | 171 | item { 172 | id: 35 173 | name: 'staffordshire_bull_terrier' 174 | } 175 | 176 | item { 177 | id: 36 178 | name: 'wheaten_terrier' 179 | } 180 | 181 | item { 182 | id: 37 183 | name: 'yorkshire_terrier' 184 | } 185 | -------------------------------------------------------------------------------- /object_detection/data_decoders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/data_decoders/__init__.py -------------------------------------------------------------------------------- /object_detection/data_decoders/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/data_decoders/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/data_decoders/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/data_decoders/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/data_decoders/__pycache__/tf_example_decoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/data_decoders/__pycache__/tf_example_decoder.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/data_decoders/__pycache__/tf_example_decoder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/data_decoders/__pycache__/tf_example_decoder.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/dataset_tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/dataset_tools/__init__.py -------------------------------------------------------------------------------- /object_detection/dataset_tools/create_pycocotools_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # ============================================================================== 16 | 17 | # Script to download pycocotools and make package for CMLE jobs. 18 | # 19 | # usage: 20 | # bash object_detection/dataset_tools/create_pycocotools_package.sh \ 21 | # /tmp/pycocotools 22 | set -e 23 | 24 | if [ -z "$1" ]; then 25 | echo "usage create_pycocotools_package.sh [output dir]" 26 | exit 27 | fi 28 | 29 | # Create the output directory. 30 | OUTPUT_DIR="${1%/}" 31 | SCRATCH_DIR="${OUTPUT_DIR}/raw" 32 | mkdir -p "${OUTPUT_DIR}" 33 | mkdir -p "${SCRATCH_DIR}" 34 | 35 | cd ${SCRATCH_DIR} 36 | git clone https://github.com/cocodataset/cocoapi.git 37 | cd cocoapi/PythonAPI && mv ../common ./ 38 | 39 | sed "s/\.\.\/common/common/g" setup.py > setup.py.updated 40 | cp -f setup.py.updated setup.py 41 | rm setup.py.updated 42 | 43 | sed "s/\.\.\/common/common/g" pycocotools/_mask.pyx > _mask.pyx.updated 44 | cp -f _mask.pyx.updated pycocotools/_mask.pyx 45 | rm _mask.pyx.updated 46 | 47 | sed "s/import matplotlib\.pyplot as plt/import matplotlib\nmatplotlib\.use\(\'Agg\'\)\nimport matplotlib\.pyplot as plt/g" pycocotools/coco.py > coco.py.updated 48 | cp -f coco.py.updated pycocotools/coco.py 49 | rm coco.py.updated 50 | 51 | cd "${OUTPUT_DIR}" 52 | tar -czf pycocotools-2.0.tar.gz -C "${SCRATCH_DIR}/cocoapi/" PythonAPI/ 53 | rm -rf ${SCRATCH_DIR} 54 | -------------------------------------------------------------------------------- /object_detection/dataset_tools/tf_record_creation_util.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | r"""Utilities for creating TFRecords of TF examples for the Open Images dataset. 16 | """ 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import tensorflow as tf 22 | 23 | 24 | def open_sharded_output_tfrecords(exit_stack, base_path, num_shards): 25 | """Opens all TFRecord shards for writing and adds them to an exit stack. 26 | 27 | Args: 28 | exit_stack: A context2.ExitStack used to automatically closed the TFRecords 29 | opened in this function. 30 | base_path: The base path for all shards 31 | num_shards: The number of shards 32 | 33 | Returns: 34 | The list of opened TFRecords. Position k in the list corresponds to shard k. 35 | """ 36 | tf_record_output_filenames = [ 37 | '{}-{:05d}-of-{:05d}'.format(base_path, idx, num_shards) 38 | for idx in range(num_shards) 39 | ] 40 | 41 | tfrecords = [ 42 | exit_stack.enter_context(tf.python_io.TFRecordWriter(file_name)) 43 | for file_name in tf_record_output_filenames 44 | ] 45 | 46 | return tfrecords 47 | -------------------------------------------------------------------------------- /object_detection/dataset_tools/tf_record_creation_util_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Tests for tf_record_creation_util.py.""" 16 | 17 | import os 18 | import contextlib2 19 | import tensorflow as tf 20 | 21 | from object_detection.dataset_tools import tf_record_creation_util 22 | 23 | 24 | class OpenOutputTfrecordsTests(tf.test.TestCase): 25 | 26 | def test_sharded_tfrecord_writes(self): 27 | with contextlib2.ExitStack() as tf_record_close_stack: 28 | output_tfrecords = tf_record_creation_util.open_sharded_output_tfrecords( 29 | tf_record_close_stack, 30 | os.path.join(tf.test.get_temp_dir(), 'test.tfrec'), 10) 31 | for idx in range(10): 32 | output_tfrecords[idx].write('test_{}'.format(idx)) 33 | 34 | for idx in range(10): 35 | tf_record_path = '{}-{:05d}-of-00010'.format( 36 | os.path.join(tf.test.get_temp_dir(), 'test.tfrec'), idx) 37 | records = list(tf.python_io.tf_record_iterator(tf_record_path)) 38 | self.assertAllEqual(records, ['test_{}'.format(idx)]) 39 | 40 | 41 | if __name__ == '__main__': 42 | tf.test.main() 43 | -------------------------------------------------------------------------------- /object_detection/g3doc/exporting_models.md: -------------------------------------------------------------------------------- 1 | # Exporting a trained model for inference 2 | 3 | After your model has been trained, you should export it to a Tensorflow 4 | graph proto. A checkpoint will typically consist of three files: 5 | 6 | * model.ckpt-${CHECKPOINT_NUMBER}.data-00000-of-00001 7 | * model.ckpt-${CHECKPOINT_NUMBER}.index 8 | * model.ckpt-${CHECKPOINT_NUMBER}.meta 9 | 10 | After you've identified a candidate checkpoint to export, run the following 11 | command from tensorflow/models/research: 12 | 13 | ``` bash 14 | # From tensorflow/models/research/ 15 | INPUT_TYPE=image_tensor 16 | PIPELINE_CONFIG_PATH={path to pipeline config file} 17 | TRAINED_CKPT_PREFIX={path to model.ckpt} 18 | EXPORT_DIR={path to folder that will be used for export} 19 | python object_detection/export_inference_graph.py \ 20 | --input_type=${INPUT_TYPE} \ 21 | --pipeline_config_path=${PIPELINE_CONFIG_PATH} \ 22 | --trained_checkpoint_prefix=${TRAINED_CKPT_PREFIX} \ 23 | --output_directory=${EXPORT_DIR} 24 | ``` 25 | 26 | NOTE: We are configuring our exported model to ingest 4-D image tensors. We can 27 | also configure the exported model to take encoded images or serialized 28 | `tf.Example`s. 29 | 30 | After export, you should see the directory ${EXPORT_DIR} containing the following: 31 | 32 | * saved_model/, a directory containing the saved model format of the exported model 33 | * frozen_inference_graph.pb, the frozen graph format of the exported model 34 | * model.ckpt.*, the model checkpoints used for exporting 35 | * checkpoint, a file specifying to restore included checkpoint files 36 | * pipeline.config, pipeline config file for the exported model 37 | -------------------------------------------------------------------------------- /object_detection/g3doc/faq.md: -------------------------------------------------------------------------------- 1 | # Frequently Asked Questions 2 | 3 | ## Q: How can I ensure that all the groundtruth boxes are used during train and eval? 4 | A: For the object detecion framework to be TPU-complient, we must pad our input 5 | tensors to static shapes. This means that we must pad to a fixed number of 6 | bounding boxes, configured by `InputReader.max_number_of_boxes`. It is 7 | important to set this value to a number larger than the maximum number of 8 | groundtruth boxes in the dataset. If an image is encountered with more 9 | bounding boxes, the excess boxes will be clipped. 10 | 11 | ## Q: AttributeError: 'module' object has no attribute 'BackupHandler' 12 | A: This BackupHandler (tf.contrib.slim.tfexample_decoder.BackupHandler) was 13 | introduced in tensorflow 1.5.0 so runing with earlier versions may cause this 14 | issue. It now has been replaced by 15 | object_detection.data_decoders.tf_example_decoder.BackupHandler. Whoever sees 16 | this issue should be able to resolve it by syncing your fork to HEAD. 17 | Same for LookupTensor. 18 | 19 | ## Q: AttributeError: 'module' object has no attribute 'LookupTensor' 20 | A: Similar to BackupHandler, syncing your fork to HEAD should make it work. 21 | 22 | ## Q: Why can't I get the inference time as reported in model zoo? 23 | A: The inference time reported in model zoo is mean time of testing hundreds of 24 | images with an internal machine. As mentioned in 25 | [Tensorflow detection model zoo](detection_model_zoo.md), this speed depends 26 | highly on one's specific hardware configuration and should be treated more as 27 | relative timing. 28 | -------------------------------------------------------------------------------- /object_detection/g3doc/img/dataset_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/dataset_explorer.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/dogs_detections_output.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/dogs_detections_output.jpg -------------------------------------------------------------------------------- /object_detection/g3doc/img/example_cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/example_cat.jpg -------------------------------------------------------------------------------- /object_detection/g3doc/img/groupof_case_eval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/groupof_case_eval.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/kites_detections_output.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/kites_detections_output.jpg -------------------------------------------------------------------------------- /object_detection/g3doc/img/kites_with_segment_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/kites_with_segment_overlay.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/nongroupof_case_eval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/nongroupof_case_eval.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/oid_bus_72e19c28aac34ed8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/oid_bus_72e19c28aac34ed8.jpg -------------------------------------------------------------------------------- /object_detection/g3doc/img/oid_monkey_3b4168c89cecbc5b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/oid_monkey_3b4168c89cecbc5b.jpg -------------------------------------------------------------------------------- /object_detection/g3doc/img/oxford_pet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/oxford_pet.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/tensorboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/tensorboard.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/tensorboard2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/tensorboard2.png -------------------------------------------------------------------------------- /object_detection/g3doc/img/tf-od-api-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/g3doc/img/tf-od-api-logo.png -------------------------------------------------------------------------------- /object_detection/g3doc/preparing_inputs.md: -------------------------------------------------------------------------------- 1 | # Preparing Inputs 2 | 3 | Tensorflow Object Detection API reads data using the TFRecord file format. Two 4 | sample scripts (`create_pascal_tf_record.py` and `create_pet_tf_record.py`) are 5 | provided to convert from the PASCAL VOC dataset and Oxford-IIIT Pet dataset to 6 | TFRecords. 7 | 8 | ## Generating the PASCAL VOC TFRecord files. 9 | 10 | The raw 2012 PASCAL VOC data set is located 11 | [here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar). 12 | To download, extract and convert it to TFRecords, run the following commands 13 | below: 14 | 15 | ```bash 16 | # From tensorflow/models/research/ 17 | wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar 18 | tar -xvf VOCtrainval_11-May-2012.tar 19 | python object_detection/dataset_tools/create_pascal_tf_record.py \ 20 | --label_map_path=object_detection/data/pascal_label_map.pbtxt \ 21 | --data_dir=VOCdevkit --year=VOC2012 --set=train \ 22 | --output_path=pascal_train.record 23 | python object_detection/dataset_tools/create_pascal_tf_record.py \ 24 | --label_map_path=object_detection/data/pascal_label_map.pbtxt \ 25 | --data_dir=VOCdevkit --year=VOC2012 --set=val \ 26 | --output_path=pascal_val.record 27 | ``` 28 | 29 | You should end up with two TFRecord files named `pascal_train.record` and 30 | `pascal_val.record` in the `tensorflow/models/research/` directory. 31 | 32 | The label map for the PASCAL VOC data set can be found at 33 | `object_detection/data/pascal_label_map.pbtxt`. 34 | 35 | ## Generating the Oxford-IIIT Pet TFRecord files. 36 | 37 | The Oxford-IIIT Pet data set is located 38 | [here](http://www.robots.ox.ac.uk/~vgg/data/pets/). To download, extract and 39 | convert it to TFRecrods, run the following commands below: 40 | 41 | ```bash 42 | # From tensorflow/models/research/ 43 | wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz 44 | wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz 45 | tar -xvf annotations.tar.gz 46 | tar -xvf images.tar.gz 47 | python object_detection/dataset_tools/create_pet_tf_record.py \ 48 | --label_map_path=object_detection/data/pet_label_map.pbtxt \ 49 | --data_dir=`pwd` \ 50 | --output_dir=`pwd` 51 | ``` 52 | 53 | You should end up with two 10-sharded TFRecord files named 54 | `pet_faces_train.record-?????-of-00010` and 55 | `pet_faces_val.record-?????-of-00010` in the `tensorflow/models/research/` 56 | directory. 57 | 58 | The label map for the Pet dataset can be found at 59 | `object_detection/data/pet_label_map.pbtxt`. 60 | -------------------------------------------------------------------------------- /object_detection/g3doc/running_locally.md: -------------------------------------------------------------------------------- 1 | # Running Locally 2 | 3 | This page walks through the steps required to train an object detection model 4 | on a local machine. It assumes the reader has completed the 5 | following prerequisites: 6 | 7 | 1. The Tensorflow Object Detection API has been installed as documented in the 8 | [installation instructions](installation.md). This includes installing library 9 | dependencies, compiling the configuration protobufs and setting up the Python 10 | environment. 11 | 2. A valid data set has been created. See [this page](preparing_inputs.md) for 12 | instructions on how to generate a dataset for the PASCAL VOC challenge or the 13 | Oxford-IIIT Pet dataset. 14 | 3. A Object Detection pipeline configuration has been written. See 15 | [this page](configuring_jobs.md) for details on how to write a pipeline configuration. 16 | 17 | ## Recommended Directory Structure for Training and Evaluation 18 | 19 | ``` 20 | +data 21 | -label_map file 22 | -train TFRecord file 23 | -eval TFRecord file 24 | +models 25 | + model 26 | -pipeline config file 27 | +train 28 | +eval 29 | ``` 30 | 31 | ## Running the Training Job 32 | 33 | A local training job can be run with the following command: 34 | 35 | ```bash 36 | # From the tensorflow/models/research/ directory 37 | PIPELINE_CONFIG_PATH={path to pipeline config file} 38 | MODEL_DIR={path to model directory} 39 | NUM_TRAIN_STEPS=50000 40 | NUM_EVAL_STEPS=2000 41 | python object_detection/model_main.py \ 42 | --pipeline_config_path=${PIPELINE_CONFIG_PATH} \ 43 | --model_dir=${MODEL_DIR} \ 44 | --num_train_steps=${NUM_TRAIN_STEPS} \ 45 | --num_eval_steps=${NUM_EVAL_STEPS} \ 46 | --alsologtostderr 47 | ``` 48 | 49 | where `${PIPELINE_CONFIG_PATH}` points to the pipeline config and 50 | `${MODEL_DIR}` points to the directory in which training checkpoints 51 | and events will be written to. Note that this binary will interleave both 52 | training and evaluation. 53 | 54 | ## Running Tensorboard 55 | 56 | Progress for training and eval jobs can be inspected using Tensorboard. If 57 | using the recommended directory structure, Tensorboard can be run using the 58 | following command: 59 | 60 | ```bash 61 | tensorboard --logdir=${MODEL_DIR} 62 | ``` 63 | 64 | where `${MODEL_DIR}` points to the directory that contains the 65 | train and eval directories. Please note it may take Tensorboard a couple minutes 66 | to populate with data. 67 | -------------------------------------------------------------------------------- /object_detection/g3doc/running_notebook.md: -------------------------------------------------------------------------------- 1 | # Quick Start: Jupyter notebook for off-the-shelf inference 2 | 3 | If you'd like to hit the ground running and run detection on a few example 4 | images right out of the box, we recommend trying out the Jupyter notebook demo. 5 | To run the Jupyter notebook, run the following command from 6 | `tensorflow/models/research/object_detection`: 7 | 8 | ``` 9 | # From tensorflow/models/research/object_detection 10 | jupyter notebook 11 | ``` 12 | 13 | The notebook should open in your favorite web browser. Click the 14 | [`object_detection_tutorial.ipynb`](../object_detection_tutorial.ipynb) link to 15 | open the demo. 16 | -------------------------------------------------------------------------------- /object_detection/inference/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/inference/__init__.py -------------------------------------------------------------------------------- /object_detection/legacy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/legacy/__init__.py -------------------------------------------------------------------------------- /object_detection/legacy/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/legacy/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/legacy/__pycache__/train.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/legacy/__pycache__/train.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/legacy/__pycache__/trainer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/legacy/__pycache__/trainer.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/matchers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/matchers/__init__.py -------------------------------------------------------------------------------- /object_detection/matchers/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/matchers/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/matchers/__pycache__/argmax_matcher.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/matchers/__pycache__/argmax_matcher.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/matchers/__pycache__/bipartite_matcher.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/matchers/__pycache__/bipartite_matcher.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/matchers/bipartite_matcher.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Bipartite matcher implementation.""" 17 | 18 | import tensorflow as tf 19 | 20 | from tensorflow.contrib.image.python.ops import image_ops 21 | from object_detection.core import matcher 22 | 23 | 24 | class GreedyBipartiteMatcher(matcher.Matcher): 25 | """Wraps a Tensorflow greedy bipartite matcher.""" 26 | 27 | def __init__(self, use_matmul_gather=False): 28 | """Constructs a Matcher. 29 | 30 | Args: 31 | use_matmul_gather: Force constructed match objects to use matrix 32 | multiplication based gather instead of standard tf.gather. 33 | (Default: False). 34 | """ 35 | super(GreedyBipartiteMatcher, self).__init__( 36 | use_matmul_gather=use_matmul_gather) 37 | 38 | def _match(self, similarity_matrix, num_valid_rows=-1): 39 | """Bipartite matches a collection rows and columns. A greedy bi-partite. 40 | 41 | TODO(rathodv): Add num_valid_columns options to match only that many columns 42 | with all the rows. 43 | 44 | Args: 45 | similarity_matrix: Float tensor of shape [N, M] with pairwise similarity 46 | where higher values mean more similar. 47 | num_valid_rows: A scalar or a 1-D tensor with one element describing the 48 | number of valid rows of similarity_matrix to consider for the bipartite 49 | matching. If set to be negative, then all rows from similarity_matrix 50 | are used. 51 | 52 | Returns: 53 | match_results: int32 tensor of shape [M] with match_results[i]=-1 54 | meaning that column i is not matched and otherwise that it is matched to 55 | row match_results[i]. 56 | """ 57 | # Convert similarity matrix to distance matrix as tf.image.bipartite tries 58 | # to find minimum distance matches. 59 | distance_matrix = -1 * similarity_matrix 60 | _, match_results = image_ops.bipartite_match( 61 | distance_matrix, num_valid_rows) 62 | match_results = tf.reshape(match_results, [-1]) 63 | match_results = tf.cast(match_results, tf.int32) 64 | return match_results 65 | -------------------------------------------------------------------------------- /object_detection/matchers/bipartite_matcher_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.core.bipartite_matcher.""" 17 | 18 | import tensorflow as tf 19 | 20 | from object_detection.matchers import bipartite_matcher 21 | 22 | 23 | class GreedyBipartiteMatcherTest(tf.test.TestCase): 24 | 25 | def test_get_expected_matches_when_all_rows_are_valid(self): 26 | similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]]) 27 | num_valid_rows = 2 28 | expected_match_results = [-1, 1, 0] 29 | 30 | matcher = bipartite_matcher.GreedyBipartiteMatcher() 31 | match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows) 32 | with self.test_session() as sess: 33 | match_results_out = sess.run(match._match_results) 34 | self.assertAllEqual(match_results_out, expected_match_results) 35 | 36 | def test_get_expected_matches_with_valid_rows_set_to_minus_one(self): 37 | similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]]) 38 | num_valid_rows = -1 39 | expected_match_results = [-1, 1, 0] 40 | 41 | matcher = bipartite_matcher.GreedyBipartiteMatcher() 42 | match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows) 43 | with self.test_session() as sess: 44 | match_results_out = sess.run(match._match_results) 45 | self.assertAllEqual(match_results_out, expected_match_results) 46 | 47 | def test_get_no_matches_with_zero_valid_rows(self): 48 | similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]]) 49 | num_valid_rows = 0 50 | expected_match_results = [-1, -1, -1] 51 | 52 | matcher = bipartite_matcher.GreedyBipartiteMatcher() 53 | match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows) 54 | with self.test_session() as sess: 55 | match_results_out = sess.run(match._match_results) 56 | self.assertAllEqual(match_results_out, expected_match_results) 57 | 58 | def test_get_expected_matches_with_only_one_valid_row(self): 59 | similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]]) 60 | num_valid_rows = 1 61 | expected_match_results = [-1, -1, 0] 62 | 63 | matcher = bipartite_matcher.GreedyBipartiteMatcher() 64 | match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows) 65 | with self.test_session() as sess: 66 | match_results_out = sess.run(match._match_results) 67 | self.assertAllEqual(match_results_out, expected_match_results) 68 | 69 | 70 | if __name__ == '__main__': 71 | tf.test.main() 72 | -------------------------------------------------------------------------------- /object_detection/meta_architectures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/meta_architectures/__init__.py -------------------------------------------------------------------------------- /object_detection/meta_architectures/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/meta_architectures/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/meta_architectures/__pycache__/faster_rcnn_meta_arch.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/meta_architectures/__pycache__/faster_rcnn_meta_arch.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/meta_architectures/__pycache__/rfcn_meta_arch.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/meta_architectures/__pycache__/rfcn_meta_arch.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/meta_architectures/__pycache__/ssd_meta_arch.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/meta_architectures/__pycache__/ssd_meta_arch.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/meta_architectures/rfcn_meta_arch_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.meta_architectures.rfcn_meta_arch.""" 17 | 18 | import tensorflow as tf 19 | 20 | from object_detection.meta_architectures import faster_rcnn_meta_arch_test_lib 21 | from object_detection.meta_architectures import rfcn_meta_arch 22 | 23 | 24 | class RFCNMetaArchTest( 25 | faster_rcnn_meta_arch_test_lib.FasterRCNNMetaArchTestBase): 26 | 27 | def _get_second_stage_box_predictor_text_proto(self): 28 | box_predictor_text_proto = """ 29 | rfcn_box_predictor { 30 | conv_hyperparams { 31 | op: CONV 32 | activation: NONE 33 | regularizer { 34 | l2_regularizer { 35 | weight: 0.0005 36 | } 37 | } 38 | initializer { 39 | variance_scaling_initializer { 40 | factor: 1.0 41 | uniform: true 42 | mode: FAN_AVG 43 | } 44 | } 45 | } 46 | } 47 | """ 48 | return box_predictor_text_proto 49 | 50 | def _get_model(self, box_predictor, **common_kwargs): 51 | return rfcn_meta_arch.RFCNMetaArch( 52 | second_stage_rfcn_box_predictor=box_predictor, **common_kwargs) 53 | 54 | def _get_box_classifier_features_shape(self, 55 | image_size, 56 | batch_size, 57 | max_num_proposals, 58 | initial_crop_size, 59 | maxpool_stride, 60 | num_features): 61 | return (batch_size, image_size, image_size, num_features) 62 | 63 | 64 | if __name__ == '__main__': 65 | tf.test.main() 66 | -------------------------------------------------------------------------------- /object_detection/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/metrics/__init__.py -------------------------------------------------------------------------------- /object_detection/metrics/io_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Common IO utils used in offline metric computation. 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import division 20 | from __future__ import print_function 21 | 22 | import csv 23 | 24 | 25 | def write_csv(fid, metrics): 26 | """Writes metrics key-value pairs to CSV file. 27 | 28 | Args: 29 | fid: File identifier of an opened file. 30 | metrics: A dictionary with metrics to be written. 31 | """ 32 | metrics_writer = csv.writer(fid, delimiter=',') 33 | for metric_name, metric_value in metrics.items(): 34 | metrics_writer.writerow([metric_name, str(metric_value)]) 35 | -------------------------------------------------------------------------------- /object_detection/metrics/offline_eval_map_corloc_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Tests for utilities in offline_eval_map_corloc binary.""" 16 | 17 | import tensorflow as tf 18 | 19 | from object_detection.metrics import offline_eval_map_corloc as offline_eval 20 | 21 | 22 | class OfflineEvalMapCorlocTest(tf.test.TestCase): 23 | 24 | def test_generateShardedFilenames(self): 25 | test_filename = '/path/to/file' 26 | result = offline_eval._generate_sharded_filenames(test_filename) 27 | self.assertEqual(result, [test_filename]) 28 | 29 | test_filename = '/path/to/file-00000-of-00050' 30 | result = offline_eval._generate_sharded_filenames(test_filename) 31 | self.assertEqual(result, [test_filename]) 32 | 33 | result = offline_eval._generate_sharded_filenames('/path/to/@3.record') 34 | self.assertEqual(result, [ 35 | '/path/to/-00000-of-00003.record', '/path/to/-00001-of-00003.record', 36 | '/path/to/-00002-of-00003.record' 37 | ]) 38 | 39 | result = offline_eval._generate_sharded_filenames('/path/to/abc@3') 40 | self.assertEqual(result, [ 41 | '/path/to/abc-00000-of-00003', '/path/to/abc-00001-of-00003', 42 | '/path/to/abc-00002-of-00003' 43 | ]) 44 | 45 | result = offline_eval._generate_sharded_filenames('/path/to/@1') 46 | self.assertEqual(result, ['/path/to/-00000-of-00001']) 47 | 48 | def test_generateFilenames(self): 49 | test_filenames = ['/path/to/file', '/path/to/@3.record'] 50 | result = offline_eval._generate_filenames(test_filenames) 51 | self.assertEqual(result, [ 52 | '/path/to/file', '/path/to/-00000-of-00003.record', 53 | '/path/to/-00001-of-00003.record', '/path/to/-00002-of-00003.record' 54 | ]) 55 | 56 | 57 | if __name__ == '__main__': 58 | tf.test.main() 59 | -------------------------------------------------------------------------------- /object_detection/model_hparams.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Hyperparameters for the object detection model in TF.learn. 16 | 17 | This file consolidates and documents the hyperparameters used by the model. 18 | """ 19 | 20 | from __future__ import absolute_import 21 | from __future__ import division 22 | from __future__ import print_function 23 | 24 | import tensorflow as tf 25 | 26 | 27 | def create_hparams(hparams_overrides=None): 28 | """Returns hyperparameters, including any flag value overrides. 29 | 30 | Args: 31 | hparams_overrides: Optional hparams overrides, represented as a 32 | string containing comma-separated hparam_name=value pairs. 33 | 34 | Returns: 35 | The hyperparameters as a tf.HParams object. 36 | """ 37 | hparams = tf.contrib.training.HParams( 38 | # Whether a fine tuning checkpoint (provided in the pipeline config) 39 | # should be loaded for training. 40 | load_pretrained=True) 41 | # Override any of the preceding hyperparameter values. 42 | if hparams_overrides: 43 | hparams = hparams.parse(hparams_overrides) 44 | return hparams 45 | -------------------------------------------------------------------------------- /object_detection/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__init__.py -------------------------------------------------------------------------------- /object_detection/models/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/embedded_ssd_mobilenet_v1_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/embedded_ssd_mobilenet_v1_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/faster_rcnn_inception_resnet_v2_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/faster_rcnn_inception_resnet_v2_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/faster_rcnn_inception_v2_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/faster_rcnn_inception_v2_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/faster_rcnn_nas_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/faster_rcnn_nas_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/faster_rcnn_pnas_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/faster_rcnn_pnas_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/faster_rcnn_resnet_v1_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/faster_rcnn_resnet_v1_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/feature_map_generators.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/feature_map_generators.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_inception_v2_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_inception_v2_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_inception_v3_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_inception_v3_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_mobilenet_v1_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_mobilenet_v1_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_mobilenet_v1_fpn_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_mobilenet_v1_fpn_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_mobilenet_v1_ppn_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_mobilenet_v1_ppn_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_mobilenet_v2_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_mobilenet_v2_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_resnet_v1_fpn_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_resnet_v1_fpn_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/models/__pycache__/ssd_resnet_v1_ppn_feature_extractor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/models/__pycache__/ssd_resnet_v1_ppn_feature_extractor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/output.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/output.jpg -------------------------------------------------------------------------------- /object_detection/output1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/output1.jpg -------------------------------------------------------------------------------- /object_detection/predictors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__init__.py -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/convolutional_box_predictor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/convolutional_box_predictor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/convolutional_box_predictor.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/convolutional_box_predictor.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/mask_rcnn_box_predictor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/mask_rcnn_box_predictor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/__pycache__/rfcn_box_predictor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/__pycache__/rfcn_box_predictor.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__init__.py -------------------------------------------------------------------------------- /object_detection/predictors/heads/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/__pycache__/box_head.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__pycache__/box_head.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/__pycache__/class_head.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__pycache__/class_head.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/__pycache__/head.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__pycache__/head.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/__pycache__/mask_head.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/predictors/heads/__pycache__/mask_head.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/predictors/heads/head.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Base head class. 17 | 18 | All the different kinds of prediction heads in different models will inherit 19 | from this class. What is in common between all head classes is that they have a 20 | `predict` function that receives `features` as its first argument. 21 | 22 | How to add a new prediction head to an existing meta architecture? 23 | For example, how can we add a `3d shape` prediction head to Mask RCNN? 24 | 25 | We have to take the following steps to add a new prediction head to an 26 | existing meta arch: 27 | (a) Add a class for predicting the head. This class should inherit from the 28 | `Head` class below and have a `predict` function that receives the features 29 | and predicts the output. The output is always a tf.float32 tensor. 30 | (b) Add the head to the meta architecture. For example in case of Mask RCNN, 31 | go to box_predictor_builder and put in the logic for adding the new head to the 32 | Mask RCNN box predictor. 33 | (c) Add the logic for computing the loss for the new head. 34 | (d) Add the necessary metrics for the new head. 35 | (e) (optional) Add visualization for the new head. 36 | """ 37 | from abc import abstractmethod 38 | 39 | 40 | class Head(object): 41 | """Mask RCNN head base class.""" 42 | 43 | def __init__(self): 44 | """Constructor.""" 45 | pass 46 | 47 | @abstractmethod 48 | def predict(self, features, num_predictions_per_location): 49 | """Returns the head's predictions. 50 | 51 | Args: 52 | features: A float tensor of features. 53 | num_predictions_per_location: Int containing number of predictions per 54 | location. 55 | 56 | Returns: 57 | A tf.float32 tensor. 58 | """ 59 | pass 60 | -------------------------------------------------------------------------------- /object_detection/predictors/heads/keypoint_head_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.predictors.heads.keypoint_head.""" 17 | import tensorflow as tf 18 | 19 | from google.protobuf import text_format 20 | from object_detection.builders import hyperparams_builder 21 | from object_detection.predictors.heads import keypoint_head 22 | from object_detection.protos import hyperparams_pb2 23 | from object_detection.utils import test_case 24 | 25 | 26 | class MaskRCNNKeypointHeadTest(test_case.TestCase): 27 | 28 | def _build_arg_scope_with_hyperparams(self, 29 | op_type=hyperparams_pb2.Hyperparams.FC): 30 | hyperparams = hyperparams_pb2.Hyperparams() 31 | hyperparams_text_proto = """ 32 | activation: NONE 33 | regularizer { 34 | l2_regularizer { 35 | } 36 | } 37 | initializer { 38 | truncated_normal_initializer { 39 | } 40 | } 41 | """ 42 | text_format.Merge(hyperparams_text_proto, hyperparams) 43 | hyperparams.op = op_type 44 | return hyperparams_builder.build(hyperparams, is_training=True) 45 | 46 | def test_prediction_size(self): 47 | keypoint_prediction_head = keypoint_head.MaskRCNNKeypointHead( 48 | conv_hyperparams_fn=self._build_arg_scope_with_hyperparams()) 49 | roi_pooled_features = tf.random_uniform( 50 | [64, 14, 14, 1024], minval=-2.0, maxval=2.0, dtype=tf.float32) 51 | prediction = keypoint_prediction_head.predict( 52 | features=roi_pooled_features, num_predictions_per_location=1) 53 | self.assertAllEqual([64, 1, 17, 56, 56], prediction.get_shape().as_list()) 54 | 55 | 56 | if __name__ == '__main__': 57 | tf.test.main() 58 | -------------------------------------------------------------------------------- /object_detection/protos/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__init__.py -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/anchor_generator_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/anchor_generator_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/anchor_generator_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/anchor_generator_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/argmax_matcher_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/argmax_matcher_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/bipartite_matcher_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/bipartite_matcher_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/box_coder_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/box_coder_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/box_coder_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/box_coder_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/box_predictor_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/box_predictor_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/eval_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/eval_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/faster_rcnn_box_coder_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/faster_rcnn_box_coder_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/faster_rcnn_box_coder_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/faster_rcnn_box_coder_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/faster_rcnn_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/faster_rcnn_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/graph_rewriter_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/graph_rewriter_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/grid_anchor_generator_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/grid_anchor_generator_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/grid_anchor_generator_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/grid_anchor_generator_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/hyperparams_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/hyperparams_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/image_resizer_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/image_resizer_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/input_reader_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/input_reader_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/input_reader_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/input_reader_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/keypoint_box_coder_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/keypoint_box_coder_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/keypoint_box_coder_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/keypoint_box_coder_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/losses_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/losses_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/matcher_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/matcher_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/mean_stddev_box_coder_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/mean_stddev_box_coder_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/mean_stddev_box_coder_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/mean_stddev_box_coder_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/model_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/model_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/multiscale_anchor_generator_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/multiscale_anchor_generator_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/multiscale_anchor_generator_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/multiscale_anchor_generator_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/optimizer_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/optimizer_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/pipeline_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/pipeline_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/post_processing_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/post_processing_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/preprocessor_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/preprocessor_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/region_similarity_calculator_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/region_similarity_calculator_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/square_box_coder_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/square_box_coder_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/square_box_coder_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/square_box_coder_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/ssd_anchor_generator_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/ssd_anchor_generator_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/ssd_anchor_generator_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/ssd_anchor_generator_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/ssd_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/ssd_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/string_int_label_map_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/string_int_label_map_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/string_int_label_map_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/string_int_label_map_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/protos/__pycache__/train_pb2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/protos/__pycache__/train_pb2.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/protos/anchor_generator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | import "object_detection/protos/grid_anchor_generator.proto"; 6 | import "object_detection/protos/ssd_anchor_generator.proto"; 7 | import "object_detection/protos/multiscale_anchor_generator.proto"; 8 | 9 | // Configuration proto for the anchor generator to use in the object detection 10 | // pipeline. See core/anchor_generator.py for details. 11 | message AnchorGenerator { 12 | oneof anchor_generator_oneof { 13 | GridAnchorGenerator grid_anchor_generator = 1; 14 | SsdAnchorGenerator ssd_anchor_generator = 2; 15 | MultiscaleAnchorGenerator multiscale_anchor_generator = 3; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /object_detection/protos/argmax_matcher.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for ArgMaxMatcher. See 6 | // matchers/argmax_matcher.py for details. 7 | message ArgMaxMatcher { 8 | // Threshold for positive matches. 9 | optional float matched_threshold = 1 [default = 0.5]; 10 | 11 | // Threshold for negative matches. 12 | optional float unmatched_threshold = 2 [default = 0.5]; 13 | 14 | // Whether to construct ArgMaxMatcher without thresholds. 15 | optional bool ignore_thresholds = 3 [default = false]; 16 | 17 | // If True then negative matches are the ones below the unmatched_threshold, 18 | // whereas ignored matches are in between the matched and umatched 19 | // threshold. If False, then negative matches are in between the matched 20 | // and unmatched threshold, and everything lower than unmatched is ignored. 21 | optional bool negatives_lower_than_unmatched = 4 [default = true]; 22 | 23 | // Whether to ensure each row is matched to at least one column. 24 | optional bool force_match_for_each_row = 5 [default = false]; 25 | 26 | // Force constructed match objects to use matrix multiplication based gather 27 | // instead of standard tf.gather 28 | optional bool use_matmul_gather = 6 [default = false]; 29 | } 30 | -------------------------------------------------------------------------------- /object_detection/protos/bipartite_matcher.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for bipartite matcher. See 6 | // matchers/bipartite_matcher.py for details. 7 | message BipartiteMatcher { 8 | // Force constructed match objects to use matrix multiplication based gather 9 | // instead of standard tf.gather 10 | optional bool use_matmul_gather = 6 [default = false]; 11 | } 12 | -------------------------------------------------------------------------------- /object_detection/protos/bipartite_matcher_pb2.py: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: object_detection/protos/bipartite_matcher.proto 3 | 4 | import sys 5 | _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) 6 | from google.protobuf import descriptor as _descriptor 7 | from google.protobuf import message as _message 8 | from google.protobuf import reflection as _reflection 9 | from google.protobuf import symbol_database as _symbol_database 10 | # @@protoc_insertion_point(imports) 11 | 12 | _sym_db = _symbol_database.Default() 13 | 14 | 15 | 16 | 17 | DESCRIPTOR = _descriptor.FileDescriptor( 18 | name='object_detection/protos/bipartite_matcher.proto', 19 | package='object_detection.protos', 20 | syntax='proto2', 21 | serialized_options=None, 22 | serialized_pb=_b('\n/object_detection/protos/bipartite_matcher.proto\x12\x17object_detection.protos\"4\n\x10\x42ipartiteMatcher\x12 \n\x11use_matmul_gather\x18\x06 \x01(\x08:\x05\x66\x61lse') 23 | ) 24 | 25 | 26 | 27 | 28 | _BIPARTITEMATCHER = _descriptor.Descriptor( 29 | name='BipartiteMatcher', 30 | full_name='object_detection.protos.BipartiteMatcher', 31 | filename=None, 32 | file=DESCRIPTOR, 33 | containing_type=None, 34 | fields=[ 35 | _descriptor.FieldDescriptor( 36 | name='use_matmul_gather', full_name='object_detection.protos.BipartiteMatcher.use_matmul_gather', index=0, 37 | number=6, type=8, cpp_type=7, label=1, 38 | has_default_value=True, default_value=False, 39 | message_type=None, enum_type=None, containing_type=None, 40 | is_extension=False, extension_scope=None, 41 | serialized_options=None, file=DESCRIPTOR), 42 | ], 43 | extensions=[ 44 | ], 45 | nested_types=[], 46 | enum_types=[ 47 | ], 48 | serialized_options=None, 49 | is_extendable=False, 50 | syntax='proto2', 51 | extension_ranges=[], 52 | oneofs=[ 53 | ], 54 | serialized_start=76, 55 | serialized_end=128, 56 | ) 57 | 58 | DESCRIPTOR.message_types_by_name['BipartiteMatcher'] = _BIPARTITEMATCHER 59 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 60 | 61 | BipartiteMatcher = _reflection.GeneratedProtocolMessageType('BipartiteMatcher', (_message.Message,), dict( 62 | DESCRIPTOR = _BIPARTITEMATCHER, 63 | __module__ = 'object_detection.protos.bipartite_matcher_pb2' 64 | # @@protoc_insertion_point(class_scope:object_detection.protos.BipartiteMatcher) 65 | )) 66 | _sym_db.RegisterMessage(BipartiteMatcher) 67 | 68 | 69 | # @@protoc_insertion_point(module_scope) 70 | -------------------------------------------------------------------------------- /object_detection/protos/box_coder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | import "object_detection/protos/faster_rcnn_box_coder.proto"; 6 | import "object_detection/protos/keypoint_box_coder.proto"; 7 | import "object_detection/protos/mean_stddev_box_coder.proto"; 8 | import "object_detection/protos/square_box_coder.proto"; 9 | 10 | // Configuration proto for the box coder to be used in the object detection 11 | // pipeline. See core/box_coder.py for details. 12 | message BoxCoder { 13 | oneof box_coder_oneof { 14 | FasterRcnnBoxCoder faster_rcnn_box_coder = 1; 15 | MeanStddevBoxCoder mean_stddev_box_coder = 2; 16 | SquareBoxCoder square_box_coder = 3; 17 | KeypointBoxCoder keypoint_box_coder = 4; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /object_detection/protos/faster_rcnn_box_coder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for FasterRCNNBoxCoder. See 6 | // box_coders/faster_rcnn_box_coder.py for details. 7 | message FasterRcnnBoxCoder { 8 | // Scale factor for anchor encoded box center. 9 | optional float y_scale = 1 [default = 10.0]; 10 | optional float x_scale = 2 [default = 10.0]; 11 | 12 | // Scale factor for anchor encoded box height. 13 | optional float height_scale = 3 [default = 5.0]; 14 | 15 | // Scale factor for anchor encoded box width. 16 | optional float width_scale = 4 [default = 5.0]; 17 | } 18 | -------------------------------------------------------------------------------- /object_detection/protos/graph_rewriter.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Message to configure graph rewriter for the tf graph. 6 | message GraphRewriter { 7 | optional Quantization quantization = 1; 8 | } 9 | 10 | // Message for quantization options. See 11 | // tensorflow/contrib/quantize/python/quantize.py for details. 12 | message Quantization { 13 | // Number of steps to delay before quantization takes effect during training. 14 | optional int32 delay = 1 [default = 500000]; 15 | 16 | // Number of bits to use for quantizing weights. 17 | // Only 8 bit is supported for now. 18 | optional int32 weight_bits = 2 [default = 8]; 19 | 20 | // Number of bits to use for quantizing activations. 21 | // Only 8 bit is supported for now. 22 | optional int32 activation_bits = 3 [default = 8]; 23 | } 24 | -------------------------------------------------------------------------------- /object_detection/protos/grid_anchor_generator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for GridAnchorGenerator. See 6 | // anchor_generators/grid_anchor_generator.py for details. 7 | message GridAnchorGenerator { 8 | // Anchor height in pixels. 9 | optional int32 height = 1 [default = 256]; 10 | 11 | // Anchor width in pixels. 12 | optional int32 width = 2 [default = 256]; 13 | 14 | // Anchor stride in height dimension in pixels. 15 | optional int32 height_stride = 3 [default = 16]; 16 | 17 | // Anchor stride in width dimension in pixels. 18 | optional int32 width_stride = 4 [default = 16]; 19 | 20 | // Anchor height offset in pixels. 21 | optional int32 height_offset = 5 [default = 0]; 22 | 23 | // Anchor width offset in pixels. 24 | optional int32 width_offset = 6 [default = 0]; 25 | 26 | // At any given location, len(scales) * len(aspect_ratios) anchors are 27 | // generated with all possible combinations of scales and aspect ratios. 28 | 29 | // List of scales for the anchors. 30 | repeated float scales = 7; 31 | 32 | // List of aspect ratios for the anchors. 33 | repeated float aspect_ratios = 8; 34 | } 35 | -------------------------------------------------------------------------------- /object_detection/protos/image_resizer.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for image resizing operations. 6 | // See builders/image_resizer_builder.py for details. 7 | message ImageResizer { 8 | oneof image_resizer_oneof { 9 | KeepAspectRatioResizer keep_aspect_ratio_resizer = 1; 10 | FixedShapeResizer fixed_shape_resizer = 2; 11 | } 12 | } 13 | 14 | // Enumeration type for image resizing methods provided in TensorFlow. 15 | enum ResizeType { 16 | BILINEAR = 0; // Corresponds to tf.image.ResizeMethod.BILINEAR 17 | NEAREST_NEIGHBOR = 1; // Corresponds to tf.image.ResizeMethod.NEAREST_NEIGHBOR 18 | BICUBIC = 2; // Corresponds to tf.image.ResizeMethod.BICUBIC 19 | AREA = 3; // Corresponds to tf.image.ResizeMethod.AREA 20 | } 21 | 22 | // Configuration proto for image resizer that keeps aspect ratio. 23 | message KeepAspectRatioResizer { 24 | // Desired size of the smaller image dimension in pixels. 25 | optional int32 min_dimension = 1 [default = 600]; 26 | 27 | // Desired size of the larger image dimension in pixels. 28 | optional int32 max_dimension = 2 [default = 1024]; 29 | 30 | // Desired method when resizing image. 31 | optional ResizeType resize_method = 3 [default = BILINEAR]; 32 | 33 | // Whether to pad the image with zeros so the output spatial size is 34 | // [max_dimension, max_dimension]. Note that the zeros are padded to the 35 | // bottom and the right of the resized image. 36 | optional bool pad_to_max_dimension = 4 [default = false]; 37 | 38 | // Whether to also resize the image channels from 3 to 1 (RGB to grayscale). 39 | optional bool convert_to_grayscale = 5 [default = false]; 40 | 41 | // Per-channel pad value. This is only used when pad_to_max_dimension is True. 42 | // If unspecified, a default pad value of 0 is applied to all channels. 43 | repeated float per_channel_pad_value = 6; 44 | } 45 | 46 | // Configuration proto for image resizer that resizes to a fixed shape. 47 | message FixedShapeResizer { 48 | // Desired height of image in pixels. 49 | optional int32 height = 1 [default = 300]; 50 | 51 | // Desired width of image in pixels. 52 | optional int32 width = 2 [default = 300]; 53 | 54 | // Desired method when resizing image. 55 | optional ResizeType resize_method = 3 [default = BILINEAR]; 56 | 57 | // Whether to also resize the image channels from 3 to 1 (RGB to grayscale). 58 | optional bool convert_to_grayscale = 4 [default = false]; 59 | } 60 | -------------------------------------------------------------------------------- /object_detection/protos/keypoint_box_coder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for KeypointBoxCoder. See 6 | // box_coders/keypoint_box_coder.py for details. 7 | message KeypointBoxCoder { 8 | optional int32 num_keypoints = 1; 9 | 10 | // Scale factor for anchor encoded box center and keypoints. 11 | optional float y_scale = 2 [default = 10.0]; 12 | optional float x_scale = 3 [default = 10.0]; 13 | 14 | // Scale factor for anchor encoded box height. 15 | optional float height_scale = 4 [default = 5.0]; 16 | 17 | // Scale factor for anchor encoded box width. 18 | optional float width_scale = 5 [default = 5.0]; 19 | } 20 | -------------------------------------------------------------------------------- /object_detection/protos/matcher.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | import "object_detection/protos/argmax_matcher.proto"; 6 | import "object_detection/protos/bipartite_matcher.proto"; 7 | 8 | // Configuration proto for the matcher to be used in the object detection 9 | // pipeline. See core/matcher.py for details. 10 | message Matcher { 11 | oneof matcher_oneof { 12 | ArgMaxMatcher argmax_matcher = 1; 13 | BipartiteMatcher bipartite_matcher = 2; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /object_detection/protos/mean_stddev_box_coder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for MeanStddevBoxCoder. See 6 | // box_coders/mean_stddev_box_coder.py for details. 7 | message MeanStddevBoxCoder { 8 | // The standard deviation used to encode and decode boxes. 9 | optional float stddev = 1 [default=0.01]; 10 | } 11 | -------------------------------------------------------------------------------- /object_detection/protos/mean_stddev_box_coder_pb2.py: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: object_detection/protos/mean_stddev_box_coder.proto 3 | 4 | import sys 5 | _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) 6 | from google.protobuf import descriptor as _descriptor 7 | from google.protobuf import message as _message 8 | from google.protobuf import reflection as _reflection 9 | from google.protobuf import symbol_database as _symbol_database 10 | # @@protoc_insertion_point(imports) 11 | 12 | _sym_db = _symbol_database.Default() 13 | 14 | 15 | 16 | 17 | DESCRIPTOR = _descriptor.FileDescriptor( 18 | name='object_detection/protos/mean_stddev_box_coder.proto', 19 | package='object_detection.protos', 20 | syntax='proto2', 21 | serialized_options=None, 22 | serialized_pb=_b('\n3object_detection/protos/mean_stddev_box_coder.proto\x12\x17object_detection.protos\"*\n\x12MeanStddevBoxCoder\x12\x14\n\x06stddev\x18\x01 \x01(\x02:\x04\x30.01') 23 | ) 24 | 25 | 26 | 27 | 28 | _MEANSTDDEVBOXCODER = _descriptor.Descriptor( 29 | name='MeanStddevBoxCoder', 30 | full_name='object_detection.protos.MeanStddevBoxCoder', 31 | filename=None, 32 | file=DESCRIPTOR, 33 | containing_type=None, 34 | fields=[ 35 | _descriptor.FieldDescriptor( 36 | name='stddev', full_name='object_detection.protos.MeanStddevBoxCoder.stddev', index=0, 37 | number=1, type=2, cpp_type=6, label=1, 38 | has_default_value=True, default_value=float(0.01), 39 | message_type=None, enum_type=None, containing_type=None, 40 | is_extension=False, extension_scope=None, 41 | serialized_options=None, file=DESCRIPTOR), 42 | ], 43 | extensions=[ 44 | ], 45 | nested_types=[], 46 | enum_types=[ 47 | ], 48 | serialized_options=None, 49 | is_extendable=False, 50 | syntax='proto2', 51 | extension_ranges=[], 52 | oneofs=[ 53 | ], 54 | serialized_start=80, 55 | serialized_end=122, 56 | ) 57 | 58 | DESCRIPTOR.message_types_by_name['MeanStddevBoxCoder'] = _MEANSTDDEVBOXCODER 59 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 60 | 61 | MeanStddevBoxCoder = _reflection.GeneratedProtocolMessageType('MeanStddevBoxCoder', (_message.Message,), dict( 62 | DESCRIPTOR = _MEANSTDDEVBOXCODER, 63 | __module__ = 'object_detection.protos.mean_stddev_box_coder_pb2' 64 | # @@protoc_insertion_point(class_scope:object_detection.protos.MeanStddevBoxCoder) 65 | )) 66 | _sym_db.RegisterMessage(MeanStddevBoxCoder) 67 | 68 | 69 | # @@protoc_insertion_point(module_scope) 70 | -------------------------------------------------------------------------------- /object_detection/protos/model.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | import "object_detection/protos/faster_rcnn.proto"; 6 | import "object_detection/protos/ssd.proto"; 7 | 8 | // Top level configuration for DetectionModels. 9 | message DetectionModel { 10 | oneof model { 11 | FasterRcnn faster_rcnn = 1; 12 | Ssd ssd = 2; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /object_detection/protos/multiscale_anchor_generator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for RetinaNet anchor generator described in 6 | // https://arxiv.org/abs/1708.02002. See 7 | // anchor_generators/multiscale_grid_anchor_generator.py for details. 8 | message MultiscaleAnchorGenerator { 9 | // minimum level in feature pyramid 10 | optional int32 min_level = 1 [default = 3]; 11 | 12 | // maximum level in feature pyramid 13 | optional int32 max_level = 2 [default = 7]; 14 | 15 | // Scale of anchor to feature stride 16 | optional float anchor_scale = 3 [default = 4.0]; 17 | 18 | // Aspect ratios for anchors at each grid point. 19 | repeated float aspect_ratios = 4; 20 | 21 | // Number of intermediate scale each scale octave 22 | optional int32 scales_per_octave = 5 [default = 2]; 23 | 24 | // Whether to produce anchors in normalized coordinates. 25 | optional bool normalize_coordinates = 6 [default = true]; 26 | } 27 | -------------------------------------------------------------------------------- /object_detection/protos/pipeline.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | import "object_detection/protos/eval.proto"; 6 | import "object_detection/protos/graph_rewriter.proto"; 7 | import "object_detection/protos/input_reader.proto"; 8 | import "object_detection/protos/model.proto"; 9 | import "object_detection/protos/train.proto"; 10 | 11 | // Convenience message for configuring a training and eval pipeline. Allows all 12 | // of the pipeline parameters to be configured from one file. 13 | message TrainEvalPipelineConfig { 14 | optional DetectionModel model = 1; 15 | optional TrainConfig train_config = 2; 16 | optional InputReader train_input_reader = 3; 17 | optional EvalConfig eval_config = 4; 18 | optional InputReader eval_input_reader = 5; 19 | optional GraphRewriter graph_rewriter = 6; 20 | extensions 1000 to max; 21 | } 22 | -------------------------------------------------------------------------------- /object_detection/protos/post_processing.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for non-max-suppression operation on a batch of 6 | // detections. 7 | message BatchNonMaxSuppression { 8 | // Scalar threshold for score (low scoring boxes are removed). 9 | optional float score_threshold = 1 [default = 0.0]; 10 | 11 | // Scalar threshold for IOU (boxes that have high IOU overlap 12 | // with previously selected boxes are removed). 13 | optional float iou_threshold = 2 [default = 0.6]; 14 | 15 | // Maximum number of detections to retain per class. 16 | optional int32 max_detections_per_class = 3 [default = 100]; 17 | 18 | // Maximum number of detections to retain across all classes. 19 | optional int32 max_total_detections = 5 [default = 100]; 20 | } 21 | 22 | // Configuration proto for post-processing predicted boxes and 23 | // scores. 24 | message PostProcessing { 25 | // Non max suppression parameters. 26 | optional BatchNonMaxSuppression batch_non_max_suppression = 1; 27 | 28 | // Enum to specify how to convert the detection scores. 29 | enum ScoreConverter { 30 | // Input scores equals output scores. 31 | IDENTITY = 0; 32 | 33 | // Applies a sigmoid on input scores. 34 | SIGMOID = 1; 35 | 36 | // Applies a softmax on input scores 37 | SOFTMAX = 2; 38 | } 39 | 40 | // Score converter to use. 41 | optional ScoreConverter score_converter = 2 [default = IDENTITY]; 42 | // Scale logit (input) value before conversion in post-processing step. 43 | // Typically used for softmax distillation, though can be used to scale for 44 | // other reasons. 45 | optional float logit_scale = 3 [default = 1.0]; 46 | } 47 | -------------------------------------------------------------------------------- /object_detection/protos/region_similarity_calculator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for region similarity calculators. See 6 | // core/region_similarity_calculator.py for details. 7 | message RegionSimilarityCalculator { 8 | oneof region_similarity { 9 | NegSqDistSimilarity neg_sq_dist_similarity = 1; 10 | IouSimilarity iou_similarity = 2; 11 | IoaSimilarity ioa_similarity = 3; 12 | ThresholdedIouSimilarity thresholded_iou_similarity = 4; 13 | } 14 | } 15 | 16 | // Configuration for negative squared distance similarity calculator. 17 | message NegSqDistSimilarity { 18 | } 19 | 20 | // Configuration for intersection-over-union (IOU) similarity calculator. 21 | message IouSimilarity { 22 | } 23 | 24 | // Configuration for intersection-over-area (IOA) similarity calculator. 25 | message IoaSimilarity { 26 | } 27 | 28 | // Configuration for thresholded-intersection-over-union similarity calculator. 29 | message ThresholdedIouSimilarity { 30 | 31 | // IOU threshold used for filtering scores. 32 | optional float iou_threshold = 1 [default = 0.5]; 33 | } 34 | -------------------------------------------------------------------------------- /object_detection/protos/square_box_coder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for SquareBoxCoder. See 6 | // box_coders/square_box_coder.py for details. 7 | message SquareBoxCoder { 8 | // Scale factor for anchor encoded box center. 9 | optional float y_scale = 1 [default = 10.0]; 10 | optional float x_scale = 2 [default = 10.0]; 11 | 12 | // Scale factor for anchor encoded box length. 13 | optional float length_scale = 3 [default = 5.0]; 14 | } 15 | -------------------------------------------------------------------------------- /object_detection/protos/ssd_anchor_generator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package object_detection.protos; 4 | 5 | // Configuration proto for SSD anchor generator described in 6 | // https://arxiv.org/abs/1512.02325. See 7 | // anchor_generators/multiple_grid_anchor_generator.py for details. 8 | message SsdAnchorGenerator { 9 | // Number of grid layers to create anchors for. 10 | optional int32 num_layers = 1 [default = 6]; 11 | 12 | // Scale of anchors corresponding to finest resolution. 13 | optional float min_scale = 2 [default = 0.2]; 14 | 15 | // Scale of anchors corresponding to coarsest resolution 16 | optional float max_scale = 3 [default = 0.95]; 17 | 18 | // Can be used to override min_scale->max_scale, with an explicitly defined 19 | // set of scales. If empty, then min_scale->max_scale is used. 20 | repeated float scales = 12; 21 | 22 | // Aspect ratios for anchors at each grid point. 23 | repeated float aspect_ratios = 4; 24 | 25 | // When this aspect ratio is greater than 0, then an additional 26 | // anchor, with an interpolated scale is added with this aspect ratio. 27 | optional float interpolated_scale_aspect_ratio = 13 [default = 1.0]; 28 | 29 | // Whether to use the following aspect ratio and scale combination for the 30 | // layer with the finest resolution : (scale=0.1, aspect_ratio=1.0), 31 | // (scale=min_scale, aspect_ration=2.0), (scale=min_scale, aspect_ratio=0.5). 32 | optional bool reduce_boxes_in_lowest_layer = 5 [default = true]; 33 | 34 | // The base anchor size in height dimension. 35 | optional float base_anchor_height = 6 [default = 1.0]; 36 | 37 | // The base anchor size in width dimension. 38 | optional float base_anchor_width = 7 [default = 1.0]; 39 | 40 | // Anchor stride in height dimension in pixels for each layer. The length of 41 | // this field is expected to be equal to the value of num_layers. 42 | repeated int32 height_stride = 8; 43 | 44 | // Anchor stride in width dimension in pixels for each layer. The length of 45 | // this field is expected to be equal to the value of num_layers. 46 | repeated int32 width_stride = 9; 47 | 48 | // Anchor height offset in pixels for each layer. The length of this field is 49 | // expected to be equal to the value of num_layers. 50 | repeated int32 height_offset = 10; 51 | 52 | // Anchor width offset in pixels for each layer. The length of this field is 53 | // expected to be equal to the value of num_layers. 54 | repeated int32 width_offset = 11; 55 | } 56 | -------------------------------------------------------------------------------- /object_detection/protos/string_int_label_map.proto: -------------------------------------------------------------------------------- 1 | // Message to store the mapping from class label strings to class id. Datasets 2 | // use string labels to represent classes while the object detection framework 3 | // works with class ids. This message maps them so they can be converted back 4 | // and forth as needed. 5 | syntax = "proto2"; 6 | 7 | package object_detection.protos; 8 | 9 | message StringIntLabelMapItem { 10 | // String name. The most common practice is to set this to a MID or synsets 11 | // id. 12 | optional string name = 1; 13 | 14 | // Integer id that maps to the string name above. Label ids should start from 15 | // 1. 16 | optional int32 id = 2; 17 | 18 | // Human readable string label. 19 | optional string display_name = 3; 20 | }; 21 | 22 | message StringIntLabelMap { 23 | repeated StringIntLabelMapItem item = 1; 24 | }; 25 | -------------------------------------------------------------------------------- /object_detection/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | InceptionV3-FashionMod 4 | 5 | 6 |

Welcome to my InceptionV3 App!





7 |
8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /object_detection/test_data/pets_examples.record: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/test_data/pets_examples.record -------------------------------------------------------------------------------- /object_detection/test_images/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/test_images/image.jpg -------------------------------------------------------------------------------- /object_detection/test_images/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/test_images/image1.jpg -------------------------------------------------------------------------------- /object_detection/test_images/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/test_images/image2.jpg -------------------------------------------------------------------------------- /object_detection/test_images/image_info.txt: -------------------------------------------------------------------------------- 1 | 2 | Image provenance: 3 | image1.jpg: https://commons.wikimedia.org/wiki/File:Baegle_dwa.jpg 4 | image2.jpg: Michael Miley, 5 | https://www.flickr.com/photos/mike_miley/4678754542/in/photolist-88rQHL-88oBVp-88oC2B-88rS6J-88rSqm-88oBLv-88oBC4 6 | 7 | -------------------------------------------------------------------------------- /object_detection/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__init__.py -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/config_util.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/config_util.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/context_manager.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/context_manager.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/dataset_util.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/dataset_util.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/dataset_util.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/dataset_util.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/label_map_util.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/label_map_util.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/label_map_util.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/label_map_util.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/learning_schedules.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/learning_schedules.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/ops.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/ops.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/ops.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/ops.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/shape_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/shape_utils.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/shape_utils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/shape_utils.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/static_shape.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/static_shape.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/static_shape.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/static_shape.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/variables_helper.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/variables_helper.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/visualization_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/visualization_utils.cpython-36.pyc -------------------------------------------------------------------------------- /object_detection/utils/__pycache__/visualization_utils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/object_detection/utils/__pycache__/visualization_utils.cpython-37.pyc -------------------------------------------------------------------------------- /object_detection/utils/category_util.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Functions for importing/exporting Object Detection categories.""" 17 | import csv 18 | 19 | import tensorflow as tf 20 | 21 | 22 | def load_categories_from_csv_file(csv_path): 23 | """Loads categories from a csv file. 24 | 25 | The CSV file should have one comma delimited numeric category id and string 26 | category name pair per line. For example: 27 | 28 | 0,"cat" 29 | 1,"dog" 30 | 2,"bird" 31 | ... 32 | 33 | Args: 34 | csv_path: Path to the csv file to be parsed into categories. 35 | Returns: 36 | categories: A list of dictionaries representing all possible categories. 37 | The categories will contain an integer 'id' field and a string 38 | 'name' field. 39 | Raises: 40 | ValueError: If the csv file is incorrectly formatted. 41 | """ 42 | categories = [] 43 | 44 | with tf.gfile.Open(csv_path, 'r') as csvfile: 45 | reader = csv.reader(csvfile, delimiter=',', quotechar='"') 46 | for row in reader: 47 | if not row: 48 | continue 49 | 50 | if len(row) != 2: 51 | raise ValueError('Expected 2 fields per row in csv: %s' % ','.join(row)) 52 | 53 | category_id = int(row[0]) 54 | category_name = row[1] 55 | categories.append({'id': category_id, 'name': category_name}) 56 | 57 | return categories 58 | 59 | 60 | def save_categories_to_csv_file(categories, csv_path): 61 | """Saves categories to a csv file. 62 | 63 | Args: 64 | categories: A list of dictionaries representing categories to save to file. 65 | Each category must contain an 'id' and 'name' field. 66 | csv_path: Path to the csv file to be parsed into categories. 67 | """ 68 | categories.sort(key=lambda x: x['id']) 69 | with tf.gfile.Open(csv_path, 'w') as csvfile: 70 | writer = csv.writer(csvfile, delimiter=',', quotechar='"') 71 | for category in categories: 72 | writer.writerow([category['id'], category['name']]) 73 | -------------------------------------------------------------------------------- /object_detection/utils/category_util_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.utils.category_util.""" 17 | import os 18 | 19 | import tensorflow as tf 20 | 21 | from object_detection.utils import category_util 22 | 23 | 24 | class EvalUtilTest(tf.test.TestCase): 25 | 26 | def test_load_categories_from_csv_file(self): 27 | csv_data = """ 28 | 0,"cat" 29 | 1,"dog" 30 | 2,"bird" 31 | """.strip(' ') 32 | csv_path = os.path.join(self.get_temp_dir(), 'test.csv') 33 | with tf.gfile.Open(csv_path, 'wb') as f: 34 | f.write(csv_data) 35 | 36 | categories = category_util.load_categories_from_csv_file(csv_path) 37 | self.assertTrue({'id': 0, 'name': 'cat'} in categories) 38 | self.assertTrue({'id': 1, 'name': 'dog'} in categories) 39 | self.assertTrue({'id': 2, 'name': 'bird'} in categories) 40 | 41 | def test_save_categories_to_csv_file(self): 42 | categories = [ 43 | {'id': 0, 'name': 'cat'}, 44 | {'id': 1, 'name': 'dog'}, 45 | {'id': 2, 'name': 'bird'}, 46 | ] 47 | csv_path = os.path.join(self.get_temp_dir(), 'test.csv') 48 | category_util.save_categories_to_csv_file(categories, csv_path) 49 | saved_categories = category_util.load_categories_from_csv_file(csv_path) 50 | self.assertEqual(saved_categories, categories) 51 | 52 | 53 | if __name__ == '__main__': 54 | tf.test.main() 55 | -------------------------------------------------------------------------------- /object_detection/utils/context_manager.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Python context management helper.""" 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | 22 | class IdentityContextManager(object): 23 | """Returns an identity context manager that does nothing. 24 | 25 | This is helpful in setting up conditional `with` statement as below: 26 | 27 | with slim.arg_scope(x) if use_slim_scope else IdentityContextManager(): 28 | do_stuff() 29 | 30 | """ 31 | 32 | def __enter__(self): 33 | return None 34 | 35 | def __exit__(self, exec_type, exec_value, traceback): 36 | del exec_type 37 | del exec_value 38 | del traceback 39 | return False 40 | 41 | -------------------------------------------------------------------------------- /object_detection/utils/context_manager_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """Tests for tensorflow_models.object_detection.utils.context_manager.""" 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import tensorflow as tf 22 | from object_detection.utils import context_manager 23 | 24 | 25 | class ContextManagerTest(tf.test.TestCase): 26 | 27 | def test_identity_context_manager(self): 28 | with context_manager.IdentityContextManager() as identity_context: 29 | self.assertIsNone(identity_context) 30 | 31 | 32 | if __name__ == '__main__': 33 | tf.test.main() 34 | -------------------------------------------------------------------------------- /object_detection/utils/dataset_util.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Utility functions for creating TFRecord data sets.""" 17 | 18 | import tensorflow as tf 19 | 20 | 21 | def int64_feature(value): 22 | return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) 23 | 24 | 25 | def int64_list_feature(value): 26 | return tf.train.Feature(int64_list=tf.train.Int64List(value=value)) 27 | 28 | 29 | def bytes_feature(value): 30 | return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) 31 | 32 | 33 | def bytes_list_feature(value): 34 | return tf.train.Feature(bytes_list=tf.train.BytesList(value=value)) 35 | 36 | 37 | def float_list_feature(value): 38 | return tf.train.Feature(float_list=tf.train.FloatList(value=value)) 39 | 40 | 41 | def read_examples_list(path): 42 | """Read list of training or validation examples. 43 | 44 | The file is assumed to contain a single example per line where the first 45 | token in the line is an identifier that allows us to find the image and 46 | annotation xml for that example. 47 | 48 | For example, the line: 49 | xyz 3 50 | would allow us to find files xyz.jpg and xyz.xml (the 3 would be ignored). 51 | 52 | Args: 53 | path: absolute path to examples list file. 54 | 55 | Returns: 56 | list of example identifiers (strings). 57 | """ 58 | with tf.gfile.GFile(path) as fid: 59 | lines = fid.readlines() 60 | return [line.strip().split(' ')[0] for line in lines] 61 | 62 | 63 | def recursive_parse_xml_to_dict(xml): 64 | """Recursively parses XML contents to python dict. 65 | 66 | We assume that `object` tags are the only ones that can appear 67 | multiple times at the same level of a tree. 68 | 69 | Args: 70 | xml: xml tree obtained by parsing XML file contents using lxml.etree 71 | 72 | Returns: 73 | Python dictionary holding XML contents. 74 | """ 75 | if not xml: 76 | return {xml.tag: xml.text} 77 | result = {} 78 | for child in xml: 79 | child_result = recursive_parse_xml_to_dict(child) 80 | if child.tag != 'object': 81 | result[child.tag] = child_result[child.tag] 82 | else: 83 | if child.tag not in result: 84 | result[child.tag] = [] 85 | result[child.tag].append(child_result[child.tag]) 86 | return {xml.tag: result} 87 | 88 | 89 | -------------------------------------------------------------------------------- /object_detection/utils/dataset_util_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.utils.dataset_util.""" 17 | 18 | import os 19 | import tensorflow as tf 20 | 21 | from object_detection.utils import dataset_util 22 | 23 | 24 | class DatasetUtilTest(tf.test.TestCase): 25 | 26 | def test_read_examples_list(self): 27 | example_list_data = """example1 1\nexample2 2""" 28 | example_list_path = os.path.join(self.get_temp_dir(), 'examples.txt') 29 | with tf.gfile.Open(example_list_path, 'wb') as f: 30 | f.write(example_list_data) 31 | 32 | examples = dataset_util.read_examples_list(example_list_path) 33 | self.assertListEqual(['example1', 'example2'], examples) 34 | 35 | 36 | if __name__ == '__main__': 37 | tf.test.main() 38 | -------------------------------------------------------------------------------- /object_detection/utils/np_box_mask_list.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Numpy BoxMaskList classes and functions.""" 17 | 18 | import numpy as np 19 | from object_detection.utils import np_box_list 20 | 21 | 22 | class BoxMaskList(np_box_list.BoxList): 23 | """Convenience wrapper for BoxList with masks. 24 | 25 | BoxMaskList extends the np_box_list.BoxList to contain masks as well. 26 | In particular, its constructor receives both boxes and masks. Note that the 27 | masks correspond to the full image. 28 | """ 29 | 30 | def __init__(self, box_data, mask_data): 31 | """Constructs box collection. 32 | 33 | Args: 34 | box_data: a numpy array of shape [N, 4] representing box coordinates 35 | mask_data: a numpy array of shape [N, height, width] representing masks 36 | with values are in {0,1}. The masks correspond to the full 37 | image. The height and the width will be equal to image height and width. 38 | 39 | Raises: 40 | ValueError: if bbox data is not a numpy array 41 | ValueError: if invalid dimensions for bbox data 42 | ValueError: if mask data is not a numpy array 43 | ValueError: if invalid dimension for mask data 44 | """ 45 | super(BoxMaskList, self).__init__(box_data) 46 | if not isinstance(mask_data, np.ndarray): 47 | raise ValueError('Mask data must be a numpy array.') 48 | if len(mask_data.shape) != 3: 49 | raise ValueError('Invalid dimensions for mask data.') 50 | if mask_data.dtype != np.uint8: 51 | raise ValueError('Invalid data type for mask data: uint8 is required.') 52 | if mask_data.shape[0] != box_data.shape[0]: 53 | raise ValueError('There should be the same number of boxes and masks.') 54 | self.data['masks'] = mask_data 55 | 56 | def get_masks(self): 57 | """Convenience function for accessing masks. 58 | 59 | Returns: 60 | a numpy array of shape [N, height, width] representing masks 61 | """ 62 | return self.get_field('masks') 63 | 64 | -------------------------------------------------------------------------------- /object_detection/utils/np_box_ops_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.np_box_ops.""" 17 | 18 | import numpy as np 19 | import tensorflow as tf 20 | 21 | from object_detection.utils import np_box_ops 22 | 23 | 24 | class BoxOpsTests(tf.test.TestCase): 25 | 26 | def setUp(self): 27 | boxes1 = np.array([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0]], 28 | dtype=float) 29 | boxes2 = np.array([[3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0], 30 | [0.0, 0.0, 20.0, 20.0]], 31 | dtype=float) 32 | self.boxes1 = boxes1 33 | self.boxes2 = boxes2 34 | 35 | def testArea(self): 36 | areas = np_box_ops.area(self.boxes1) 37 | expected_areas = np.array([6.0, 5.0], dtype=float) 38 | self.assertAllClose(expected_areas, areas) 39 | 40 | def testIntersection(self): 41 | intersection = np_box_ops.intersection(self.boxes1, self.boxes2) 42 | expected_intersection = np.array([[2.0, 0.0, 6.0], [1.0, 0.0, 5.0]], 43 | dtype=float) 44 | self.assertAllClose(intersection, expected_intersection) 45 | 46 | def testIOU(self): 47 | iou = np_box_ops.iou(self.boxes1, self.boxes2) 48 | expected_iou = np.array([[2.0 / 16.0, 0.0, 6.0 / 400.0], 49 | [1.0 / 16.0, 0.0, 5.0 / 400.0]], 50 | dtype=float) 51 | self.assertAllClose(iou, expected_iou) 52 | 53 | def testIOA(self): 54 | boxes1 = np.array([[0.25, 0.25, 0.75, 0.75], 55 | [0.0, 0.0, 0.5, 0.75]], 56 | dtype=np.float32) 57 | boxes2 = np.array([[0.5, 0.25, 1.0, 1.0], 58 | [0.0, 0.0, 1.0, 1.0]], 59 | dtype=np.float32) 60 | ioa21 = np_box_ops.ioa(boxes2, boxes1) 61 | expected_ioa21 = np.array([[0.5, 0.0], 62 | [1.0, 1.0]], 63 | dtype=np.float32) 64 | self.assertAllClose(ioa21, expected_ioa21) 65 | 66 | 67 | if __name__ == '__main__': 68 | tf.test.main() 69 | -------------------------------------------------------------------------------- /object_detection/utils/static_shape.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Helper functions to access TensorShape values. 17 | 18 | The rank 4 tensor_shape must be of the form [batch_size, height, width, depth]. 19 | """ 20 | 21 | 22 | def get_batch_size(tensor_shape): 23 | """Returns batch size from the tensor shape. 24 | 25 | Args: 26 | tensor_shape: A rank 4 TensorShape. 27 | 28 | Returns: 29 | An integer representing the batch size of the tensor. 30 | """ 31 | tensor_shape.assert_has_rank(rank=4) 32 | return tensor_shape[0].value 33 | 34 | 35 | def get_height(tensor_shape): 36 | """Returns height from the tensor shape. 37 | 38 | Args: 39 | tensor_shape: A rank 4 TensorShape. 40 | 41 | Returns: 42 | An integer representing the height of the tensor. 43 | """ 44 | tensor_shape.assert_has_rank(rank=4) 45 | return tensor_shape[1].value 46 | 47 | 48 | def get_width(tensor_shape): 49 | """Returns width from the tensor shape. 50 | 51 | Args: 52 | tensor_shape: A rank 4 TensorShape. 53 | 54 | Returns: 55 | An integer representing the width of the tensor. 56 | """ 57 | tensor_shape.assert_has_rank(rank=4) 58 | return tensor_shape[2].value 59 | 60 | 61 | def get_depth(tensor_shape): 62 | """Returns depth from the tensor shape. 63 | 64 | Args: 65 | tensor_shape: A rank 4 TensorShape. 66 | 67 | Returns: 68 | An integer representing the depth of the tensor. 69 | """ 70 | tensor_shape.assert_has_rank(rank=4) 71 | return tensor_shape[3].value 72 | -------------------------------------------------------------------------------- /object_detection/utils/static_shape_test.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Tests for object_detection.utils.static_shape.""" 17 | 18 | import tensorflow as tf 19 | 20 | from object_detection.utils import static_shape 21 | 22 | 23 | class StaticShapeTest(tf.test.TestCase): 24 | 25 | def test_return_correct_batchSize(self): 26 | tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3]) 27 | self.assertEqual(32, static_shape.get_batch_size(tensor_shape)) 28 | 29 | def test_return_correct_height(self): 30 | tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3]) 31 | self.assertEqual(299, static_shape.get_height(tensor_shape)) 32 | 33 | def test_return_correct_width(self): 34 | tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3]) 35 | self.assertEqual(384, static_shape.get_width(tensor_shape)) 36 | 37 | def test_return_correct_depth(self): 38 | tensor_shape = tf.TensorShape(dims=[32, 299, 384, 3]) 39 | self.assertEqual(3, static_shape.get_depth(tensor_shape)) 40 | 41 | def test_die_on_tensor_shape_with_rank_three(self): 42 | tensor_shape = tf.TensorShape(dims=[32, 299, 384]) 43 | with self.assertRaises(ValueError): 44 | static_shape.get_batch_size(tensor_shape) 45 | static_shape.get_height(tensor_shape) 46 | static_shape.get_width(tensor_shape) 47 | static_shape.get_depth(tensor_shape) 48 | 49 | if __name__ == '__main__': 50 | tf.test.main() 51 | -------------------------------------------------------------------------------- /output.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecodingjack/DeepFashion2/efa983f645c765c9d719174522c512a3d61fe38e/output.jpg -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | from object_detection import app 3 | 4 | app.run(host="0.0.0.0", debug=True) 5 | --------------------------------------------------------------------------------