├── .clang-format ├── .git-blame-ignore-revs ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.yml │ ├── config.yml │ ├── documentation.yml │ └── feature-request.yml ├── PULL_REQUEST_TEMPLATE.md ├── failed_schedule_issue_template.md ├── process_commit.py ├── pytorch-probot.yml ├── scripts │ ├── cmake.sh │ ├── export_IS_M1_CONDA_BUILD_JOB.sh │ ├── setup-env.sh │ └── unittest.sh └── workflows │ ├── build-cmake.yml │ ├── build-wheels-aarch64-linux.yml │ ├── build-wheels-linux.yml │ ├── build-wheels-m1.yml │ ├── build-wheels-windows.yml │ ├── build_wheel_windows_arm64.yml │ ├── docs.yml │ ├── lint.yml │ ├── pr-labels.yml │ ├── prototype-tests-linux-gpu.yml │ ├── tests-schedule.yml │ └── tests.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CITATION.cff ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTING_MODELS.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── android ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradle_scripts │ ├── android_tasks.gradle │ └── release.gradle ├── gradlew ├── gradlew.bat ├── ops │ ├── CMakeLists.txt │ ├── build.gradle │ ├── gradle.properties │ └── src │ │ └── main │ │ └── AndroidManifest.xml ├── settings.gradle └── test_app │ ├── app │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── pytorch │ │ │ └── testapp │ │ │ ├── BBox.java │ │ │ ├── CameraActivity.java │ │ │ ├── MainActivity.java │ │ │ └── Result.java │ │ └── res │ │ ├── layout │ │ ├── activity_camera.xml │ │ ├── activity_main.xml │ │ └── texture_view.xml │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── make_assets.py ├── benchmarks └── encoding_decoding.py ├── cmake ├── TorchVisionConfig.cmake.in └── iOS.cmake ├── docs ├── Makefile ├── make.bat ├── requirements.txt └── source │ ├── _static │ ├── css │ │ └── custom_torchvision.css │ └── img │ │ ├── pytorch-logo-dark.png │ │ ├── pytorch-logo-dark.svg │ │ ├── pytorch-logo-flame.png │ │ └── pytorch-logo-flame.svg │ ├── _templates │ ├── class.rst │ ├── class_dataset.rst │ ├── function.rst │ └── layout.html │ ├── beta_status.py │ ├── conf.py │ ├── datasets.rst │ ├── docutils.conf │ ├── feature_extraction.rst │ ├── index.rst │ ├── io.rst │ ├── models.rst │ ├── models │ ├── alexnet.rst │ ├── convnext.rst │ ├── deeplabv3.rst │ ├── densenet.rst │ ├── efficientnet.rst │ ├── efficientnetv2.rst │ ├── faster_rcnn.rst │ ├── fcn.rst │ ├── fcos.rst │ ├── googlenet.rst │ ├── googlenet_quant.rst │ ├── inception.rst │ ├── inception_quant.rst │ ├── keypoint_rcnn.rst │ ├── lraspp.rst │ ├── mask_rcnn.rst │ ├── maxvit.rst │ ├── mnasnet.rst │ ├── mobilenetv2.rst │ ├── mobilenetv2_quant.rst │ ├── mobilenetv3.rst │ ├── mobilenetv3_quant.rst │ ├── raft.rst │ ├── regnet.rst │ ├── resnet.rst │ ├── resnet_quant.rst │ ├── resnext.rst │ ├── resnext_quant.rst │ ├── retinanet.rst │ ├── shufflenetv2.rst │ ├── shufflenetv2_quant.rst │ ├── squeezenet.rst │ ├── ssd.rst │ ├── ssdlite.rst │ ├── swin_transformer.rst │ ├── vgg.rst │ ├── video_mvit.rst │ ├── video_resnet.rst │ ├── video_s3d.rst │ ├── video_swin_transformer.rst │ ├── vision_transformer.rst │ └── wide_resnet.rst │ ├── ops.rst │ ├── training_references.rst │ ├── transforms.rst │ ├── tv_tensors.rst │ └── utils.rst ├── examples ├── cpp │ ├── CMakeLists.txt │ ├── README.md │ ├── run_model.cpp │ └── script_model.py └── python │ └── README.md ├── gallery ├── README.rst ├── assets │ ├── FudanPed00054.png │ ├── FudanPed00054_mask.png │ ├── astronaut.jpg │ ├── basketball.mp4 │ ├── coco │ │ ├── images │ │ │ ├── 000000000001.jpg │ │ │ └── 000000000002.jpg │ │ └── instances.json │ ├── dog1.jpg │ ├── dog2.jpg │ ├── imagenet_class_index.json │ ├── leaning_tower.jpg │ ├── person1.jpg │ ├── pottery.jpg │ ├── repurposing_annotations_thumbnail.png │ ├── transforms_thumbnail.png │ └── visualization_utils_thumbnail2.png ├── others │ ├── README.rst │ ├── plot_optical_flow.py │ ├── plot_repurposing_annotations.py │ ├── plot_scripted_tensor_transforms.py │ └── plot_visualization_utils.py └── transforms │ ├── README.rst │ ├── helpers.py │ ├── plot_custom_transforms.py │ ├── plot_custom_tv_tensors.py │ ├── plot_cutmix_mixup.py │ ├── plot_keypoints_transforms.py │ ├── plot_rotated_box_transforms.py │ ├── plot_transforms_e2e.py │ ├── plot_transforms_getting_started.py │ ├── plot_transforms_illustrations.py │ └── plot_tv_tensors.py ├── hubconf.py ├── ios ├── CMakeLists.txt ├── LibTorchvision.podspec ├── README.md ├── VisionTestApp │ ├── VisionTestApp.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── VisionTestApp │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ ├── AccentColor.colorset │ │ │ │ └── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── ModelRunner.h │ │ ├── ModelRunner.mm │ │ ├── ViewController.h │ │ ├── ViewController.mm │ │ └── main.m │ ├── clean.sh │ ├── make_assets.py │ └── setup.sh └── build_ios.sh ├── maintainer_guide.md ├── mypy.ini ├── packaging ├── cut_release.sh ├── post_build_script.sh ├── pre_build_script.sh ├── pre_build_script_arm64.sh ├── wheel │ └── relocate.py └── windows │ └── internal │ ├── build_cmake.bat │ ├── build_cpp_example.bat │ └── vc_env_helper.bat ├── pyproject.toml ├── pytest.ini ├── references ├── classification │ ├── README.md │ ├── presets.py │ ├── sampler.py │ ├── train.py │ ├── train_quantization.py │ ├── transforms.py │ └── utils.py ├── depth │ └── stereo │ │ ├── README.md │ │ ├── __init__.py │ │ ├── assets │ │ ├── Loss.jpg │ │ ├── disparity-background-mode-collapse.jpg │ │ ├── disparity-domain-drift.jpg │ │ └── gradient-norm-removal.jpg │ │ ├── cascade_evaluation.py │ │ ├── parsing.py │ │ ├── presets.py │ │ ├── train.py │ │ ├── transforms.py │ │ ├── utils │ │ ├── __init__.py │ │ ├── distributed.py │ │ ├── logger.py │ │ ├── losses.py │ │ ├── metrics.py │ │ ├── norm.py │ │ └── padder.py │ │ └── visualization.py ├── detection │ ├── README.md │ ├── coco_eval.py │ ├── coco_utils.py │ ├── engine.py │ ├── group_by_aspect_ratio.py │ ├── presets.py │ ├── train.py │ ├── transforms.py │ └── utils.py ├── optical_flow │ ├── README.md │ ├── presets.py │ ├── train.py │ ├── transforms.py │ └── utils.py ├── segmentation │ ├── README.md │ ├── coco_utils.py │ ├── presets.py │ ├── train.py │ ├── transforms.py │ ├── utils.py │ └── v2_extras.py ├── similarity │ ├── README.md │ ├── loss.py │ ├── model.py │ ├── sampler.py │ ├── test.py │ └── train.py └── video_classification │ ├── README.md │ ├── datasets.py │ ├── presets.py │ ├── train.py │ ├── transforms.py │ └── utils.py ├── release ├── README.md └── apply-release-changes.py ├── scripts ├── README.rst ├── collect_model_urls.py ├── download_model_urls.py ├── fbcode_to_main_sync.sh └── release_notes │ ├── classify_prs.py │ └── retrieve_prs_data.py ├── setup.cfg ├── setup.py ├── test ├── _utils_internal.py ├── assets │ ├── damaged_jpeg │ │ ├── TensorFlow-LICENSE │ │ ├── bad_huffman.jpg │ │ ├── corrupt.jpg │ │ ├── corrupt34_2.jpg │ │ ├── corrupt34_3.jpg │ │ └── corrupt34_4.jpg │ ├── damaged_png │ │ └── sigsegv.png │ ├── encode_jpeg │ │ ├── grace_hopper_517x606.jpg │ │ └── jpeg_write │ │ │ └── grace_hopper_517x606_pil.jpg │ ├── expected_flow.pt │ ├── fakedata │ │ ├── draw_boxes_different_label_background_colors.png │ │ ├── draw_boxes_different_label_colors.png │ │ ├── draw_boxes_different_label_fill_colors.png │ │ ├── draw_boxes_util.png │ │ ├── draw_boxes_vanilla.png │ │ ├── draw_keypoint_vanilla.png │ │ ├── draw_keypoints_visibility.png │ │ ├── draw_rotated_boxes.png │ │ ├── draw_rotated_boxes_fill.png │ │ ├── imagefolder │ │ │ ├── a │ │ │ │ ├── a1.png │ │ │ │ ├── a2.png │ │ │ │ └── a3.png │ │ │ └── b │ │ │ │ ├── b1.png │ │ │ │ ├── b2.png │ │ │ │ ├── b3.png │ │ │ │ └── b4.png │ │ └── logos │ │ │ ├── cmyk_pytorch.jpg │ │ │ ├── gray_pytorch.jpg │ │ │ ├── gray_pytorch.png │ │ │ ├── grayalpha_pytorch.png │ │ │ ├── palette_pytorch.png │ │ │ ├── rgb_pytorch.avif │ │ │ ├── rgb_pytorch.jpg │ │ │ ├── rgb_pytorch.png │ │ │ ├── rgb_pytorch.webp │ │ │ ├── rgb_pytorch16.png │ │ │ ├── rgb_pytorch_incorrectly_encoded_but_who_cares.heic │ │ │ ├── rgbalpha_pytorch.png │ │ │ └── rgbalpha_pytorch16.png │ ├── gaussian_blur_opencv_results.pt │ ├── interlaced_png │ │ ├── wizard_low-interlaced.png │ │ └── wizard_low.png │ ├── labeled_image.png │ ├── masks.tiff │ ├── toosmall_png │ │ └── heapbof.png │ └── videos │ │ ├── R6llTwEh07w.mp4 │ │ ├── RATRACE_wave_f_nm_np1_fr_goo_37.avi │ │ ├── README │ │ ├── SOX5yA1l24A.mp4 │ │ ├── SchoolRulesHowTheyHelpUs_wave_f_nm_np1_ba_med_0.avi │ │ ├── TrumanShow_wave_f_nm_np1_fr_med_26.avi │ │ ├── WUzgd7C1pWA.mp4 │ │ ├── hmdb51_Turnk_r_Pippi_Michel_cartwheel_f_cm_np2_le_med_6.avi │ │ ├── v_SoccerJuggling_g23_c01.avi │ │ └── v_SoccerJuggling_g24_c01.avi ├── builtin_dataset_mocks.py ├── common_extended_utils.py ├── common_utils.py ├── conftest.py ├── cpp │ └── test_custom_operators.cpp ├── datasets_utils.py ├── expect │ ├── ModelTester.test_alexnet_expect.pkl │ ├── ModelTester.test_convnext_base_expect.pkl │ ├── ModelTester.test_convnext_large_expect.pkl │ ├── ModelTester.test_convnext_small_expect.pkl │ ├── ModelTester.test_convnext_tiny_expect.pkl │ ├── ModelTester.test_crestereo_base_expect.pkl │ ├── ModelTester.test_deeplabv3_mobilenet_v3_large_expect.pkl │ ├── ModelTester.test_deeplabv3_resnet101_expect.pkl │ ├── ModelTester.test_deeplabv3_resnet50_expect.pkl │ ├── ModelTester.test_densenet121_expect.pkl │ ├── ModelTester.test_densenet161_expect.pkl │ ├── ModelTester.test_densenet169_expect.pkl │ ├── ModelTester.test_densenet201_expect.pkl │ ├── ModelTester.test_efficientnet_b0_expect.pkl │ ├── ModelTester.test_efficientnet_b1_expect.pkl │ ├── ModelTester.test_efficientnet_b2_expect.pkl │ ├── ModelTester.test_efficientnet_b3_expect.pkl │ ├── ModelTester.test_efficientnet_b4_expect.pkl │ ├── ModelTester.test_efficientnet_b5_expect.pkl │ ├── ModelTester.test_efficientnet_b6_expect.pkl │ ├── ModelTester.test_efficientnet_b7_expect.pkl │ ├── ModelTester.test_efficientnet_v2_l_expect.pkl │ ├── ModelTester.test_efficientnet_v2_m_expect.pkl │ ├── ModelTester.test_efficientnet_v2_s_expect.pkl │ ├── ModelTester.test_fasterrcnn_mobilenet_v3_large_320_fpn_expect.pkl │ ├── ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl │ ├── ModelTester.test_fasterrcnn_resnet50_fpn_expect.pkl │ ├── ModelTester.test_fasterrcnn_resnet50_fpn_v2_expect.pkl │ ├── ModelTester.test_fcn_resnet101_expect.pkl │ ├── ModelTester.test_fcn_resnet50_expect.pkl │ ├── ModelTester.test_fcos_resnet50_fpn_expect.pkl │ ├── ModelTester.test_googlenet_expect.pkl │ ├── ModelTester.test_googlenet_quantized_expect.pkl │ ├── ModelTester.test_inception_v3_expect.pkl │ ├── ModelTester.test_keypointrcnn_resnet50_fpn_expect.pkl │ ├── ModelTester.test_lraspp_mobilenet_v3_large_expect.pkl │ ├── ModelTester.test_maskrcnn_resnet50_fpn_expect.pkl │ ├── ModelTester.test_maskrcnn_resnet50_fpn_v2_expect.pkl │ ├── ModelTester.test_maxvit_t_expect.pkl │ ├── ModelTester.test_mc3_18_expect.pkl │ ├── ModelTester.test_mnasnet0_5_expect.pkl │ ├── ModelTester.test_mnasnet0_75_expect.pkl │ ├── ModelTester.test_mnasnet1_0_expect.pkl │ ├── ModelTester.test_mnasnet1_3_expect.pkl │ ├── ModelTester.test_mobilenet_v2_expect.pkl │ ├── ModelTester.test_mobilenet_v2_quantized_expect.pkl │ ├── ModelTester.test_mobilenet_v3_large_expect.pkl │ ├── ModelTester.test_mobilenet_v3_large_quantized_expect.pkl │ ├── ModelTester.test_mobilenet_v3_small_expect.pkl │ ├── ModelTester.test_mobilenetv2_residual_setting_expect.pkl │ ├── ModelTester.test_mvit_v1_b_expect.pkl │ ├── ModelTester.test_mvit_v2_s_expect.pkl │ ├── ModelTester.test_r2plus1d_18_expect.pkl │ ├── ModelTester.test_r3d_18_expect.pkl │ ├── ModelTester.test_raft_large_expect.pkl │ ├── ModelTester.test_raft_small_expect.pkl │ ├── ModelTester.test_raft_stereo_base_expect.pkl │ ├── ModelTester.test_raft_stereo_realtime_expect.pkl │ ├── ModelTester.test_regnet_x_16gf_expect.pkl │ ├── ModelTester.test_regnet_x_1_6gf_expect.pkl │ ├── ModelTester.test_regnet_x_32gf_expect.pkl │ ├── ModelTester.test_regnet_x_3_2gf_expect.pkl │ ├── ModelTester.test_regnet_x_400mf_expect.pkl │ ├── ModelTester.test_regnet_x_800mf_expect.pkl │ ├── ModelTester.test_regnet_x_8gf_expect.pkl │ ├── ModelTester.test_regnet_y_128gf_expect.pkl │ ├── ModelTester.test_regnet_y_16gf_expect.pkl │ ├── ModelTester.test_regnet_y_1_6gf_expect.pkl │ ├── ModelTester.test_regnet_y_32gf_expect.pkl │ ├── ModelTester.test_regnet_y_3_2gf_expect.pkl │ ├── ModelTester.test_regnet_y_400mf_expect.pkl │ ├── ModelTester.test_regnet_y_800mf_expect.pkl │ ├── ModelTester.test_regnet_y_8gf_expect.pkl │ ├── ModelTester.test_resnet101_expect.pkl │ ├── ModelTester.test_resnet152_expect.pkl │ ├── ModelTester.test_resnet18_expect.pkl │ ├── ModelTester.test_resnet18_quantized_expect.pkl │ ├── ModelTester.test_resnet34_expect.pkl │ ├── ModelTester.test_resnet50_expect.pkl │ ├── ModelTester.test_resnet50_quantized_expect.pkl │ ├── ModelTester.test_resnext101_32x8d_expect.pkl │ ├── ModelTester.test_resnext101_32x8d_quantized_expect.pkl │ ├── ModelTester.test_resnext101_64x4d_expect.pkl │ ├── ModelTester.test_resnext101_64x4d_quantized_expect.pkl │ ├── ModelTester.test_resnext50_32x4d_expect.pkl │ ├── ModelTester.test_retinanet_resnet50_fpn_expect.pkl │ ├── ModelTester.test_retinanet_resnet50_fpn_v2_expect.pkl │ ├── ModelTester.test_s3d_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x0_5_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x0_5_quantized_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x1_0_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x1_0_quantized_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x1_5_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x1_5_quantized_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x2_0_expect.pkl │ ├── ModelTester.test_shufflenet_v2_x2_0_quantized_expect.pkl │ ├── ModelTester.test_squeezenet1_0_expect.pkl │ ├── ModelTester.test_squeezenet1_1_expect.pkl │ ├── ModelTester.test_ssd300_vgg16_expect.pkl │ ├── ModelTester.test_ssdlite320_mobilenet_v3_large_expect.pkl │ ├── ModelTester.test_swin3d_b_expect.pkl │ ├── ModelTester.test_swin3d_s_expect.pkl │ ├── ModelTester.test_swin3d_t_expect.pkl │ ├── ModelTester.test_swin_b_expect.pkl │ ├── ModelTester.test_swin_s_expect.pkl │ ├── ModelTester.test_swin_t_expect.pkl │ ├── ModelTester.test_swin_v2_b_expect.pkl │ ├── ModelTester.test_swin_v2_s_expect.pkl │ ├── ModelTester.test_swin_v2_t_expect.pkl │ ├── ModelTester.test_vgg11_bn_expect.pkl │ ├── ModelTester.test_vgg11_expect.pkl │ ├── ModelTester.test_vgg13_bn_expect.pkl │ ├── ModelTester.test_vgg13_expect.pkl │ ├── ModelTester.test_vgg16_bn_expect.pkl │ ├── ModelTester.test_vgg16_expect.pkl │ ├── ModelTester.test_vgg19_bn_expect.pkl │ ├── ModelTester.test_vgg19_expect.pkl │ ├── ModelTester.test_vit_b_16_expect.pkl │ ├── ModelTester.test_vit_b_32_expect.pkl │ ├── ModelTester.test_vit_h_14_expect.pkl │ ├── ModelTester.test_vit_l_16_expect.pkl │ ├── ModelTester.test_vit_l_32_expect.pkl │ ├── ModelTester.test_vitc_b_16_expect.pkl │ ├── ModelTester.test_wide_resnet101_2_expect.pkl │ └── ModelTester.test_wide_resnet50_2_expect.pkl ├── optests_failures_dict.json ├── preprocess-bench.py ├── smoke_test.py ├── test_architecture_ops.py ├── test_backbone_utils.py ├── test_datasets.py ├── test_datasets_download.py ├── test_datasets_samplers.py ├── test_datasets_utils.py ├── test_datasets_video_utils.py ├── test_datasets_video_utils_opt.py ├── test_extended_models.py ├── test_functional_tensor.py ├── test_image.py ├── test_internal_utils.py ├── test_internet.py ├── test_io.py ├── test_io_opt.py ├── test_models.py ├── test_models_detection_anchor_utils.py ├── test_models_detection_negative_samples.py ├── test_models_detection_utils.py ├── test_onnx.py ├── test_ops.py ├── test_prototype_datasets_builtin.py ├── test_prototype_datasets_utils.py ├── test_prototype_models.py ├── test_prototype_transforms.py ├── test_transforms.py ├── test_transforms_tensor.py ├── test_transforms_v2.py ├── test_transforms_v2_utils.py ├── test_transforms_video.py ├── test_tv_tensors.py ├── test_utils.py ├── test_video_gpu_decoder.py ├── test_video_reader.py └── test_videoapi.py ├── torchvision ├── __init__.py ├── _internally_replaced_utils.py ├── _meta_registrations.py ├── _utils.py ├── csrc │ ├── io │ │ ├── decoder │ │ │ ├── audio_sampler.cpp │ │ │ ├── audio_sampler.h │ │ │ ├── audio_stream.cpp │ │ │ ├── audio_stream.h │ │ │ ├── cc_stream.cpp │ │ │ ├── cc_stream.h │ │ │ ├── decoder.cpp │ │ │ ├── decoder.h │ │ │ ├── defs.h │ │ │ ├── gpu │ │ │ │ ├── README.rst │ │ │ │ ├── decoder.cpp │ │ │ │ ├── decoder.h │ │ │ │ ├── demuxer.h │ │ │ │ ├── gpu_decoder.cpp │ │ │ │ └── gpu_decoder.h │ │ │ ├── memory_buffer.cpp │ │ │ ├── memory_buffer.h │ │ │ ├── seekable_buffer.cpp │ │ │ ├── seekable_buffer.h │ │ │ ├── stream.cpp │ │ │ ├── stream.h │ │ │ ├── subtitle_sampler.cpp │ │ │ ├── subtitle_sampler.h │ │ │ ├── subtitle_stream.cpp │ │ │ ├── subtitle_stream.h │ │ │ ├── sync_decoder.cpp │ │ │ ├── sync_decoder.h │ │ │ ├── sync_decoder_test.cpp │ │ │ ├── time_keeper.cpp │ │ │ ├── time_keeper.h │ │ │ ├── util.cpp │ │ │ ├── util.h │ │ │ ├── util_test.cpp │ │ │ ├── video_sampler.cpp │ │ │ ├── video_sampler.h │ │ │ ├── video_stream.cpp │ │ │ └── video_stream.h │ │ ├── image │ │ │ ├── common.cpp │ │ │ ├── common.h │ │ │ ├── cpu │ │ │ │ ├── common_jpeg.cpp │ │ │ │ ├── common_jpeg.h │ │ │ │ ├── common_png.h │ │ │ │ ├── decode_gif.cpp │ │ │ │ ├── decode_gif.h │ │ │ │ ├── decode_image.cpp │ │ │ │ ├── decode_image.h │ │ │ │ ├── decode_jpeg.cpp │ │ │ │ ├── decode_jpeg.h │ │ │ │ ├── decode_png.cpp │ │ │ │ ├── decode_png.h │ │ │ │ ├── decode_webp.cpp │ │ │ │ ├── decode_webp.h │ │ │ │ ├── encode_jpeg.cpp │ │ │ │ ├── encode_jpeg.h │ │ │ │ ├── encode_png.cpp │ │ │ │ ├── encode_png.h │ │ │ │ ├── exif.h │ │ │ │ ├── giflib │ │ │ │ │ ├── README │ │ │ │ │ ├── dgif_lib.c │ │ │ │ │ ├── gif_hash.c │ │ │ │ │ ├── gif_hash.h │ │ │ │ │ ├── gif_lib.h │ │ │ │ │ ├── gif_lib_private.h │ │ │ │ │ ├── gifalloc.c │ │ │ │ │ └── openbsd-reallocarray.c │ │ │ │ ├── read_write_file.cpp │ │ │ │ └── read_write_file.h │ │ │ ├── cuda │ │ │ │ ├── decode_jpegs_cuda.cpp │ │ │ │ ├── decode_jpegs_cuda.h │ │ │ │ ├── encode_decode_jpegs_cuda.h │ │ │ │ ├── encode_jpegs_cuda.cpp │ │ │ │ └── encode_jpegs_cuda.h │ │ │ ├── image.cpp │ │ │ └── image.h │ │ ├── video │ │ │ ├── video.cpp │ │ │ └── video.h │ │ └── video_reader │ │ │ ├── video_reader.cpp │ │ │ └── video_reader.h │ ├── macros.h │ ├── ops │ │ ├── autocast │ │ │ ├── deform_conv2d_kernel.cpp │ │ │ ├── nms_kernel.cpp │ │ │ ├── ps_roi_align_kernel.cpp │ │ │ ├── ps_roi_pool_kernel.cpp │ │ │ ├── roi_align_kernel.cpp │ │ │ └── roi_pool_kernel.cpp │ │ ├── autograd │ │ │ ├── deform_conv2d_kernel.cpp │ │ │ ├── ps_roi_align_kernel.cpp │ │ │ ├── ps_roi_pool_kernel.cpp │ │ │ ├── roi_align_kernel.cpp │ │ │ └── roi_pool_kernel.cpp │ │ ├── cpu │ │ │ ├── deform_conv2d_kernel.cpp │ │ │ ├── nms_kernel.cpp │ │ │ ├── ps_roi_align_kernel.cpp │ │ │ ├── ps_roi_pool_kernel.cpp │ │ │ ├── roi_align_common.h │ │ │ ├── roi_align_kernel.cpp │ │ │ └── roi_pool_kernel.cpp │ │ ├── cuda │ │ │ ├── cuda_helpers.h │ │ │ ├── deform_conv2d_kernel.cu │ │ │ ├── nms_kernel.cu │ │ │ ├── ps_roi_align_kernel.cu │ │ │ ├── ps_roi_pool_kernel.cu │ │ │ ├── roi_align_kernel.cu │ │ │ └── roi_pool_kernel.cu │ │ ├── deform_conv2d.cpp │ │ ├── deform_conv2d.h │ │ ├── mps │ │ │ ├── deform_conv2d_kernel.mm │ │ │ ├── mps_helpers.h │ │ │ ├── mps_kernels.h │ │ │ ├── nms_kernel.mm │ │ │ ├── ps_roi_align_kernel.mm │ │ │ ├── ps_roi_pool_kernel.mm │ │ │ ├── roi_align_kernel.mm │ │ │ └── roi_pool_kernel.mm │ │ ├── nms.cpp │ │ ├── nms.h │ │ ├── ops.h │ │ ├── ps_roi_align.cpp │ │ ├── ps_roi_align.h │ │ ├── ps_roi_pool.cpp │ │ ├── ps_roi_pool.h │ │ ├── quantized │ │ │ └── cpu │ │ │ │ ├── qnms_kernel.cpp │ │ │ │ └── qroi_align_kernel.cpp │ │ ├── roi_align.cpp │ │ ├── roi_align.h │ │ ├── roi_pool.cpp │ │ └── roi_pool.h │ ├── vision.cpp │ └── vision.h ├── datasets │ ├── __init__.py │ ├── _optical_flow.py │ ├── _stereo_matching.py │ ├── caltech.py │ ├── celeba.py │ ├── cifar.py │ ├── cityscapes.py │ ├── clevr.py │ ├── coco.py │ ├── country211.py │ ├── dtd.py │ ├── eurosat.py │ ├── fakedata.py │ ├── fer2013.py │ ├── fgvc_aircraft.py │ ├── flickr.py │ ├── flowers102.py │ ├── folder.py │ ├── food101.py │ ├── gtsrb.py │ ├── hmdb51.py │ ├── imagenet.py │ ├── imagenette.py │ ├── inaturalist.py │ ├── kinetics.py │ ├── kitti.py │ ├── lfw.py │ ├── lsun.py │ ├── mnist.py │ ├── moving_mnist.py │ ├── omniglot.py │ ├── oxford_iiit_pet.py │ ├── pcam.py │ ├── phototour.py │ ├── places365.py │ ├── rendered_sst2.py │ ├── samplers │ │ ├── __init__.py │ │ └── clip_sampler.py │ ├── sbd.py │ ├── sbu.py │ ├── semeion.py │ ├── stanford_cars.py │ ├── stl10.py │ ├── sun397.py │ ├── svhn.py │ ├── ucf101.py │ ├── usps.py │ ├── utils.py │ ├── video_utils.py │ ├── vision.py │ ├── voc.py │ └── widerface.py ├── extension.py ├── io │ ├── __init__.py │ ├── _load_gpu_decoder.py │ ├── _video_deprecation_warning.py │ ├── _video_opt.py │ ├── image.py │ ├── video.py │ └── video_reader.py ├── models │ ├── __init__.py │ ├── _api.py │ ├── _meta.py │ ├── _utils.py │ ├── alexnet.py │ ├── convnext.py │ ├── densenet.py │ ├── detection │ │ ├── __init__.py │ │ ├── _utils.py │ │ ├── anchor_utils.py │ │ ├── backbone_utils.py │ │ ├── faster_rcnn.py │ │ ├── fcos.py │ │ ├── generalized_rcnn.py │ │ ├── image_list.py │ │ ├── keypoint_rcnn.py │ │ ├── mask_rcnn.py │ │ ├── retinanet.py │ │ ├── roi_heads.py │ │ ├── rpn.py │ │ ├── ssd.py │ │ ├── ssdlite.py │ │ └── transform.py │ ├── efficientnet.py │ ├── feature_extraction.py │ ├── googlenet.py │ ├── inception.py │ ├── maxvit.py │ ├── mnasnet.py │ ├── mobilenet.py │ ├── mobilenetv2.py │ ├── mobilenetv3.py │ ├── optical_flow │ │ ├── __init__.py │ │ ├── _utils.py │ │ └── raft.py │ ├── quantization │ │ ├── __init__.py │ │ ├── googlenet.py │ │ ├── inception.py │ │ ├── mobilenet.py │ │ ├── mobilenetv2.py │ │ ├── mobilenetv3.py │ │ ├── resnet.py │ │ ├── shufflenetv2.py │ │ └── utils.py │ ├── regnet.py │ ├── resnet.py │ ├── segmentation │ │ ├── __init__.py │ │ ├── _utils.py │ │ ├── deeplabv3.py │ │ ├── fcn.py │ │ └── lraspp.py │ ├── shufflenetv2.py │ ├── squeezenet.py │ ├── swin_transformer.py │ ├── vgg.py │ ├── video │ │ ├── __init__.py │ │ ├── mvit.py │ │ ├── resnet.py │ │ ├── s3d.py │ │ └── swin_transformer.py │ └── vision_transformer.py ├── ops │ ├── __init__.py │ ├── _box_convert.py │ ├── _register_onnx_ops.py │ ├── _utils.py │ ├── boxes.py │ ├── ciou_loss.py │ ├── deform_conv.py │ ├── diou_loss.py │ ├── drop_block.py │ ├── feature_pyramid_network.py │ ├── focal_loss.py │ ├── giou_loss.py │ ├── misc.py │ ├── poolers.py │ ├── ps_roi_align.py │ ├── ps_roi_pool.py │ ├── roi_align.py │ ├── roi_pool.py │ └── stochastic_depth.py ├── prototype │ ├── __init__.py │ ├── datasets │ │ ├── README.md │ │ ├── __init__.py │ │ ├── _api.py │ │ ├── _builtin │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── caltech.py │ │ │ ├── caltech101.categories │ │ │ ├── caltech256.categories │ │ │ ├── celeba.py │ │ │ ├── cifar.py │ │ │ ├── cifar10.categories │ │ │ ├── cifar100.categories │ │ │ ├── clevr.py │ │ │ ├── coco.categories │ │ │ ├── coco.py │ │ │ ├── country211.categories │ │ │ ├── country211.py │ │ │ ├── cub200.categories │ │ │ ├── cub200.py │ │ │ ├── dtd.categories │ │ │ ├── dtd.py │ │ │ ├── eurosat.py │ │ │ ├── fer2013.py │ │ │ ├── food101.categories │ │ │ ├── food101.py │ │ │ ├── gtsrb.py │ │ │ ├── imagenet.categories │ │ │ ├── imagenet.py │ │ │ ├── mnist.py │ │ │ ├── oxford-iiit-pet.categories │ │ │ ├── oxford_iiit_pet.py │ │ │ ├── pcam.py │ │ │ ├── sbd.categories │ │ │ ├── sbd.py │ │ │ ├── semeion.py │ │ │ ├── stanford-cars.categories │ │ │ ├── stanford_cars.py │ │ │ ├── svhn.py │ │ │ ├── usps.py │ │ │ ├── voc.categories │ │ │ └── voc.py │ │ ├── _folder.py │ │ ├── _home.py │ │ ├── benchmark.py │ │ ├── generate_category_files.py │ │ └── utils │ │ │ ├── __init__.py │ │ │ ├── _dataset.py │ │ │ ├── _encoded.py │ │ │ ├── _internal.py │ │ │ └── _resource.py │ ├── models │ │ ├── __init__.py │ │ └── depth │ │ │ ├── __init__.py │ │ │ └── stereo │ │ │ ├── __init__.py │ │ │ ├── crestereo.py │ │ │ └── raft_stereo.py │ ├── transforms │ │ ├── __init__.py │ │ ├── _augment.py │ │ ├── _geometry.py │ │ ├── _misc.py │ │ ├── _presets.py │ │ └── _type_conversion.py │ ├── tv_tensors │ │ ├── __init__.py │ │ └── _label.py │ └── utils │ │ ├── __init__.py │ │ └── _internal.py ├── transforms │ ├── __init__.py │ ├── _functional_pil.py │ ├── _functional_tensor.py │ ├── _functional_video.py │ ├── _presets.py │ ├── _transforms_video.py │ ├── autoaugment.py │ ├── functional.py │ ├── transforms.py │ └── v2 │ │ ├── __init__.py │ │ ├── _augment.py │ │ ├── _auto_augment.py │ │ ├── _color.py │ │ ├── _container.py │ │ ├── _deprecated.py │ │ ├── _geometry.py │ │ ├── _meta.py │ │ ├── _misc.py │ │ ├── _temporal.py │ │ ├── _transform.py │ │ ├── _type_conversion.py │ │ ├── _utils.py │ │ └── functional │ │ ├── __init__.py │ │ ├── _augment.py │ │ ├── _color.py │ │ ├── _deprecated.py │ │ ├── _geometry.py │ │ ├── _meta.py │ │ ├── _misc.py │ │ ├── _temporal.py │ │ ├── _type_conversion.py │ │ └── _utils.py ├── tv_tensors │ ├── __init__.py │ ├── _bounding_boxes.py │ ├── _dataset_wrapper.py │ ├── _image.py │ ├── _keypoints.py │ ├── _mask.py │ ├── _torch_function_helpers.py │ ├── _tv_tensor.py │ └── _video.py └── utils.py └── version.txt /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # This file keeps git blame clean. 2 | # See https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view 3 | 4 | # Add ufmt (usort + black) as code formatter (#4384) 5 | 5f0edb97b46e5bff71dc19dedef05c5396eeaea2 6 | # update python syntax >=3.6 (#4585) 7 | d367a01a18a3ae6bee13d8be3b63fd6a581ea46f 8 | # Upgrade usort to 1.0.2 and black to 22.3.0 (#5106) 9 | 6ca9c76adb6daf2695d603ad623a9cf1c4f4806f 10 | # Fix unnecessary exploded black formatting (#7709) 11 | a335d916db0694770e8152f41e19195de3134523 12 | # Renaming: `BoundingBox` -> `BoundingBoxes` (#7778) 13 | 332bff937c6711666191880fab57fa2f23ae772e 14 | # Upgrade type hint and others to Python 3.9 (#8814) 15 | a095de183d3811d79ed0db2715e7a1c3162fa19d 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pkl binary 2 | # Jupyter notebook 3 | 4 | # For text count 5 | # *.ipynb text 6 | 7 | # To ignore it use below 8 | *.ipynb linguist-documentation 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Usage questions 4 | url: https://discuss.pytorch.org/ 5 | about: Ask questions and discuss with other torchvision community members 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.yml: -------------------------------------------------------------------------------- 1 | name: 📚 Documentation 2 | description: Report an issue related to https://pytorch.org/vision/stable/index.html 3 | 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: 📚 The doc issue 8 | description: > 9 | A clear and concise description of what content in https://pytorch.org/vision/stable/index.html is an issue. If this has to do with the general https://pytorch.org website, please file an issue at https://github.com/pytorch/pytorch.github.io/issues/new/choose instead. If this has to do with https://pytorch.org/tutorials, please file an issue at https://github.com/pytorch/tutorials/issues/new. 10 | validations: 11 | required: true 12 | - type: textarea 13 | attributes: 14 | label: Suggest a potential alternative/fix 15 | description: > 16 | Tell us how we could improve the documentation in this regard. 17 | - type: markdown 18 | attributes: 19 | value: > 20 | Thanks for contributing 🎉! 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: 🚀 Feature request 2 | description: Submit a proposal/request for a new torchvision feature 3 | 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: 🚀 The feature 8 | description: > 9 | A clear and concise description of the feature proposal 10 | validations: 11 | required: true 12 | - type: textarea 13 | attributes: 14 | label: Motivation, pitch 15 | description: > 16 | Please outline the motivation for the proposal. Is your feature request related to a specific problem? e.g., *"I'm working on X and would like Y to be possible"*. If this is related to another GitHub issue, please link here too. 17 | validations: 18 | required: true 19 | - type: textarea 20 | attributes: 21 | label: Alternatives 22 | description: > 23 | A description of any alternative solutions or features you've considered, if any. 24 | - type: textarea 25 | attributes: 26 | label: Additional context 27 | description: > 28 | Add any other context or screenshots about the feature request. 29 | - type: markdown 30 | attributes: 31 | value: > 32 | Thanks for contributing 🎉! 33 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.github/failed_schedule_issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Scheduled workflow failed 3 | labels: 4 | - bug 5 | - "module: datasets" 6 | --- 7 | 8 | Oh no, something went wrong in the scheduled workflow {{ env.WORKFLOW }}/{{ env.JOB }}. 9 | Please look into it: 10 | 11 | https://github.com/{{ env.REPO }}/actions/runs/{{ env.ID }} 12 | 13 | Feel free to close this if this was just a one-off error. 14 | -------------------------------------------------------------------------------- /.github/pytorch-probot.yml: -------------------------------------------------------------------------------- 1 | tracking_issue: 2447 2 | 3 | # List of workflows that will be re-run in case of failures 4 | # https://github.com/pytorch/test-infra/blob/main/torchci/lib/bot/retryBot.ts 5 | retryable_workflows: 6 | - Build Linux 7 | - Build Macos 8 | - Build M1 9 | - Build Windows 10 | - Tests 11 | -------------------------------------------------------------------------------- /.github/scripts/export_IS_M1_CONDA_BUILD_JOB.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export IS_M1_CONDA_BUILD_JOB=1 4 | -------------------------------------------------------------------------------- /.github/scripts/unittest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | ./.github/scripts/setup-env.sh 6 | 7 | # Activate conda environment 8 | eval "$($(which conda) shell.bash hook)" && conda deactivate && conda activate ci 9 | 10 | echo '::group::Install testing utilities' 11 | # TODO: remove the <8 constraint on pytest when https://github.com/pytorch/vision/issues/8238 is closed 12 | pip install --progress-bar=off "pytest<8" pytest-mock pytest-cov expecttest!=0.2.0 requests 13 | echo '::endgroup::' 14 | 15 | python test/smoke_test.py 16 | 17 | # We explicitly ignore the video tests until we resolve https://github.com/pytorch/vision/issues/8162 18 | pytest --ignore-glob="*test_video*" --ignore-glob="*test_onnx*" --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 -k "not TestFxFeatureExtraction" 19 | -------------------------------------------------------------------------------- /.github/workflows/pr-labels.yml: -------------------------------------------------------------------------------- 1 | name: pr-labels 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | is-properly-labeled: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | pull-requests: write 13 | 14 | steps: 15 | - name: Set up python 16 | uses: actions/setup-python@v5 17 | 18 | - name: Install requests 19 | run: pip install requests 20 | 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | - name: Process commit and find merger responsible for labeling 25 | id: commit 26 | run: | 27 | MERGER=$(python .github/process_commit.py ${{ github.sha }}) 28 | echo "merger=${MERGER}" | tee --append $GITHUB_OUTPUT 29 | 30 | - name: Ping merger responsible for labeling if necessary 31 | if: ${{ steps.commit.outputs.merger != '' }} 32 | uses: mshick/add-pr-comment@v2 33 | env: 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 35 | with: 36 | message: | 37 | Hey ${{ steps.commit.outputs.merger }}! 38 | 39 | You merged this PR, but no labels were added. 40 | The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | dist/ 3 | torchvision.egg-info/ 4 | torchvision/version.py 5 | */**/__pycache__ 6 | */__pycache__ 7 | */*.pyc 8 | */**/*.pyc 9 | */**/**/*.pyc 10 | */**/*~ 11 | *~ 12 | 13 | docs/build 14 | # sphinx-gallery 15 | docs/source/auto_examples/ 16 | docs/source/gen_modules/ 17 | docs/source/generated/ 18 | docs/source/models/generated/ 19 | docs/source/sg_execution_times.rst 20 | # pytorch-sphinx-theme gets installed here 21 | docs/src 22 | 23 | .coverage 24 | htmlcov 25 | .*.swp 26 | *.so* 27 | *.dylib* 28 | */*.so* 29 | */*.dylib* 30 | *.swp 31 | *.swo 32 | gen.yml 33 | .mypy_cache 34 | .vscode/ 35 | .idea/ 36 | *.orig 37 | *-checkpoint.ipynb 38 | *.venv 39 | 40 | ## Xcode User settings 41 | xcuserdata/ 42 | 43 | # direnv 44 | .direnv 45 | .envrc 46 | 47 | scripts/release_notes/data.json 48 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.0.1 4 | hooks: 5 | - id: check-docstring-first 6 | - id: check-toml 7 | - id: check-yaml 8 | exclude: packaging/.* 9 | args: 10 | - --allow-multiple-documents 11 | - id: mixed-line-ending 12 | args: [--fix=lf] 13 | - id: end-of-file-fixer 14 | 15 | - repo: https://github.com/omnilib/ufmt 16 | rev: v1.3.3 17 | hooks: 18 | - id: ufmt 19 | additional_dependencies: 20 | - black == 22.3.0 21 | - usort == 1.0.2 22 | 23 | - repo: https://github.com/PyCQA/flake8 24 | rev: 5.0.4 25 | hooks: 26 | - id: flake8 27 | args: [--config=setup.cfg] 28 | 29 | - repo: https://github.com/PyCQA/pydocstyle 30 | rev: 6.1.1 31 | hooks: 32 | - id: pydocstyle 33 | 34 | - repo: https://github.com/pre-commit/mirrors-clang-format 35 | rev: v18.1.3 36 | hooks: 37 | - id: clang-format 38 | name: clang-format 39 | files: \.(cpp|hpp|c|h|cu)$ 40 | types: [file] 41 | exclude: ^torchvision/csrc/io/image/cpu/giflib/ 42 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | title: "TorchVision: PyTorch's Computer Vision library" 3 | message: >- 4 | If you find TorchVision useful in your work, please 5 | consider citing the following BibTeX entry. 6 | type: software 7 | authors: 8 | - given-names: TorchVision maintainers and contributors 9 | url: "https://github.com/pytorch/vision" 10 | license: "BSD-3-Clause" 11 | date-released: "2016-11-06" 12 | journal: "GitHub repository" 13 | publisher: "GitHub" 14 | key: "torchvision2016" 15 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include LICENSE 3 | 4 | recursive-exclude * __pycache__ 5 | recursive-exclude * *.py[co] 6 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | local.properties 2 | **/*.iml 3 | .gradle 4 | .idea/* 5 | .externalNativeBuild 6 | build 7 | -------------------------------------------------------------------------------- /android/README.md: -------------------------------------------------------------------------------- 1 | ## Status 2 | 3 | The Android demo of TorchVision is currently unmaintained, untested and likely out-of-date. 4 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | buildscript { 3 | ext { 4 | minSdkVersion = 21 5 | targetSdkVersion = 28 6 | compileSdkVersion = 28 7 | buildToolsVersion = '28.0.3' 8 | 9 | coreVersion = "1.2.0" 10 | extJUnitVersion = "1.1.1" 11 | runnerVersion = "1.2.0" 12 | rulesVersion = "1.2.0" 13 | junitVersion = "4.12" 14 | 15 | androidSupportAppCompatV7Version = "28.0.0" 16 | fbjniJavaOnlyVersion = "0.0.3" 17 | soLoaderNativeLoaderVersion = "0.10.5" 18 | pytorchAndroidVersion = "1.12" 19 | } 20 | 21 | repositories { 22 | google() 23 | mavenCentral() 24 | } 25 | 26 | dependencies { 27 | classpath 'com.android.tools.build:gradle:4.1.2' 28 | classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2' 29 | } 30 | } 31 | 32 | repositories { 33 | google() 34 | mavenCentral() 35 | } 36 | } 37 | 38 | ext.deps = [ 39 | jsr305: 'com.google.code.findbugs:jsr305:3.0.1', 40 | ] 41 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | ABI_FILTERS=armeabi-v7a,arm64-v8a,x86,x86_64 2 | 3 | VERSION_NAME=0.15.0-SNAPSHOT 4 | GROUP=org.pytorch 5 | MAVEN_GROUP=org.pytorch 6 | SONATYPE_STAGING_PROFILE=orgpytorch 7 | POM_URL=https://github.com/pytorch/vision/ 8 | POM_SCM_URL=https://github.com/pytorch/vision.git 9 | POM_SCM_CONNECTION=scm:git:https://github.com/pytorch/vision 10 | POM_SCM_DEV_CONNECTION=scm:git:git@github.com:pytorch/vision.git 11 | POM_LICENSE_NAME=BSD 3-Clause 12 | POM_LICENSE_URL=https://github.com/pytorch/vision/blob/main/LICENSE 13 | POM_ISSUES_URL=https://github.com/pytorch/vision/issues 14 | POM_LICENSE_DIST=repo 15 | POM_DEVELOPER_ID=pytorch 16 | POM_DEVELOPER_NAME=pytorch 17 | 18 | # Gradle internals 19 | android.useAndroidX=true 20 | android.enableJetifier=true 21 | 22 | testAppAllVariantsEnabled=false 23 | 24 | org.gradle.jvmargs=-Xmx12g 25 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradle_scripts/android_tasks.gradle: -------------------------------------------------------------------------------- 1 | afterEvaluate { project -> 2 | if (POM_PACKAGING == 'aar') { 3 | task headersJar(type: Jar) { 4 | archiveClassifier.set('headers') 5 | from("$rootDir/cxx/") { 6 | include '**/*.h' 7 | } 8 | } 9 | artifacts.add('archives', headersJar) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /android/gradle_scripts/release.gradle: -------------------------------------------------------------------------------- 1 | apply from: rootProject.file('gradle_scripts/android_tasks.gradle') 2 | 3 | apply plugin: 'com.vanniktech.maven.publish' 4 | -------------------------------------------------------------------------------- /android/ops/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | set(TARGET torchvision_ops) 3 | project(${TARGET} CXX) 4 | set(CMAKE_CXX_STANDARD 17) 5 | 6 | string(APPEND CMAKE_CXX_FLAGS " -DMOBILE") 7 | 8 | set(build_DIR ${CMAKE_SOURCE_DIR}/build) 9 | set(root_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 10 | 11 | file(GLOB VISION_SRCS 12 | ../../torchvision/csrc/ops/cpu/*.h 13 | ../../torchvision/csrc/ops/cpu/*.cpp 14 | ../../torchvision/csrc/ops/*.h 15 | ../../torchvision/csrc/ops/*.cpp) 16 | 17 | add_library(${TARGET} SHARED 18 | ${VISION_SRCS} 19 | ) 20 | 21 | file(GLOB PYTORCH_INCLUDE_DIRS "${build_DIR}/pytorch_android*.aar/headers") 22 | file(GLOB PYTORCH_INCLUDE_DIRS_CSRC "${build_DIR}/pytorch_android*.aar/headers/torch/csrc/api/include") 23 | file(GLOB PYTORCH_LINK_DIRS "${build_DIR}/pytorch_android*.aar/jni/${ANDROID_ABI}") 24 | 25 | target_compile_options(${TARGET} PRIVATE 26 | -fexceptions 27 | ) 28 | 29 | set(BUILD_SUBDIR ${ANDROID_ABI}) 30 | 31 | find_library(PYTORCH_LIBRARY pytorch_jni 32 | PATHS ${PYTORCH_LINK_DIRS} 33 | NO_CMAKE_FIND_ROOT_PATH) 34 | 35 | find_library(FBJNI_LIBRARY fbjni 36 | PATHS ${PYTORCH_LINK_DIRS} 37 | NO_CMAKE_FIND_ROOT_PATH) 38 | 39 | target_include_directories(${TARGET} PRIVATE 40 | ${PYTORCH_INCLUDE_DIRS} 41 | ${PYTORCH_INCLUDE_DIRS_CSRC} 42 | ) 43 | 44 | target_link_libraries(${TARGET} PRIVATE 45 | ${PYTORCH_LIBRARY} 46 | ${FBJNI_LIBRARY} 47 | ) 48 | -------------------------------------------------------------------------------- /android/ops/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=torchvision ops 2 | POM_DESCRIPTION=torchvision ops 3 | POM_ARTIFACT_ID=torchvision_ops 4 | POM_PACKAGING=aar 5 | -------------------------------------------------------------------------------- /android/ops/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ops', ':test_app' 2 | 3 | project(':ops').projectDir = file('ops') 4 | project(':test_app').projectDir = file('test_app/app') 5 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/java/org/pytorch/testapp/BBox.java: -------------------------------------------------------------------------------- 1 | package org.pytorch.testapp; 2 | 3 | class BBox { 4 | public final float score; 5 | public final float x0; 6 | public final float y0; 7 | public final float x1; 8 | public final float y1; 9 | 10 | public BBox(float score, float x0, float y0, float x1, float y1) { 11 | this.score = score; 12 | this.x0 = x0; 13 | this.y0 = y0; 14 | this.x1 = x1; 15 | this.y1 = y1; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return String.format("Box{score=%f x0=%f y0=%f x1=%f y1=%f", score, x0, y0, x1, y1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/java/org/pytorch/testapp/Result.java: -------------------------------------------------------------------------------- 1 | package org.pytorch.testapp; 2 | 3 | import java.util.List; 4 | 5 | class Result { 6 | public final int tensorSize; 7 | public final List bboxes; 8 | public final long totalDuration; 9 | public final long moduleForwardDuration; 10 | 11 | public Result(int tensorSize, List bboxes, long moduleForwardDuration, long totalDuration) { 12 | this.tensorSize = tensorSize; 13 | this.bboxes = bboxes; 14 | this.moduleForwardDuration = moduleForwardDuration; 15 | this.totalDuration = totalDuration; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/layout/activity_camera.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/layout/texture_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/android/test_app/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/android/test_app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TV_FRCNN 3 | 4 | -------------------------------------------------------------------------------- /android/test_app/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/test_app/make_assets.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from torch.utils.mobile_optimizer import optimize_for_mobile 3 | from torchvision.models.detection import ( 4 | fasterrcnn_mobilenet_v3_large_320_fpn, 5 | FasterRCNN_MobileNet_V3_Large_320_FPN_Weights, 6 | ) 7 | 8 | print(torch.__version__) 9 | 10 | model = fasterrcnn_mobilenet_v3_large_320_fpn( 11 | weights=FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.DEFAULT, 12 | box_score_thresh=0.7, 13 | rpn_post_nms_top_n_test=100, 14 | rpn_score_thresh=0.4, 15 | rpn_pre_nms_top_n_test=150, 16 | ) 17 | 18 | model.eval() 19 | script_model = torch.jit.script(model) 20 | opt_script_model = optimize_for_mobile(script_model) 21 | opt_script_model.save("app/src/main/assets/frcnn_mnetv3.pt") 22 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | set SPHINXPROJ=torchvision 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | matplotlib 2 | numpy 3 | sphinx-copybutton>=0.3.1 4 | sphinx-gallery>=0.11.1 5 | sphinx==5.0.0 6 | tabulate 7 | -e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme 8 | pycocotools 9 | -------------------------------------------------------------------------------- /docs/source/_static/img/pytorch-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/docs/source/_static/img/pytorch-logo-dark.png -------------------------------------------------------------------------------- /docs/source/_static/img/pytorch-logo-flame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/docs/source/_static/img/pytorch-logo-flame.png -------------------------------------------------------------------------------- /docs/source/_templates/class.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | .. currentmodule:: {{ module }} 4 | 5 | 6 | {{ name | underline}} 7 | 8 | .. autoclass:: {{ name }} 9 | :members: 10 | -------------------------------------------------------------------------------- /docs/source/_templates/class_dataset.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | .. currentmodule:: {{ module }} 4 | 5 | 6 | {{ name | underline}} 7 | 8 | .. autoclass:: {{ name }} 9 | :members: 10 | __getitem__, 11 | {% if "category_name" in methods %} category_name {% endif %} 12 | :special-members: 13 | -------------------------------------------------------------------------------- /docs/source/_templates/function.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | .. currentmodule:: {{ module }} 4 | 5 | 6 | {{ name | underline}} 7 | 8 | .. autofunction:: {{ name }} 9 | -------------------------------------------------------------------------------- /docs/source/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {% block sidebartitle %} 4 | 7 | {% include "searchbox.html" %} 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /docs/source/beta_status.py: -------------------------------------------------------------------------------- 1 | from docutils import nodes 2 | from docutils.parsers.rst import Directive 3 | 4 | 5 | class BetaStatus(Directive): 6 | has_content = True 7 | text = "The {api_name} is in Beta stage, and backward compatibility is not guaranteed." 8 | node = nodes.warning 9 | 10 | def run(self): 11 | text = self.text.format(api_name=" ".join(self.content)) 12 | return [self.node("", nodes.paragraph("", "", nodes.Text(text)))] 13 | 14 | 15 | def setup(app): 16 | app.add_directive("betastatus", BetaStatus) 17 | return { 18 | "version": "0.1", 19 | "parallel_read_safe": True, 20 | "parallel_write_safe": True, 21 | } 22 | -------------------------------------------------------------------------------- /docs/source/docutils.conf: -------------------------------------------------------------------------------- 1 | # Necessary for the table generated by autosummary to look decent 2 | [html writers] 3 | table_style: colwidths-auto 4 | -------------------------------------------------------------------------------- /docs/source/models/alexnet.rst: -------------------------------------------------------------------------------- 1 | AlexNet 2 | ======= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The AlexNet model was originally introduced in the 7 | `ImageNet Classification with Deep Convolutional Neural Networks 8 | `__ 9 | paper. The implemented architecture is slightly different from the original one, 10 | and is based on `One weird trick for parallelizing convolutional neural networks 11 | `__. 12 | 13 | 14 | Model builders 15 | -------------- 16 | 17 | The following model builders can be used to instantiate an AlexNet model, with or 18 | without pre-trained weights. All the model builders internally rely on the 19 | ``torchvision.models.alexnet.AlexNet`` base class. Please refer to the `source 20 | code 21 | `_ for 22 | more details about this class. 23 | 24 | .. autosummary:: 25 | :toctree: generated/ 26 | :template: function.rst 27 | 28 | alexnet 29 | -------------------------------------------------------------------------------- /docs/source/models/convnext.rst: -------------------------------------------------------------------------------- 1 | ConvNeXt 2 | ======== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The ConvNeXt model is based on the `A ConvNet for the 2020s 7 | `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a ConvNeXt model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.convnext.ConvNeXt`` base class. Please refer to the `source code 16 | `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | convnext_tiny 24 | convnext_small 25 | convnext_base 26 | convnext_large 27 | -------------------------------------------------------------------------------- /docs/source/models/deeplabv3.rst: -------------------------------------------------------------------------------- 1 | DeepLabV3 2 | ========= 3 | 4 | .. currentmodule:: torchvision.models.segmentation 5 | 6 | The DeepLabV3 model is based on the `Rethinking Atrous Convolution for Semantic 7 | Image Segmentation `__ paper. 8 | 9 | .. betastatus:: segmentation module 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a DeepLabV3 model with 16 | different backbones, with or without pre-trained weights. All the model builders 17 | internally rely on the ``torchvision.models.segmentation.deeplabv3.DeepLabV3`` base class. Please 18 | refer to the `source code 19 | `_ 20 | for more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | deeplabv3_mobilenet_v3_large 27 | deeplabv3_resnet50 28 | deeplabv3_resnet101 29 | -------------------------------------------------------------------------------- /docs/source/models/densenet.rst: -------------------------------------------------------------------------------- 1 | DenseNet 2 | ======== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The DenseNet model is based on the `Densely Connected Convolutional Networks 7 | `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a DenseNet model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.densenet.DenseNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | densenet121 25 | densenet161 26 | densenet169 27 | densenet201 28 | -------------------------------------------------------------------------------- /docs/source/models/efficientnet.rst: -------------------------------------------------------------------------------- 1 | EfficientNet 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The EfficientNet model is based on the `EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate an EfficientNet model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.efficientnet.EfficientNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | efficientnet_b0 25 | efficientnet_b1 26 | efficientnet_b2 27 | efficientnet_b3 28 | efficientnet_b4 29 | efficientnet_b5 30 | efficientnet_b6 31 | efficientnet_b7 32 | -------------------------------------------------------------------------------- /docs/source/models/efficientnetv2.rst: -------------------------------------------------------------------------------- 1 | EfficientNetV2 2 | ============== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The EfficientNetV2 model is based on the `EfficientNetV2: Smaller Models and Faster Training `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate an EfficientNetV2 model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.efficientnet.EfficientNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | efficientnet_v2_s 25 | efficientnet_v2_m 26 | efficientnet_v2_l 27 | -------------------------------------------------------------------------------- /docs/source/models/faster_rcnn.rst: -------------------------------------------------------------------------------- 1 | Faster R-CNN 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | 7 | The Faster R-CNN model is based on the `Faster R-CNN: Towards Real-Time Object Detection 8 | with Region Proposal Networks `__ 9 | paper. 10 | 11 | .. betastatus:: detection module 12 | 13 | Model builders 14 | -------------- 15 | 16 | The following model builders can be used to instantiate a Faster R-CNN model, with or 17 | without pre-trained weights. All the model builders internally rely on the 18 | ``torchvision.models.detection.faster_rcnn.FasterRCNN`` base class. Please refer to the `source 19 | code 20 | `_ for 21 | more details about this class. 22 | 23 | .. autosummary:: 24 | :toctree: generated/ 25 | :template: function.rst 26 | 27 | fasterrcnn_resnet50_fpn 28 | fasterrcnn_resnet50_fpn_v2 29 | fasterrcnn_mobilenet_v3_large_fpn 30 | fasterrcnn_mobilenet_v3_large_320_fpn 31 | 32 | -------------------------------------------------------------------------------- /docs/source/models/fcn.rst: -------------------------------------------------------------------------------- 1 | FCN 2 | === 3 | 4 | .. currentmodule:: torchvision.models.segmentation 5 | 6 | The FCN model is based on the `Fully Convolutional Networks for Semantic 7 | Segmentation `__ 8 | paper. 9 | 10 | .. betastatus:: segmentation module 11 | 12 | 13 | Model builders 14 | -------------- 15 | 16 | The following model builders can be used to instantiate a FCN model, with or 17 | without pre-trained weights. All the model builders internally rely on the 18 | ``torchvision.models.segmentation.FCN`` base class. Please refer to the `source 19 | code 20 | `_ for 21 | more details about this class. 22 | 23 | .. autosummary:: 24 | :toctree: generated/ 25 | :template: function.rst 26 | 27 | fcn_resnet50 28 | fcn_resnet101 29 | -------------------------------------------------------------------------------- /docs/source/models/fcos.rst: -------------------------------------------------------------------------------- 1 | FCOS 2 | ========= 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The FCOS model is based on the `FCOS: Fully Convolutional One-Stage Object Detection 7 | `__ paper. 8 | 9 | .. betastatus:: detection module 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate a FCOS model, with or 15 | without pre-trained weights. All the model builders internally rely on the 16 | ``torchvision.models.detection.fcos.FCOS`` base class. Please refer to the `source code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | fcos_resnet50_fpn 25 | -------------------------------------------------------------------------------- /docs/source/models/googlenet.rst: -------------------------------------------------------------------------------- 1 | GoogLeNet 2 | ========= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The GoogleNet model is based on the `Going Deeper with Convolutions `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a GoogLeNet model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.googlenet.GoogLeNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | googlenet 25 | -------------------------------------------------------------------------------- /docs/source/models/googlenet_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized GoogLeNet 2 | =================== 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized GoogleNet model is based on the `Going Deeper with Convolutions `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized GoogLeNet 14 | model, with or without pre-trained weights. All the model builders internally 15 | rely on the ``torchvision.models.quantization.googlenet.QuantizableGoogLeNet`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | googlenet 25 | -------------------------------------------------------------------------------- /docs/source/models/inception.rst: -------------------------------------------------------------------------------- 1 | Inception V3 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The InceptionV3 model is based on the `Rethinking the Inception Architecture for 7 | Computer Vision `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate an InceptionV3 model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.inception.Inception3`` base class. Please refer to the `source 16 | code `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | inception_v3 24 | -------------------------------------------------------------------------------- /docs/source/models/inception_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized InceptionV3 2 | ===================== 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized Inception model is based on the `Rethinking the Inception Architecture for 7 | Computer Vision `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized Inception 14 | model, with or without pre-trained weights. All the model builders internally 15 | rely on the ``torchvision.models.quantization.inception.QuantizableInception3`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | inception_v3 25 | -------------------------------------------------------------------------------- /docs/source/models/keypoint_rcnn.rst: -------------------------------------------------------------------------------- 1 | Keypoint R-CNN 2 | ============== 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The Keypoint R-CNN model is based on the `Mask R-CNN 7 | `__ paper. 8 | 9 | .. betastatus:: detection module 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a Keypoint R-CNN model, 16 | with or without pre-trained weights. All the model builders internally rely on 17 | the ``torchvision.models.detection.KeypointRCNN`` base class. Please refer to the `source 18 | code 19 | `__ 20 | for more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | keypointrcnn_resnet50_fpn 27 | -------------------------------------------------------------------------------- /docs/source/models/lraspp.rst: -------------------------------------------------------------------------------- 1 | LRASPP 2 | ====== 3 | 4 | .. currentmodule:: torchvision.models.segmentation 5 | 6 | The LRASPP model is based on the `Searching for MobileNetV3 `_ paper. 7 | 8 | .. betastatus:: segmentation module 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a FCN model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.segmentation.LRASPP`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | lraspp_mobilenet_v3_large 25 | -------------------------------------------------------------------------------- /docs/source/models/mask_rcnn.rst: -------------------------------------------------------------------------------- 1 | Mask R-CNN 2 | ========== 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The Mask R-CNN model is based on the `Mask R-CNN `__ 7 | paper. 8 | 9 | .. betastatus:: detection module 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a Mask R-CNN model, with or 16 | without pre-trained weights. All the model builders internally rely on the 17 | ``torchvision.models.detection.mask_rcnn.MaskRCNN`` base class. Please refer to the `source 18 | code 19 | `_ for 20 | more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | maskrcnn_resnet50_fpn 27 | maskrcnn_resnet50_fpn_v2 28 | -------------------------------------------------------------------------------- /docs/source/models/maxvit.rst: -------------------------------------------------------------------------------- 1 | MaxVit 2 | =============== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The MaxVit transformer models are based on the `MaxViT: Multi-Axis Vision Transformer `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate an MaxVit model with and without pre-trained weights. 14 | All the model builders internally rely on the ``torchvision.models.maxvit.MaxVit`` 15 | base class. Please refer to the `source code 16 | `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | maxvit_t 24 | -------------------------------------------------------------------------------- /docs/source/models/mnasnet.rst: -------------------------------------------------------------------------------- 1 | MNASNet 2 | ======= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | 7 | The MNASNet model is based on the `MnasNet: Platform-Aware Neural Architecture 8 | Search for Mobile `__ paper. 9 | 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate an MNASNet model. 15 | All the model builders internally rely on the 16 | ``torchvision.models.mnasnet.MNASNet`` base class. Please refer to the `source 17 | code 18 | `_ for 19 | more details about this class. 20 | 21 | .. autosummary:: 22 | :toctree: generated/ 23 | :template: function.rst 24 | 25 | mnasnet0_5 26 | mnasnet0_75 27 | mnasnet1_0 28 | mnasnet1_3 29 | -------------------------------------------------------------------------------- /docs/source/models/mobilenetv2.rst: -------------------------------------------------------------------------------- 1 | MobileNet V2 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The MobileNet V2 model is based on the `MobileNetV2: Inverted Residuals and Linear 7 | Bottlenecks `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a MobileNetV2 model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.mobilenetv2.MobileNetV2`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | mobilenet_v2 25 | -------------------------------------------------------------------------------- /docs/source/models/mobilenetv2_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized MobileNet V2 2 | ====================== 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized MobileNet V2 model is based on the `MobileNetV2: Inverted Residuals and Linear 7 | Bottlenecks `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized MobileNetV2 14 | model, with or without pre-trained weights. All the model builders internally 15 | rely on the ``torchvision.models.quantization.mobilenetv2.QuantizableMobileNetV2`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | mobilenet_v2 25 | -------------------------------------------------------------------------------- /docs/source/models/mobilenetv3.rst: -------------------------------------------------------------------------------- 1 | MobileNet V3 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The MobileNet V3 model is based on the `Searching for MobileNetV3 `__ paper. 7 | 8 | 9 | Model builders 10 | -------------- 11 | 12 | The following model builders can be used to instantiate a MobileNetV3 model, with or 13 | without pre-trained weights. All the model builders internally rely on the 14 | ``torchvision.models.mobilenetv3.MobileNetV3`` base class. Please refer to the `source 15 | code 16 | `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | mobilenet_v3_large 24 | mobilenet_v3_small 25 | -------------------------------------------------------------------------------- /docs/source/models/mobilenetv3_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized MobileNet V3 2 | ====================== 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized MobileNet V3 model is based on the `Searching for MobileNetV3 `__ paper. 7 | 8 | 9 | Model builders 10 | -------------- 11 | 12 | The following model builders can be used to instantiate a quantized MobileNetV3 13 | model, with or without pre-trained weights. All the model builders internally 14 | rely on the ``torchvision.models.quantization.mobilenetv3.QuantizableMobileNetV3`` 15 | base class. Please refer to the `source code 16 | `_ 17 | for more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | mobilenet_v3_large 24 | -------------------------------------------------------------------------------- /docs/source/models/raft.rst: -------------------------------------------------------------------------------- 1 | RAFT 2 | ==== 3 | 4 | .. currentmodule:: torchvision.models.optical_flow 5 | 6 | The RAFT model is based on the `RAFT: Recurrent All-Pairs Field Transforms for 7 | Optical Flow `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a RAFT model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.optical_flow.RAFT`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | raft_large 25 | raft_small 26 | -------------------------------------------------------------------------------- /docs/source/models/regnet.rst: -------------------------------------------------------------------------------- 1 | RegNet 2 | ====== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The RegNet model is based on the `Designing Network Design Spaces 7 | `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a RegNet model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.regnet.RegNet`` base class. Please refer to the `source code 16 | `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | regnet_y_400mf 24 | regnet_y_800mf 25 | regnet_y_1_6gf 26 | regnet_y_3_2gf 27 | regnet_y_8gf 28 | regnet_y_16gf 29 | regnet_y_32gf 30 | regnet_y_128gf 31 | regnet_x_400mf 32 | regnet_x_800mf 33 | regnet_x_1_6gf 34 | regnet_x_3_2gf 35 | regnet_x_8gf 36 | regnet_x_16gf 37 | regnet_x_32gf 38 | -------------------------------------------------------------------------------- /docs/source/models/resnet.rst: -------------------------------------------------------------------------------- 1 | ResNet 2 | ====== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The ResNet model is based on the `Deep Residual Learning for Image Recognition 7 | `_ paper. 8 | 9 | .. note:: 10 | The bottleneck of TorchVision places the stride for downsampling to the second 3x3 11 | convolution while the original paper places it to the first 1x1 convolution. 12 | This variant improves the accuracy and is known as `ResNet V1.5 13 | `_. 14 | 15 | Model builders 16 | -------------- 17 | 18 | The following model builders can be used to instantiate a ResNet model, with or 19 | without pre-trained weights. All the model builders internally rely on the 20 | ``torchvision.models.resnet.ResNet`` base class. Please refer to the `source 21 | code 22 | `_ for 23 | more details about this class. 24 | 25 | .. autosummary:: 26 | :toctree: generated/ 27 | :template: function.rst 28 | 29 | resnet18 30 | resnet34 31 | resnet50 32 | resnet101 33 | resnet152 34 | -------------------------------------------------------------------------------- /docs/source/models/resnet_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized ResNet 2 | ================ 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized ResNet model is based on the `Deep Residual Learning for Image Recognition 7 | `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized ResNet 14 | model, with or without pre-trained weights. All the model builders internally 15 | rely on the ``torchvision.models.quantization.resnet.QuantizableResNet`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | resnet18 25 | resnet50 26 | -------------------------------------------------------------------------------- /docs/source/models/resnext.rst: -------------------------------------------------------------------------------- 1 | ResNeXt 2 | ======= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The ResNext model is based on the `Aggregated Residual Transformations for Deep Neural Networks `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a ResNext model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.resnet.ResNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | resnext50_32x4d 25 | resnext101_32x8d 26 | resnext101_64x4d 27 | -------------------------------------------------------------------------------- /docs/source/models/resnext_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized ResNeXt 2 | ================= 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The quantized ResNext model is based on the `Aggregated Residual Transformations for Deep Neural Networks `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized ResNeXt 14 | model, with or without pre-trained weights. All the model builders internally 15 | rely on the ``torchvision.models.quantization.resnet.QuantizableResNet`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | resnext101_32x8d 25 | resnext101_64x4d 26 | -------------------------------------------------------------------------------- /docs/source/models/retinanet.rst: -------------------------------------------------------------------------------- 1 | RetinaNet 2 | ========= 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The RetinaNet model is based on the `Focal Loss for Dense Object Detection 7 | `__ paper. 8 | 9 | .. betastatus:: detection module 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate a RetinaNet model, with or 15 | without pre-trained weights. All the model builders internally rely on the 16 | ``torchvision.models.detection.retinanet.RetinaNet`` base class. Please refer to the `source code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | retinanet_resnet50_fpn 25 | retinanet_resnet50_fpn_v2 26 | -------------------------------------------------------------------------------- /docs/source/models/shufflenetv2.rst: -------------------------------------------------------------------------------- 1 | ShuffleNet V2 2 | ============= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The ShuffleNet V2 model is based on the `ShuffleNet V2: Practical Guidelines for Efficient 7 | CNN Architecture Design `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a ShuffleNetV2 model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.shufflenetv2.ShuffleNetV2`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | shufflenet_v2_x0_5 25 | shufflenet_v2_x1_0 26 | shufflenet_v2_x1_5 27 | shufflenet_v2_x2_0 28 | -------------------------------------------------------------------------------- /docs/source/models/shufflenetv2_quant.rst: -------------------------------------------------------------------------------- 1 | Quantized ShuffleNet V2 2 | ======================= 3 | 4 | .. currentmodule:: torchvision.models.quantization 5 | 6 | The Quantized ShuffleNet V2 model is based on the `ShuffleNet V2: Practical Guidelines for Efficient 7 | CNN Architecture Design `__ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a quantized ShuffleNetV2 14 | model, with or without pre-trained weights. All the model builders internally rely 15 | on the ``torchvision.models.quantization.shufflenetv2.QuantizableShuffleNetV2`` 16 | base class. Please refer to the `source code 17 | `_ 18 | for more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | shufflenet_v2_x0_5 25 | shufflenet_v2_x1_0 26 | shufflenet_v2_x1_5 27 | shufflenet_v2_x2_0 28 | -------------------------------------------------------------------------------- /docs/source/models/squeezenet.rst: -------------------------------------------------------------------------------- 1 | SqueezeNet 2 | ========== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The SqueezeNet model is based on the `SqueezeNet: AlexNet-level accuracy with 7 | 50x fewer parameters and <0.5MB model size `__ 8 | paper. 9 | 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate a SqueezeNet model, with or 15 | without pre-trained weights. All the model builders internally rely on the 16 | ``torchvision.models.squeezenet.SqueezeNet`` base class. Please refer to the `source 17 | code 18 | `_ for 19 | more details about this class. 20 | 21 | .. autosummary:: 22 | :toctree: generated/ 23 | :template: function.rst 24 | 25 | squeezenet1_0 26 | squeezenet1_1 27 | -------------------------------------------------------------------------------- /docs/source/models/ssd.rst: -------------------------------------------------------------------------------- 1 | SSD 2 | === 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The SSD model is based on the `SSD: Single Shot MultiBox Detector 7 | `__ paper. 8 | 9 | .. betastatus:: detection module 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a SSD model, with or 16 | without pre-trained weights. All the model builders internally rely on the 17 | ``torchvision.models.detection.SSD`` base class. Please refer to the `source 18 | code 19 | `_ for 20 | more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | ssd300_vgg16 27 | -------------------------------------------------------------------------------- /docs/source/models/ssdlite.rst: -------------------------------------------------------------------------------- 1 | SSDlite 2 | ======= 3 | 4 | .. currentmodule:: torchvision.models.detection 5 | 6 | The SSDLite model is based on the `SSD: Single Shot MultiBox Detector 7 | `__, `Searching for MobileNetV3 8 | `__ and `MobileNetV2: Inverted Residuals and Linear 9 | Bottlenecks `__ papers. 10 | 11 | .. betastatus:: detection module 12 | 13 | Model builders 14 | -------------- 15 | 16 | The following model builders can be used to instantiate a SSD Lite model, with or 17 | without pre-trained weights. All the model builders internally rely on the 18 | ``torchvision.models.detection.ssd.SSD`` base class. Please refer to the `source 19 | code 20 | `_ for 21 | more details about this class. 22 | 23 | .. autosummary:: 24 | :toctree: generated/ 25 | :template: function.rst 26 | 27 | ssdlite320_mobilenet_v3_large 28 | -------------------------------------------------------------------------------- /docs/source/models/swin_transformer.rst: -------------------------------------------------------------------------------- 1 | SwinTransformer 2 | =============== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The SwinTransformer models are based on the `Swin Transformer: Hierarchical Vision 7 | Transformer using Shifted Windows `__ 8 | paper. 9 | SwinTransformer V2 models are based on the `Swin Transformer V2: Scaling Up Capacity 10 | and Resolution `__ 11 | paper. 12 | 13 | 14 | Model builders 15 | -------------- 16 | 17 | The following model builders can be used to instantiate an SwinTransformer model (original and V2) with and without pre-trained weights. 18 | All the model builders internally rely on the ``torchvision.models.swin_transformer.SwinTransformer`` 19 | base class. Please refer to the `source code 20 | `_ for 21 | more details about this class. 22 | 23 | .. autosummary:: 24 | :toctree: generated/ 25 | :template: function.rst 26 | 27 | swin_t 28 | swin_s 29 | swin_b 30 | swin_v2_t 31 | swin_v2_s 32 | swin_v2_b 33 | -------------------------------------------------------------------------------- /docs/source/models/vgg.rst: -------------------------------------------------------------------------------- 1 | VGG 2 | === 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The VGG model is based on the `Very Deep Convolutional Networks for Large-Scale 7 | Image Recognition `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a VGG model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.vgg.VGG`` base class. Please refer to the `source code 16 | `_ for 17 | more details about this class. 18 | 19 | .. autosummary:: 20 | :toctree: generated/ 21 | :template: function.rst 22 | 23 | vgg11 24 | vgg11_bn 25 | vgg13 26 | vgg13_bn 27 | vgg16 28 | vgg16_bn 29 | vgg19 30 | vgg19_bn 31 | -------------------------------------------------------------------------------- /docs/source/models/video_mvit.rst: -------------------------------------------------------------------------------- 1 | Video MViT 2 | ========== 3 | 4 | .. currentmodule:: torchvision.models.video 5 | 6 | The MViT model is based on the 7 | `MViTv2: Improved Multiscale Vision Transformers for Classification and Detection 8 | `__ and `Multiscale Vision Transformers 9 | `__ papers. 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a MViT v1 or v2 model, with or 16 | without pre-trained weights. All the model builders internally rely on the 17 | ``torchvision.models.video.MViT`` base class. Please refer to the `source 18 | code 19 | `_ for 20 | more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | mvit_v1_b 27 | mvit_v2_s 28 | -------------------------------------------------------------------------------- /docs/source/models/video_resnet.rst: -------------------------------------------------------------------------------- 1 | Video ResNet 2 | ============ 3 | 4 | .. currentmodule:: torchvision.models.video 5 | 6 | The VideoResNet model is based on the `A Closer Look at Spatiotemporal 7 | Convolutions for Action Recognition `__ paper. 8 | 9 | .. betastatus:: video module 10 | 11 | 12 | Model builders 13 | -------------- 14 | 15 | The following model builders can be used to instantiate a VideoResNet model, with or 16 | without pre-trained weights. All the model builders internally rely on the 17 | ``torchvision.models.video.resnet.VideoResNet`` base class. Please refer to the `source 18 | code 19 | `_ for 20 | more details about this class. 21 | 22 | .. autosummary:: 23 | :toctree: generated/ 24 | :template: function.rst 25 | 26 | r3d_18 27 | mc3_18 28 | r2plus1d_18 29 | -------------------------------------------------------------------------------- /docs/source/models/video_s3d.rst: -------------------------------------------------------------------------------- 1 | Video S3D 2 | ========= 3 | 4 | .. currentmodule:: torchvision.models.video 5 | 6 | The S3D model is based on the 7 | `Rethinking Spatiotemporal Feature Learning: Speed-Accuracy Trade-offs in Video Classification 8 | `__ paper. 9 | 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate an S3D model, with or 15 | without pre-trained weights. All the model builders internally rely on the 16 | ``torchvision.models.video.S3D`` base class. Please refer to the `source 17 | code 18 | `_ for 19 | more details about this class. 20 | 21 | .. autosummary:: 22 | :toctree: generated/ 23 | :template: function.rst 24 | 25 | s3d 26 | -------------------------------------------------------------------------------- /docs/source/models/video_swin_transformer.rst: -------------------------------------------------------------------------------- 1 | Video SwinTransformer 2 | ===================== 3 | 4 | .. currentmodule:: torchvision.models.video 5 | 6 | The Video SwinTransformer model is based on the `Video Swin Transformer `__ paper. 7 | 8 | .. betastatus:: video module 9 | 10 | 11 | Model builders 12 | -------------- 13 | 14 | The following model builders can be used to instantiate a VideoResNet model, with or 15 | without pre-trained weights. All the model builders internally rely on the 16 | ``torchvision.models.video.swin_transformer.SwinTransformer3d`` base class. Please refer to the `source 17 | code 18 | `_ for 19 | more details about this class. 20 | 21 | .. autosummary:: 22 | :toctree: generated/ 23 | :template: function.rst 24 | 25 | swin3d_t 26 | swin3d_s 27 | swin3d_b 28 | -------------------------------------------------------------------------------- /docs/source/models/vision_transformer.rst: -------------------------------------------------------------------------------- 1 | VisionTransformer 2 | ================= 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The VisionTransformer model is based on the `An Image is Worth 16x16 Words: 7 | Transformers for Image Recognition at Scale `_ paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a VisionTransformer model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.vision_transformer.VisionTransformer`` base class. 16 | Please refer to the `source code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | vit_b_16 25 | vit_b_32 26 | vit_l_16 27 | vit_l_32 28 | vit_h_14 29 | -------------------------------------------------------------------------------- /docs/source/models/wide_resnet.rst: -------------------------------------------------------------------------------- 1 | Wide ResNet 2 | =========== 3 | 4 | .. currentmodule:: torchvision.models 5 | 6 | The Wide ResNet model is based on the `Wide Residual Networks `__ 7 | paper. 8 | 9 | 10 | Model builders 11 | -------------- 12 | 13 | The following model builders can be used to instantiate a Wide ResNet model, with or 14 | without pre-trained weights. All the model builders internally rely on the 15 | ``torchvision.models.resnet.ResNet`` base class. Please refer to the `source 16 | code 17 | `_ for 18 | more details about this class. 19 | 20 | .. autosummary:: 21 | :toctree: generated/ 22 | :template: function.rst 23 | 24 | wide_resnet50_2 25 | wide_resnet101_2 26 | -------------------------------------------------------------------------------- /docs/source/tv_tensors.rst: -------------------------------------------------------------------------------- 1 | .. _tv_tensors: 2 | 3 | TVTensors 4 | ========== 5 | 6 | .. currentmodule:: torchvision.tv_tensors 7 | 8 | TVTensors are :class:`torch.Tensor` subclasses which the v2 :ref:`transforms 9 | ` use under the hood to dispatch their inputs to the appropriate 10 | lower-level kernels. Most users do not need to manipulate TVTensors directly. 11 | 12 | Refer to 13 | :ref:`sphx_glr_auto_examples_transforms_plot_transforms_getting_started.py` for 14 | an introduction to TVTensors, or 15 | :ref:`sphx_glr_auto_examples_transforms_plot_tv_tensors.py` for more advanced 16 | info. 17 | 18 | .. autosummary:: 19 | :toctree: generated/ 20 | :template: class.rst 21 | 22 | Image 23 | Video 24 | KeyPoints 25 | BoundingBoxFormat 26 | BoundingBoxes 27 | Mask 28 | TVTensor 29 | set_return_type 30 | wrap 31 | -------------------------------------------------------------------------------- /docs/source/utils.rst: -------------------------------------------------------------------------------- 1 | .. _utils: 2 | 3 | Utils 4 | ===== 5 | 6 | The ``torchvision.utils`` module contains various utilities, mostly :ref:`for 7 | visualization `. 8 | 9 | .. currentmodule:: torchvision.utils 10 | 11 | .. autosummary:: 12 | :toctree: generated/ 13 | :template: function.rst 14 | 15 | draw_bounding_boxes 16 | draw_segmentation_masks 17 | draw_keypoints 18 | flow_to_image 19 | make_grid 20 | save_image 21 | -------------------------------------------------------------------------------- /examples/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(run_model) 3 | 4 | option(USE_TORCHVISION "Whether to link to torchvision" OFF) 5 | 6 | find_package(Torch REQUIRED) 7 | if(USE_TORCHVISION) 8 | find_package(TorchVision REQUIRED) 9 | endif() 10 | 11 | add_executable(run_model run_model.cpp) 12 | 13 | target_link_libraries(run_model "${TORCH_LIBRARIES}") 14 | if(USE_TORCHVISION) 15 | target_link_libraries(run_model TorchVision::TorchVision) 16 | endif() 17 | 18 | set_property(TARGET run_model PROPERTY CXX_STANDARD 17) 19 | -------------------------------------------------------------------------------- /examples/cpp/script_model.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from torchvision import models 3 | 4 | for model, name in ( 5 | (models.resnet18(weights=None), "resnet18"), 6 | (models.detection.fasterrcnn_resnet50_fpn(weights=None, weights_backbone=None), "fasterrcnn_resnet50_fpn"), 7 | ): 8 | model.eval() 9 | traced_model = torch.jit.script(model) 10 | traced_model.save(f"{name}.pt") 11 | -------------------------------------------------------------------------------- /examples/python/README.md: -------------------------------------------------------------------------------- 1 | # Python examples 2 | 3 | The examples in this directory have been moved online in our [gallery 4 | page](https://pytorch.org/vision/stable/auto_examples/index.html). 5 | -------------------------------------------------------------------------------- /gallery/README.rst: -------------------------------------------------------------------------------- 1 | .. _gallery: 2 | 3 | Examples and tutorials 4 | ====================== 5 | -------------------------------------------------------------------------------- /gallery/assets/FudanPed00054.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/FudanPed00054.png -------------------------------------------------------------------------------- /gallery/assets/FudanPed00054_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/FudanPed00054_mask.png -------------------------------------------------------------------------------- /gallery/assets/astronaut.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/astronaut.jpg -------------------------------------------------------------------------------- /gallery/assets/basketball.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/basketball.mp4 -------------------------------------------------------------------------------- /gallery/assets/coco/images/000000000001.jpg: -------------------------------------------------------------------------------- 1 | ../../astronaut.jpg -------------------------------------------------------------------------------- /gallery/assets/coco/images/000000000002.jpg: -------------------------------------------------------------------------------- 1 | ../../dog2.jpg -------------------------------------------------------------------------------- /gallery/assets/dog1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/dog1.jpg -------------------------------------------------------------------------------- /gallery/assets/dog2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/dog2.jpg -------------------------------------------------------------------------------- /gallery/assets/leaning_tower.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/leaning_tower.jpg -------------------------------------------------------------------------------- /gallery/assets/person1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/person1.jpg -------------------------------------------------------------------------------- /gallery/assets/pottery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/pottery.jpg -------------------------------------------------------------------------------- /gallery/assets/repurposing_annotations_thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/repurposing_annotations_thumbnail.png -------------------------------------------------------------------------------- /gallery/assets/transforms_thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/transforms_thumbnail.png -------------------------------------------------------------------------------- /gallery/assets/visualization_utils_thumbnail2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/gallery/assets/visualization_utils_thumbnail2.png -------------------------------------------------------------------------------- /gallery/others/README.rst: -------------------------------------------------------------------------------- 1 | Others 2 | ------ 3 | -------------------------------------------------------------------------------- /gallery/transforms/README.rst: -------------------------------------------------------------------------------- 1 | .. _transforms_gallery: 2 | 3 | Transforms 4 | ---------- 5 | -------------------------------------------------------------------------------- /ios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | set(TARGET torchvision_ops) 3 | project(${TARGET} CXX) 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(LIBTORCH_HEADER_ROOT ${LIBTORCH_HEADER_ROOT}) 6 | set(LIBRARY_OUTPUT_PATH ../lib) 7 | 8 | file(GLOB VISION_SRCS 9 | ../torchvision/csrc/ops/cpu/*.h 10 | ../torchvision/csrc/ops/cpu/*.cpp 11 | ../torchvision/csrc/ops/*.h 12 | ../torchvision/csrc/ops/*.cpp) 13 | 14 | add_library(${TARGET} STATIC 15 | ${VISION_SRCS} 16 | ) 17 | 18 | file(GLOB PYTORCH_HEADERS "${LIBTORCH_HEADER_ROOT}") 19 | file(GLOB PYTORCH_HEADERS_CSRC "${LIBTORCH_HEADER_ROOT}/torch/csrc/api/include") 20 | target_include_directories(${TARGET} PRIVATE 21 | ${PYTORCH_HEADERS} 22 | ${PYTORCH_HEADERS_CSRC} 23 | ) 24 | -------------------------------------------------------------------------------- /ios/LibTorchvision.podspec: -------------------------------------------------------------------------------- 1 | pytorch_version = '2.0.0' 2 | 3 | Pod::Spec.new do |s| 4 | s.name = 'LibTorchvision' 5 | s.version = '0.15.1' 6 | s.authors = 'PyTorch Team' 7 | s.license = { :type => 'BSD' } 8 | s.homepage = 'https://github.com/pytorch/vision' 9 | s.source = { :http => "https://ossci-ios.s3.amazonaws.com/libtorchvision_ops_ios_#{s.version}.zip" } 10 | s.summary = '"The C++ library of TorchVision ops for iOS' 11 | s.description = <<-DESC 12 | The C++ library of TorchVision ops for iOS. 13 | This version (#{s.version}) requires the installation of LibTorch #{pytorch_version} or LibTorch-Lite #{pytorch_version}. 14 | DESC 15 | s.ios.deployment_target = '12.0' 16 | s.vendored_libraries = 'install/lib/*.a' 17 | s.user_target_xcconfig = { 18 | 'VALID_ARCHS' => 'x86_64 arm64', 19 | 'OTHER_LDFLAGS' => '$(inherited) -force_load "$(PODS_ROOT)/LibTorchvision/install/lib/libtorchvision_ops.a"', 20 | 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', 21 | 'CLANG_CXX_LIBRARY' => 'libc++' 22 | } 23 | s.library = ['c++', 'stdc++'] 24 | end 25 | -------------------------------------------------------------------------------- /ios/README.md: -------------------------------------------------------------------------------- 1 | ## Status 2 | 3 | The iOS demo of TorchVision is currently unmaintained, untested and likely out-of-date. 4 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property(strong, nonatomic) UIWindow* window; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/ModelRunner.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface ModelRunner : NSObject 7 | 8 | + (NSString*)run; 9 | + (BOOL)setUp; 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface ViewController : UIViewController 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/ViewController.mm: -------------------------------------------------------------------------------- 1 | 2 | #import "ViewController.h" 3 | #include 4 | #import "ModelRunner.h" 5 | 6 | @interface ViewController () 7 | @property (weak, nonatomic) IBOutlet UITextView *textView; 8 | @end 9 | 10 | static NSString const *config_error_msg = @"Wrong model configurations... Please fix and click \"Redo\""; 11 | 12 | @implementation ViewController 13 | 14 | - (void)viewDidLoad { 15 | [super viewDidLoad]; 16 | if ([ModelRunner setUp]) { 17 | [self testModel]; 18 | } else { 19 | self.textView.text = [config_error_msg copy]; 20 | } 21 | } 22 | 23 | 24 | - (IBAction)rerun:(id)sender { 25 | self.textView.text = @""; 26 | if (![ModelRunner setUp]) { 27 | self.textView.text = [config_error_msg copy]; 28 | return; 29 | } 30 | dispatch_async(dispatch_get_main_queue(), ^{ 31 | [self testModel]; 32 | }); 33 | } 34 | 35 | - (void)testModel { 36 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 37 | NSString *text = [ModelRunner run]; 38 | dispatch_async(dispatch_get_main_queue(), ^{ 39 | self.textView.text = [self.textView.text stringByAppendingString:text]; 40 | }); 41 | }); 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ios/VisionTestApp/VisionTestApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // VisionTestApp 4 | // 5 | // Created by Yuchen Huang on 3/31/21. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | 11 | int main(int argc, char * argv[]) { 12 | NSString * appDelegateClassName; 13 | @autoreleasepool { 14 | // Setup code that might create autoreleased objects goes here. 15 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 16 | } 17 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 18 | } 19 | -------------------------------------------------------------------------------- /ios/VisionTestApp/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex -o pipefail 3 | 4 | TEST_APP_PATH=$(dirname $(realpath $0)) 5 | cd ${TEST_APP_PATH} 6 | 7 | rm -rf ./install 8 | rm ./VisionTestApp/*.pt 9 | -------------------------------------------------------------------------------- /ios/VisionTestApp/make_assets.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from torch.utils.mobile_optimizer import optimize_for_mobile 3 | from torchvision.models.detection import ( 4 | fasterrcnn_mobilenet_v3_large_320_fpn, 5 | FasterRCNN_MobileNet_V3_Large_320_FPN_Weights, 6 | ) 7 | 8 | print(torch.__version__) 9 | 10 | model = fasterrcnn_mobilenet_v3_large_320_fpn( 11 | weights=FasterRCNN_MobileNet_V3_Large_320_FPN_Weights.DEFAULT, 12 | box_score_thresh=0.7, 13 | rpn_post_nms_top_n_test=100, 14 | rpn_score_thresh=0.4, 15 | rpn_pre_nms_top_n_test=150, 16 | ) 17 | 18 | model.eval() 19 | script_model = torch.jit.script(model) 20 | opt_script_model = optimize_for_mobile(script_model) 21 | opt_script_model.save("VisionTestApp/frcnn_mnetv3.pt") 22 | -------------------------------------------------------------------------------- /ios/VisionTestApp/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex -o pipefail 3 | 4 | echo "" 5 | echo "DIR: $(pwd)" 6 | 7 | TEST_APP_PATH=$(dirname $(realpath $0)) 8 | cd ${TEST_APP_PATH} 9 | 10 | PYTORCH_IOS_NIGHTLY_NAME=libtorch_ios_nightly_build.zip 11 | VISION_IOS_NIGHTLY_NAME=libtorchvision_ops_ios_nightly_build.zip 12 | 13 | echo "Downloading torch libs and vision libs..." 14 | wget https://ossci-ios-build.s3.amazonaws.com/${PYTORCH_IOS_NIGHTLY_NAME} 15 | wget https://ossci-ios-build.s3.amazonaws.com/${VISION_IOS_NIGHTLY_NAME} 16 | 17 | mkdir -p ./library/torch 18 | mkdir -p ./library/vision 19 | 20 | echo "Unziping torch libs and vision libs..." 21 | unzip -d ./library/torch ./${PYTORCH_IOS_NIGHTLY_NAME} 22 | unzip -d ./library/vision ./${VISION_IOS_NIGHTLY_NAME} 23 | 24 | cp ./library/vision/install/lib/*.a ./library/torch/install/lib 25 | cp -r ./library/torch/install . 26 | 27 | rm -rf ./library 28 | rm -rf ./*.zip 29 | 30 | echo "Generating the vision model..." 31 | python ./make_assets.py 32 | 33 | echo "Finished project setups." 34 | -------------------------------------------------------------------------------- /ios/build_ios.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex -o pipefail 4 | echo "" 5 | echo "DIR: $(pwd)" 6 | VISION_IOS_ROOT=$(dirname $(realpath $0)) 7 | 8 | if ! [ -n "${LIBTORCH_HEADER_ROOT:-}" ]; then 9 | echo "Missing parameter: LIBTORCH_HEADER_ROOT" 10 | exit 1 11 | fi 12 | 13 | if [ -n "${IOS_ARCH:-}" ]; then 14 | if [ "${IOS_ARCH:-}" == "arm64" ]; then 15 | IOS_PLATFORM="OS" 16 | elif [ "${IOS_ARCH:-}" == "x86_64" ]; then 17 | IOS_PLATFORM="SIMULATOR" 18 | fi 19 | fi 20 | 21 | mkdir -p ${VISION_IOS_ROOT}/lib 22 | mkdir -p ${VISION_IOS_ROOT}/build 23 | cd ${VISION_IOS_ROOT}/build 24 | cmake -DLIBTORCH_HEADER_ROOT=${LIBTORCH_HEADER_ROOT} \ 25 | -DCMAKE_TOOLCHAIN_FILE=${VISION_IOS_ROOT}/../cmake/iOS.cmake \ 26 | -DIOS_ARCH=${IOS_ARCH} \ 27 | -DIOS_PLATFORM=${IOS_PLATFORM} \ 28 | .. 29 | make 30 | rm -rf ${VISION_IOS_ROOT}/build 31 | -------------------------------------------------------------------------------- /packaging/cut_release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Usage (run from root of project): 4 | # TEST_INFRA_BRANCH=release/2.1 RELEASE_BRANCH=release/2.1 RELEASE_VERSION=2.1.0 packaging/cut_release.sh 5 | # 6 | # TEST_INFRA_BRANCH: The release branch of test-infra that houses all reusable 7 | # workflows 8 | # 9 | # RELEASE_BRANCH: The name of the release branch for this repo 10 | # 11 | # RELEASE_VERSION: Version of this current release 12 | 13 | set -eou pipefail 14 | 15 | # Create and Check out to Release Branch 16 | git checkout -b "${RELEASE_BRANCH}" 17 | 18 | # Change all GitHub Actions to reference the test-infra release branch 19 | # as opposed to main. 20 | for i in .github/workflows/*.yml; do 21 | if [[ "$OSTYPE" == "darwin"* ]]; then 22 | sed -i '' -e s#@main#@"${TEST_INFRA_BRANCH}"# $i; 23 | sed -i '' -e s#test-infra-ref:[[:space:]]main#"test-infra-ref: ${TEST_INFRA_BRANCH}"# $i; 24 | else 25 | sed -i -e s#@main#@"${TEST_INFRA_BRANCH}"# $i; 26 | sed -i -e s#test-infra-ref:[[:space:]]main#"test-infra-ref: ${TEST_INFRA_BRANCH}"# $i; 27 | fi 28 | done 29 | 30 | # Update the Release Version in version.txt 31 | echo "${RELEASE_VERSION}" >version.txt 32 | 33 | # Optional 34 | # git add ./github/workflows/*.yml version.txt 35 | # git commit -m "[RELEASE-ONLY CHANGES] Branch Cut for Release {RELEASE_VERSION}" 36 | # git push origin "${RELEASE_BRANCH}" 37 | -------------------------------------------------------------------------------- /packaging/post_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euxo pipefail 3 | 4 | if [ -n "${CUDA_HOME:-}" ]; then 5 | LD_LIBRARY_PATH="/usr/local/lib:${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}" 6 | fi 7 | 8 | python packaging/wheel/relocate.py 9 | 10 | if [[ "$(uname)" == "Linux" && "$(uname -m)" != "aarch64" ]]; then 11 | extra_decoders_channel="--pre --index-url https://download.pytorch.org/whl/nightly/cpu" 12 | else 13 | extra_decoders_channel="" 14 | fi 15 | 16 | pip install torchvision-extra-decoders $extra_decoders_channel 17 | -------------------------------------------------------------------------------- /packaging/pre_build_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$(uname)" == Darwin ]]; then 4 | # Uninstall Conflicting jpeg brew formulae 5 | jpeg_packages=$(brew list | grep jpeg) 6 | echo "Existing Jpeg-related Brew libraries" 7 | echo $jpeg_packages 8 | for pkg in $jpeg_packages; do 9 | brew uninstall --ignore-dependencies --force $pkg || true 10 | done 11 | 12 | conda install -y wget 13 | fi 14 | 15 | if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then 16 | conda install libpng libwebp -y 17 | # Installing webp also installs a non-turbo jpeg, so we uninstall jpeg stuff 18 | # before re-installing them 19 | conda uninstall libjpeg-turbo libjpeg -y 20 | conda install -y libjpeg-turbo -c pytorch 21 | 22 | # Copy binaries to be included in the wheel distribution 23 | if [[ "$OSTYPE" == "msys" ]]; then 24 | python_exec="$(which python)" 25 | bin_path=$(dirname $python_exec) 26 | cp "$bin_path/Library/bin/libjpeg.dll" torchvision 27 | fi 28 | else 29 | 30 | if [[ "$ARCH" == "aarch64" ]]; then 31 | conda install libpng -y 32 | conda install -y libjpeg-turbo -c pytorch-nightly 33 | fi 34 | 35 | conda install libwebp -y 36 | conda install libjpeg-turbo -c pytorch 37 | yum install -y freetype gnutls 38 | pip install "auditwheel<6.3.0" 39 | fi 40 | 41 | pip install numpy pyyaml future ninja 42 | pip install --upgrade setuptools==72.1.0 43 | -------------------------------------------------------------------------------- /packaging/windows/internal/build_cmake.bat: -------------------------------------------------------------------------------- 1 | @echo on 2 | msbuild "-p:Configuration=Release" "-p:BuildInParallel=true" "-p:MultiProcessorCompilation=true" "-p:CL_MPCount=%1" torchvision.vcxproj -maxcpucount:%1 3 | msbuild "-p:Configuration=Release" "-p:BuildInParallel=true" "-p:MultiProcessorCompilation=true" "-p:CL_MPCount=%1" INSTALL.vcxproj -maxcpucount:%1 4 | -------------------------------------------------------------------------------- /packaging/windows/internal/build_cpp_example.bat: -------------------------------------------------------------------------------- 1 | @echo on 2 | set CL=/I"C:\Program Files (x86)\torchvision\include" 3 | msbuild "-p:Configuration=Release" "-p:BuildInParallel=true" "-p:MultiProcessorCompilation=true" "-p:CL_MPCount=%1" run_model.vcxproj -maxcpucount:%1 4 | -------------------------------------------------------------------------------- /packaging/windows/internal/vc_env_helper.bat: -------------------------------------------------------------------------------- 1 | @echo on 2 | 3 | set VC_VERSION_LOWER=17 4 | set VC_VERSION_UPPER=18 5 | 6 | for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( 7 | if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( 8 | set "VS15INSTALLDIR=%%i" 9 | set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" 10 | goto vswhere 11 | ) 12 | ) 13 | 14 | :vswhere 15 | if "%VSDEVCMD_ARGS%" == "" ( 16 | call "%VS15VCVARSALL%" x64 || exit /b 1 17 | ) else ( 18 | call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1 19 | ) 20 | 21 | @echo on 22 | 23 | if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" 24 | 25 | set DISTUTILS_USE_SDK=1 26 | 27 | set args=%1 28 | shift 29 | :start 30 | if [%1] == [] goto done 31 | set args=%args% %1 32 | shift 33 | goto start 34 | 35 | :done 36 | if "%args%" == "" ( 37 | echo Usage: vc_env_helper.bat [command] [args] 38 | echo e.g. vc_env_helper.bat cl /c test.cpp 39 | ) 40 | 41 | %args% || exit /b 1 42 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.usort] 2 | 3 | first_party_detection = false 4 | 5 | [tool.black] 6 | 7 | line-length = 120 8 | target-version = ["py38"] 9 | 10 | [tool.ufmt] 11 | 12 | excludes = [ 13 | "gallery", 14 | ] 15 | 16 | [build-system] 17 | 18 | requires = ["setuptools", "torch", "wheel"] 19 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = 3 | # show tests that (f)ailed, (E)rror, or (X)passed in the summary 4 | -rfEX 5 | # Make tracebacks shorter 6 | --tb=short 7 | # enable all warnings 8 | -Wd 9 | --ignore=test/test_datasets_download.py 10 | --ignore-glob=test/test_prototype_*.py 11 | testpaths = 12 | test 13 | xfail_strict = True 14 | -------------------------------------------------------------------------------- /references/depth/stereo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/references/depth/stereo/__init__.py -------------------------------------------------------------------------------- /references/depth/stereo/assets/Loss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/references/depth/stereo/assets/Loss.jpg -------------------------------------------------------------------------------- /references/depth/stereo/assets/disparity-background-mode-collapse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/references/depth/stereo/assets/disparity-background-mode-collapse.jpg -------------------------------------------------------------------------------- /references/depth/stereo/assets/disparity-domain-drift.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/references/depth/stereo/assets/disparity-domain-drift.jpg -------------------------------------------------------------------------------- /references/depth/stereo/assets/gradient-norm-removal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/references/depth/stereo/assets/gradient-norm-removal.jpg -------------------------------------------------------------------------------- /references/depth/stereo/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .losses import * 2 | from .metrics import * 3 | from .distributed import * 4 | from .logger import * 5 | from .padder import * 6 | from .norm import * 7 | -------------------------------------------------------------------------------- /references/depth/stereo/utils/norm.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | def freeze_batch_norm(model): 5 | for m in model.modules(): 6 | if isinstance(m, torch.nn.BatchNorm2d): 7 | m.eval() 8 | 9 | 10 | def unfreeze_batch_norm(model): 11 | for m in model.modules(): 12 | if isinstance(m, torch.nn.BatchNorm2d): 13 | m.train() 14 | -------------------------------------------------------------------------------- /references/depth/stereo/utils/padder.py: -------------------------------------------------------------------------------- 1 | import torch.nn.functional as F 2 | 3 | 4 | class InputPadder: 5 | """Pads images such that dimensions are divisible by 8""" 6 | 7 | # TODO: Ideally, this should be part of the eval transforms preset, instead 8 | # of being part of the validation code. It's not obvious what a good 9 | # solution would be, because we need to unpad the predicted flows according 10 | # to the input images' size, and in some datasets (Kitti) images can have 11 | # variable sizes. 12 | 13 | def __init__(self, dims, mode="sintel"): 14 | self.ht, self.wd = dims[-2:] 15 | pad_ht = (((self.ht // 8) + 1) * 8 - self.ht) % 8 16 | pad_wd = (((self.wd // 8) + 1) * 8 - self.wd) % 8 17 | if mode == "sintel": 18 | self._pad = [pad_wd // 2, pad_wd - pad_wd // 2, pad_ht // 2, pad_ht - pad_ht // 2] 19 | else: 20 | self._pad = [pad_wd // 2, pad_wd - pad_wd // 2, 0, pad_ht] 21 | 22 | def pad(self, *inputs): 23 | return [F.pad(x, self._pad, mode="replicate") for x in inputs] 24 | 25 | def unpad(self, x): 26 | ht, wd = x.shape[-2:] 27 | c = [self._pad[2], ht - self._pad[3], self._pad[0], wd - self._pad[1]] 28 | return x[..., c[0] : c[1], c[2] : c[3]] 29 | -------------------------------------------------------------------------------- /references/similarity/model.py: -------------------------------------------------------------------------------- 1 | import torch.nn as nn 2 | import torchvision.models as models 3 | 4 | 5 | class EmbeddingNet(nn.Module): 6 | def __init__(self, backbone=None): 7 | super().__init__() 8 | if backbone is None: 9 | backbone = models.resnet50(num_classes=128) 10 | 11 | self.backbone = backbone 12 | 13 | def forward(self, x): 14 | x = self.backbone(x) 15 | x = nn.functional.normalize(x, dim=1) 16 | return x 17 | -------------------------------------------------------------------------------- /references/video_classification/datasets.py: -------------------------------------------------------------------------------- 1 | from typing import Tuple 2 | 3 | import torchvision 4 | from torch import Tensor 5 | 6 | 7 | class KineticsWithVideoId(torchvision.datasets.Kinetics): 8 | def __getitem__(self, idx: int) -> Tuple[Tensor, Tensor, int]: 9 | video, audio, info, video_idx = self.video_clips.get_clip(idx) 10 | label = self.samples[video_idx][1] 11 | 12 | if self.transform is not None: 13 | video = self.transform(video) 14 | 15 | return video, audio, label, video_idx 16 | -------------------------------------------------------------------------------- /references/video_classification/transforms.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | 4 | 5 | class ConvertBCHWtoCBHW(nn.Module): 6 | """Convert tensor from (B, C, H, W) to (C, B, H, W)""" 7 | 8 | def forward(self, vid: torch.Tensor) -> torch.Tensor: 9 | return vid.permute(1, 0, 2, 3) 10 | -------------------------------------------------------------------------------- /release/README.md: -------------------------------------------------------------------------------- 1 | # Vision Release Scripts 2 | 3 | This folder contains script(s) used for releasing new versions of the Vision package 4 | -------------------------------------------------------------------------------- /scripts/README.rst: -------------------------------------------------------------------------------- 1 | Utility scripts 2 | =============== 3 | 4 | * `fbcode_to_main_sync.sh` 5 | 6 | This shell script is used to synchronise internal changes with the main repository. 7 | 8 | To run this script: 9 | 10 | .. code:: bash 11 | 12 | chmod +x fbcode_to_main_sync.sh 13 | ./fbcode_to_main_sync.sh 14 | 15 | where 16 | 17 | ``commit_hash`` represents the commit hash in fbsync branch from where we should start the sync. 18 | 19 | ``fork_name`` is the name of the remote corresponding to your fork, you can check it by doing `"git remote -v"`. 20 | 21 | ``fork_main_branch`` (optional) is the name of the main branch on your fork(default="main"). 22 | 23 | This script will create PRs corresponding to the commits in fbsync. Please review these, add the [FBcode->GH] prefix on the title and publish them. Most importantly, add the [FBcode->GH] prefix at the beginning of the merge message as well. 24 | -------------------------------------------------------------------------------- /scripts/collect_model_urls.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | import re 3 | import sys 4 | 5 | MODEL_URL_PATTERN = re.compile(r"https://download[.]pytorch[.]org/models/.+?[.]pth") 6 | 7 | 8 | def main(*roots): 9 | model_urls = set() 10 | for root in roots: 11 | for path in pathlib.Path(root).rglob("*.py"): 12 | with open(path, "r") as file: 13 | for line in file: 14 | model_urls.update(MODEL_URL_PATTERN.findall(line)) 15 | 16 | print("\n".join(sorted(model_urls))) 17 | 18 | 19 | if __name__ == "__main__": 20 | main(*sys.argv[1:]) 21 | -------------------------------------------------------------------------------- /scripts/fbcode_to_main_sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z $1 ] 4 | then 5 | echo "Commit hash is required to be passed when running this script." 6 | echo "./fbcode_to_main_sync.sh " 7 | exit 1 8 | fi 9 | commit_hash=$1 10 | 11 | if [ -z $2 ] 12 | then 13 | echo "Fork name is required to be passed when running this script." 14 | echo "./fbcode_to_main_sync.sh " 15 | exit 1 16 | fi 17 | fork_name=$2 18 | 19 | if [ -z $3 ] 20 | then 21 | fork_main_branch="main" 22 | else 23 | fork_main_branch=$3 24 | fi 25 | 26 | from_branch="fbsync" 27 | git stash 28 | git checkout $from_branch 29 | git pull 30 | # Add random prefix in the new branch name to keep it unique per run 31 | prefix=$RANDOM 32 | IFS=' 33 | ' 34 | for line in $(git log --pretty=oneline "$commit_hash"..HEAD) 35 | do 36 | if [[ $line != *\[fbsync\]* ]] 37 | then 38 | echo "Parsing $line" 39 | hash=$(echo $line | cut -f1 -d' ') 40 | git checkout $fork_main_branch 41 | git checkout -B cherrypick_${prefix}_${hash} 42 | git cherry-pick -x "$hash" 43 | git push $fork_name cherrypick_${prefix}_${hash} 44 | git checkout $from_branch 45 | fi 46 | done 47 | echo "Please review the PRs, add [FBCode->GH] prefix in the title and publish them." 48 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | [metadata] 5 | license_files = LICENSE 6 | 7 | [pep8] 8 | max-line-length = 120 9 | 10 | [flake8] 11 | # note: we ignore all 501s (line too long) anyway as they're taken care of by black 12 | max-line-length = 120 13 | ignore = E203, E402, W503, W504, F821, E501, B, C4, EXE 14 | per-file-ignores = 15 | __init__.py: F401, F403, F405 16 | ./hubconf.py: F401 17 | torchvision/models/mobilenet.py: F401, F403 18 | torchvision/models/quantization/mobilenet.py: F401, F403 19 | test/smoke_test.py: F401 20 | exclude = venv 21 | 22 | [pydocstyle] 23 | select = D417 # Missing argument descriptions in the docstring 24 | -------------------------------------------------------------------------------- /test/_utils_internal.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | # Get relative file path 5 | # this returns relative path from current file. 6 | def get_relative_path(curr_file, *path_components): 7 | return os.path.join(os.path.dirname(curr_file), *path_components) 8 | -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/TensorFlow-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 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 | -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/bad_huffman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_jpeg/bad_huffman.jpg -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/corrupt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_jpeg/corrupt.jpg -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/corrupt34_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_jpeg/corrupt34_2.jpg -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/corrupt34_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_jpeg/corrupt34_3.jpg -------------------------------------------------------------------------------- /test/assets/damaged_jpeg/corrupt34_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_jpeg/corrupt34_4.jpg -------------------------------------------------------------------------------- /test/assets/damaged_png/sigsegv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/damaged_png/sigsegv.png -------------------------------------------------------------------------------- /test/assets/encode_jpeg/grace_hopper_517x606.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/encode_jpeg/grace_hopper_517x606.jpg -------------------------------------------------------------------------------- /test/assets/encode_jpeg/jpeg_write/grace_hopper_517x606_pil.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/encode_jpeg/jpeg_write/grace_hopper_517x606_pil.jpg -------------------------------------------------------------------------------- /test/assets/expected_flow.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/expected_flow.pt -------------------------------------------------------------------------------- /test/assets/fakedata/draw_boxes_different_label_background_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_boxes_different_label_background_colors.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_boxes_different_label_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_boxes_different_label_colors.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_boxes_different_label_fill_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_boxes_different_label_fill_colors.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_boxes_util.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_boxes_util.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_boxes_vanilla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_boxes_vanilla.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_keypoint_vanilla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_keypoint_vanilla.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_keypoints_visibility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_keypoints_visibility.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_rotated_boxes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_rotated_boxes.png -------------------------------------------------------------------------------- /test/assets/fakedata/draw_rotated_boxes_fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/draw_rotated_boxes_fill.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/a/a1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/a/a1.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/a/a2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/a/a2.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/a/a3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/a/a3.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/b/b1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/b/b1.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/b/b2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/b/b2.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/b/b3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/b/b3.png -------------------------------------------------------------------------------- /test/assets/fakedata/imagefolder/b/b4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/imagefolder/b/b4.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/cmyk_pytorch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/cmyk_pytorch.jpg -------------------------------------------------------------------------------- /test/assets/fakedata/logos/gray_pytorch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/gray_pytorch.jpg -------------------------------------------------------------------------------- /test/assets/fakedata/logos/gray_pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/gray_pytorch.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/grayalpha_pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/grayalpha_pytorch.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/palette_pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/palette_pytorch.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch.avif -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch.jpg -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch.webp -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch16.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgb_pytorch_incorrectly_encoded_but_who_cares.heic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgb_pytorch_incorrectly_encoded_but_who_cares.heic -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgbalpha_pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgbalpha_pytorch.png -------------------------------------------------------------------------------- /test/assets/fakedata/logos/rgbalpha_pytorch16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/fakedata/logos/rgbalpha_pytorch16.png -------------------------------------------------------------------------------- /test/assets/gaussian_blur_opencv_results.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/gaussian_blur_opencv_results.pt -------------------------------------------------------------------------------- /test/assets/interlaced_png/wizard_low-interlaced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/interlaced_png/wizard_low-interlaced.png -------------------------------------------------------------------------------- /test/assets/interlaced_png/wizard_low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/interlaced_png/wizard_low.png -------------------------------------------------------------------------------- /test/assets/labeled_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/labeled_image.png -------------------------------------------------------------------------------- /test/assets/masks.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/masks.tiff -------------------------------------------------------------------------------- /test/assets/toosmall_png/heapbof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/toosmall_png/heapbof.png -------------------------------------------------------------------------------- /test/assets/videos/R6llTwEh07w.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/R6llTwEh07w.mp4 -------------------------------------------------------------------------------- /test/assets/videos/RATRACE_wave_f_nm_np1_fr_goo_37.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/RATRACE_wave_f_nm_np1_fr_goo_37.avi -------------------------------------------------------------------------------- /test/assets/videos/SOX5yA1l24A.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/SOX5yA1l24A.mp4 -------------------------------------------------------------------------------- /test/assets/videos/SchoolRulesHowTheyHelpUs_wave_f_nm_np1_ba_med_0.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/SchoolRulesHowTheyHelpUs_wave_f_nm_np1_ba_med_0.avi -------------------------------------------------------------------------------- /test/assets/videos/TrumanShow_wave_f_nm_np1_fr_med_26.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/TrumanShow_wave_f_nm_np1_fr_med_26.avi -------------------------------------------------------------------------------- /test/assets/videos/WUzgd7C1pWA.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/WUzgd7C1pWA.mp4 -------------------------------------------------------------------------------- /test/assets/videos/hmdb51_Turnk_r_Pippi_Michel_cartwheel_f_cm_np2_le_med_6.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/hmdb51_Turnk_r_Pippi_Michel_cartwheel_f_cm_np2_le_med_6.avi -------------------------------------------------------------------------------- /test/assets/videos/v_SoccerJuggling_g23_c01.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/v_SoccerJuggling_g23_c01.avi -------------------------------------------------------------------------------- /test/assets/videos/v_SoccerJuggling_g24_c01.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/assets/videos/v_SoccerJuggling_g24_c01.avi -------------------------------------------------------------------------------- /test/expect/ModelTester.test_alexnet_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_alexnet_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_convnext_base_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_convnext_base_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_convnext_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_convnext_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_convnext_small_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_convnext_small_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_convnext_tiny_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_convnext_tiny_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_crestereo_base_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_crestereo_base_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_deeplabv3_mobilenet_v3_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_deeplabv3_mobilenet_v3_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_deeplabv3_resnet101_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_deeplabv3_resnet101_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_deeplabv3_resnet50_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_deeplabv3_resnet50_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_densenet121_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_densenet121_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_densenet161_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_densenet161_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_densenet169_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_densenet169_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_densenet201_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_densenet201_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b0_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b0_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b1_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b1_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b3_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b3_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b4_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b4_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b5_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b5_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b6_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b6_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_b7_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_b7_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_v2_l_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_v2_l_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_v2_m_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_v2_m_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_efficientnet_v2_s_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_efficientnet_v2_s_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_320_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_320_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fasterrcnn_mobilenet_v3_large_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fasterrcnn_resnet50_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fasterrcnn_resnet50_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fasterrcnn_resnet50_fpn_v2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fasterrcnn_resnet50_fpn_v2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fcn_resnet101_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fcn_resnet101_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fcn_resnet50_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fcn_resnet50_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_fcos_resnet50_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_fcos_resnet50_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_googlenet_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_googlenet_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_googlenet_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_googlenet_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_inception_v3_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_inception_v3_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_keypointrcnn_resnet50_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_keypointrcnn_resnet50_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_lraspp_mobilenet_v3_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_lraspp_mobilenet_v3_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_maskrcnn_resnet50_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_maskrcnn_resnet50_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_maskrcnn_resnet50_fpn_v2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_maskrcnn_resnet50_fpn_v2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_maxvit_t_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_maxvit_t_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mc3_18_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mc3_18_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mnasnet0_5_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mnasnet0_5_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mnasnet0_75_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mnasnet0_75_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mnasnet1_0_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mnasnet1_0_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mnasnet1_3_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mnasnet1_3_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenet_v2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenet_v2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenet_v2_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenet_v2_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenet_v3_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenet_v3_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenet_v3_large_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenet_v3_large_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenet_v3_small_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenet_v3_small_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mobilenetv2_residual_setting_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mobilenetv2_residual_setting_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mvit_v1_b_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mvit_v1_b_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_mvit_v2_s_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_mvit_v2_s_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_r2plus1d_18_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_r2plus1d_18_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_r3d_18_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_r3d_18_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_raft_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_raft_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_raft_small_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_raft_small_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_raft_stereo_base_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_raft_stereo_base_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_raft_stereo_realtime_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_raft_stereo_realtime_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_16gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_16gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_1_6gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_1_6gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_32gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_32gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_3_2gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_3_2gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_400mf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_400mf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_800mf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_800mf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_x_8gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_x_8gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_128gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_128gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_16gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_16gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_1_6gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_1_6gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_32gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_32gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_3_2gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_3_2gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_400mf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_400mf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_800mf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_800mf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_regnet_y_8gf_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_regnet_y_8gf_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet101_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet101_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet152_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet152_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet18_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet18_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet18_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet18_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet34_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet34_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet50_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet50_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnet50_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnet50_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnext101_32x8d_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnext101_32x8d_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnext101_32x8d_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnext101_32x8d_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnext101_64x4d_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnext101_64x4d_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnext101_64x4d_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnext101_64x4d_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_resnext50_32x4d_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_resnext50_32x4d_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_retinanet_resnet50_fpn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_retinanet_resnet50_fpn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_retinanet_resnet50_fpn_v2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_retinanet_resnet50_fpn_v2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_s3d_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_s3d_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x0_5_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x0_5_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x0_5_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x0_5_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x1_0_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x1_0_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x1_0_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x1_0_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x1_5_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x1_5_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x1_5_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x1_5_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x2_0_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x2_0_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_shufflenet_v2_x2_0_quantized_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_shufflenet_v2_x2_0_quantized_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_squeezenet1_0_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_squeezenet1_0_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_squeezenet1_1_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_squeezenet1_1_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_ssd300_vgg16_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_ssd300_vgg16_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_ssdlite320_mobilenet_v3_large_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_ssdlite320_mobilenet_v3_large_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin3d_b_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin3d_b_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin3d_s_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin3d_s_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin3d_t_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin3d_t_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_b_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_b_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_s_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_s_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_t_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_t_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_v2_b_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_v2_b_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_v2_s_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_v2_s_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_swin_v2_t_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_swin_v2_t_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg11_bn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg11_bn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg11_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg11_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg13_bn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg13_bn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg13_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg13_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg16_bn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg16_bn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg16_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg16_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg19_bn_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg19_bn_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vgg19_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vgg19_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vit_b_16_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vit_b_16_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vit_b_32_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vit_b_32_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vit_h_14_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vit_h_14_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vit_l_16_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vit_l_16_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vit_l_32_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vit_l_32_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_vitc_b_16_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_vitc_b_16_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_wide_resnet101_2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_wide_resnet101_2_expect.pkl -------------------------------------------------------------------------------- /test/expect/ModelTester.test_wide_resnet50_2_expect.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pytorch/vision/faffd5cf673615583da6517275e361cb3dbc77e6/test/expect/ModelTester.test_wide_resnet50_2_expect.pkl -------------------------------------------------------------------------------- /test/optests_failures_dict.json: -------------------------------------------------------------------------------- 1 | { 2 | "_description": "This is a dict containing failures for tests autogenerated by generate_opcheck_tests. For more details, please see https://docs.google.com/document/d/1Pj5HRZvdOq3xpFpbEjUZp2hBovhy7Wnxw14m6lF2154/edit", 3 | "_version": 1, 4 | "data": {} 5 | } 6 | -------------------------------------------------------------------------------- /test/test_datasets_video_utils_opt.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import test_datasets_video_utils 4 | from torchvision import set_video_backend # noqa: 401 5 | 6 | # Disabling the video backend switching temporarily 7 | # set_video_backend('video_reader') 8 | 9 | 10 | if __name__ == "__main__": 11 | suite = unittest.TestLoader().loadTestsFromModule(test_datasets_video_utils) 12 | unittest.TextTestRunner(verbosity=1).run(suite) 13 | -------------------------------------------------------------------------------- /test/test_internal_utils.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from torchvision._utils import sequence_to_str 3 | 4 | 5 | @pytest.mark.parametrize( 6 | ("seq", "separate_last", "expected"), 7 | [ 8 | ([], "", ""), 9 | (["foo"], "", "'foo'"), 10 | (["foo", "bar"], "", "'foo', 'bar'"), 11 | (["foo", "bar"], "and ", "'foo' and 'bar'"), 12 | (["foo", "bar", "baz"], "", "'foo', 'bar', 'baz'"), 13 | (["foo", "bar", "baz"], "and ", "'foo', 'bar', and 'baz'"), 14 | ], 15 | ) 16 | def test_sequence_to_str(seq, separate_last, expected): 17 | assert sequence_to_str(seq, separate_last=separate_last) == expected 18 | -------------------------------------------------------------------------------- /test/test_io_opt.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import test_io 4 | from torchvision import set_video_backend # noqa: 401 5 | 6 | 7 | # Disabling the video backend switching temporarily 8 | # set_video_backend('video_reader') 9 | 10 | 11 | if __name__ == "__main__": 12 | suite = unittest.TestLoader().loadTestsFromModule(test_io) 13 | unittest.TextTestRunner(verbosity=1).run(suite) 14 | -------------------------------------------------------------------------------- /torchvision/_utils.py: -------------------------------------------------------------------------------- 1 | import enum 2 | from collections.abc import Sequence 3 | from typing import TypeVar 4 | 5 | T = TypeVar("T", bound=enum.Enum) 6 | 7 | 8 | class StrEnumMeta(enum.EnumMeta): 9 | auto = enum.auto 10 | 11 | def from_str(self: type[T], member: str) -> T: # type: ignore[misc] 12 | try: 13 | return self[member] 14 | except KeyError: 15 | # TODO: use `add_suggestion` from torchvision.prototype.utils._internal to improve the error message as 16 | # soon as it is migrated. 17 | raise ValueError(f"Unknown value '{member}' for {self.__name__}.") from None 18 | 19 | 20 | class StrEnum(enum.Enum, metaclass=StrEnumMeta): 21 | pass 22 | 23 | 24 | def sequence_to_str(seq: Sequence, separate_last: str = "") -> str: 25 | if not seq: 26 | return "" 27 | if len(seq) == 1: 28 | return f"'{seq[0]}'" 29 | 30 | head = "'" + "', '".join([str(item) for item in seq[:-1]]) + "'" 31 | tail = f"{'' if separate_last and len(seq) == 2 else ','} {separate_last}'{seq[-1]}'" 32 | 33 | return head + tail 34 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/audio_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defs.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * Class transcode audio frames from one format into another 9 | */ 10 | 11 | class AudioSampler : public MediaSampler { 12 | public: 13 | explicit AudioSampler(void* logCtx); 14 | ~AudioSampler() override; 15 | 16 | // MediaSampler overrides 17 | bool init(const SamplerParameters& params) override; 18 | int sample(const ByteStorage* in, ByteStorage* out) override; 19 | void shutdown() override; 20 | 21 | int sample(AVFrame* frame, ByteStorage* out); 22 | 23 | private: 24 | // close resources 25 | void cleanUp(); 26 | // helper functions for rescaling, cropping, etc. 27 | int numOutputSamples(int inSamples) const; 28 | int sample( 29 | const uint8_t* inPlanes[], 30 | int inNumSamples, 31 | ByteStorage* out, 32 | int outNumSamples); 33 | 34 | private: 35 | SwrContext* swrContext_{nullptr}; 36 | void* logCtx_{nullptr}; 37 | }; 38 | 39 | } // namespace ffmpeg 40 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/audio_stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "audio_sampler.h" 4 | #include "stream.h" 5 | 6 | namespace ffmpeg { 7 | 8 | /** 9 | * Class uses FFMPEG library to decode one audio stream. 10 | */ 11 | 12 | class AudioStream : public Stream { 13 | public: 14 | AudioStream( 15 | AVFormatContext* inputCtx, 16 | int index, 17 | bool convertPtsToWallTime, 18 | const AudioFormat& format); 19 | ~AudioStream() override; 20 | 21 | private: 22 | int initFormat() override; 23 | int copyFrameBytes(ByteStorage* out, bool flush) override; 24 | 25 | private: 26 | std::unique_ptr sampler_; 27 | }; 28 | 29 | } // namespace ffmpeg 30 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/cc_stream.cpp: -------------------------------------------------------------------------------- 1 | #include "cc_stream.h" 2 | 3 | namespace ffmpeg { 4 | 5 | CCStream::CCStream( 6 | AVFormatContext* inputCtx, 7 | int index, 8 | bool convertPtsToWallTime, 9 | const SubtitleFormat& format) 10 | : SubtitleStream(inputCtx, index, convertPtsToWallTime, format) { 11 | format_.type = TYPE_CC; 12 | } 13 | 14 | AVCodec* CCStream::findCodec(AVCodecParameters* params) { 15 | if (params->codec_id == AV_CODEC_ID_BIN_DATA && 16 | params->codec_type == AVMEDIA_TYPE_DATA) { 17 | // obtain subtitles codec 18 | params->codec_id = AV_CODEC_ID_MOV_TEXT; 19 | params->codec_type = AVMEDIA_TYPE_SUBTITLE; 20 | } 21 | return Stream::findCodec(params); 22 | } 23 | 24 | } // namespace ffmpeg 25 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/cc_stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "subtitle_stream.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * Class uses FFMPEG library to decode one closed captions stream. 9 | */ 10 | class CCStream : public SubtitleStream { 11 | public: 12 | CCStream( 13 | AVFormatContext* inputCtx, 14 | int index, 15 | bool convertPtsToWallTime, 16 | const SubtitleFormat& format); 17 | 18 | private: 19 | AVCodec* findCodec(AVCodecParameters* params) override; 20 | }; 21 | 22 | } // namespace ffmpeg 23 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/gpu/README.rst: -------------------------------------------------------------------------------- 1 | GPU Decoder 2 | =========== 3 | 4 | GPU decoder depends on ffmpeg for demuxing, uses NVDECODE APIs from the nvidia-video-codec sdk and uses cuda for processing on gpu. In order to use this, please follow the following steps: 5 | 6 | * Download the latest `nvidia-video-codec-sdk `_ 7 | * Extract the zipped file. 8 | * Set TORCHVISION_INCLUDE environment variable to the location of the video codec headers(`nvcuvid.h` and `cuviddec.h`), which would be under `Interface` directory. 9 | * Set TORCHVISION_LIBRARY environment variable to the location of the video codec library(`libnvcuvid.so`), which would be under `Lib/linux/stubs/x86_64` directory. 10 | * Install the latest ffmpeg from `conda-forge` channel. 11 | 12 | .. code:: bash 13 | 14 | conda install -c conda-forge ffmpeg 15 | 16 | * Set CUDA_HOME environment variable to the cuda root directory. 17 | * Build torchvision from source: 18 | 19 | .. code:: bash 20 | 21 | pip install . -v --no-build-isolation 22 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/gpu/gpu_decoder.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "decoder.h" 4 | #include "demuxer.h" 5 | 6 | class GPUDecoder : public torch::CustomClassHolder { 7 | public: 8 | GPUDecoder(std::string, torch::Device); 9 | ~GPUDecoder(); 10 | torch::Tensor decode(); 11 | void seek(double, bool); 12 | c10::Dict> get_metadata() const; 13 | 14 | private: 15 | Demuxer demuxer; 16 | CUcontext ctx; 17 | Decoder decoder; 18 | int64_t device; 19 | bool initialised = false; 20 | }; 21 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/memory_buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defs.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * Class uses external memory buffer and implements a seekable interface. 9 | */ 10 | class MemoryBuffer { 11 | public: 12 | explicit MemoryBuffer(const uint8_t* buffer, size_t size); 13 | int64_t seek(int64_t offset, int whence); 14 | int read(uint8_t* buf, int size); 15 | 16 | // static constructor for decoder callback. 17 | static DecoderInCallback getCallback(const uint8_t* buffer, size_t size); 18 | 19 | private: 20 | const uint8_t* buffer_; // set at construction time 21 | long pos_{0}; // current position 22 | long len_{0}; // bytes in buffer 23 | }; 24 | 25 | } // namespace ffmpeg 26 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/subtitle_sampler.cpp: -------------------------------------------------------------------------------- 1 | #include "subtitle_sampler.h" 2 | #include 3 | #include "util.h" 4 | 5 | namespace ffmpeg { 6 | 7 | SubtitleSampler::~SubtitleSampler() { 8 | cleanUp(); 9 | } 10 | 11 | void SubtitleSampler::shutdown() { 12 | cleanUp(); 13 | } 14 | 15 | bool SubtitleSampler::init(const SamplerParameters& params) { 16 | cleanUp(); 17 | // set formats 18 | params_ = params; 19 | return true; 20 | } 21 | 22 | int SubtitleSampler::sample(AVSubtitle* sub, ByteStorage* out) { 23 | if (!sub || !out) { 24 | return 0; // flush 25 | } 26 | 27 | out->ensure(Util::size(*sub)); 28 | 29 | return Util::serialize(*sub, out); 30 | } 31 | 32 | int SubtitleSampler::sample(const ByteStorage* in, ByteStorage* out) { 33 | if (in && out) { 34 | // Get a writable copy 35 | if (size_t len = in->length()) { 36 | out->ensure(len); 37 | memcpy(out->writableTail(), in->data(), len); 38 | } 39 | return out->length(); 40 | } 41 | return 0; 42 | } 43 | 44 | void SubtitleSampler::cleanUp() {} 45 | 46 | } // namespace ffmpeg 47 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/subtitle_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defs.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * Class transcode audio frames from one format into another 9 | */ 10 | 11 | class SubtitleSampler : public MediaSampler { 12 | public: 13 | SubtitleSampler() = default; 14 | ~SubtitleSampler() override; 15 | 16 | bool init(const SamplerParameters& params) override; 17 | int sample(const ByteStorage* in, ByteStorage* out) override; 18 | void shutdown() override; 19 | 20 | // returns number processed/scaling bytes 21 | int sample(AVSubtitle* sub, ByteStorage* out); 22 | 23 | // helper serialization/deserialization methods 24 | static void serialize(const AVSubtitle& sub, ByteStorage* out); 25 | static bool deserialize(const ByteStorage& buf, AVSubtitle* sub); 26 | 27 | private: 28 | // close resources 29 | void cleanUp(); 30 | }; 31 | 32 | } // namespace ffmpeg 33 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/subtitle_stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stream.h" 4 | #include "subtitle_sampler.h" 5 | 6 | namespace ffmpeg { 7 | 8 | /** 9 | * Class uses FFMPEG library to decode one subtitle stream. 10 | */ 11 | struct AVSubtitleKeeper : AVSubtitle { 12 | int64_t release{0}; 13 | }; 14 | 15 | class SubtitleStream : public Stream { 16 | public: 17 | SubtitleStream( 18 | AVFormatContext* inputCtx, 19 | int index, 20 | bool convertPtsToWallTime, 21 | const SubtitleFormat& format); 22 | ~SubtitleStream() override; 23 | 24 | protected: 25 | void setFramePts(DecoderHeader* header, bool flush) override; 26 | 27 | private: 28 | int initFormat() override; 29 | int analyzePacket(const AVPacket* packet, bool* gotFrame) override; 30 | int copyFrameBytes(ByteStorage* out, bool flush) override; 31 | void releaseSubtitle(); 32 | 33 | private: 34 | SubtitleSampler sampler_; 35 | AVSubtitleKeeper sub_; 36 | }; 37 | 38 | } // namespace ffmpeg 39 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/time_keeper.cpp: -------------------------------------------------------------------------------- 1 | #include "time_keeper.h" 2 | #include "defs.h" 3 | 4 | namespace ffmpeg { 5 | 6 | namespace { 7 | const long kMaxTimeBaseDiference = 10; 8 | } 9 | 10 | long TimeKeeper::adjust(long& decoderTimestamp) { 11 | const long now = std::chrono::duration_cast( 12 | std::chrono::system_clock::now().time_since_epoch()) 13 | .count(); 14 | 15 | if (startTime_ == 0) { 16 | startTime_ = now; 17 | } 18 | if (streamTimestamp_ == 0) { 19 | streamTimestamp_ = decoderTimestamp; 20 | } 21 | 22 | const auto runOut = startTime_ + decoderTimestamp - streamTimestamp_; 23 | 24 | if (std::labs((now - runOut) / AV_TIME_BASE) > kMaxTimeBaseDiference) { 25 | streamTimestamp_ = startTime_ - now + decoderTimestamp; 26 | } 27 | 28 | const auto sleepAdvised = runOut - now; 29 | 30 | decoderTimestamp += startTime_ - streamTimestamp_; 31 | 32 | return sleepAdvised > 0 ? sleepAdvised : 0; 33 | } 34 | 35 | } // namespace ffmpeg 36 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/time_keeper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace ffmpeg { 7 | 8 | /** 9 | * Class keeps the track of the decoded timestamps (us) for media streams. 10 | */ 11 | 12 | class TimeKeeper { 13 | public: 14 | TimeKeeper() = default; 15 | 16 | // adjust provided @timestamp to the corrected value 17 | // return advised sleep time before next frame processing in (us) 18 | long adjust(long& decoderTimestamp); 19 | 20 | private: 21 | long startTime_{0}; 22 | long streamTimestamp_{0}; 23 | }; 24 | 25 | } // namespace ffmpeg 26 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defs.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * FFMPEG library utility functions. 9 | */ 10 | 11 | namespace Util { 12 | std::string generateErrorDesc(int errorCode); 13 | size_t serialize(const AVSubtitle& sub, ByteStorage* out); 14 | bool deserialize(const ByteStorage& buf, AVSubtitle* sub); 15 | size_t size(const AVSubtitle& sub); 16 | void setFormatDimensions( 17 | size_t& destW, 18 | size_t& destH, 19 | size_t userW, 20 | size_t userH, 21 | size_t srcW, 22 | size_t srcH, 23 | size_t minDimension, 24 | size_t maxDimension, 25 | size_t cropImage); 26 | bool validateVideoFormat(const VideoFormat& format); 27 | } // namespace Util 28 | } // namespace ffmpeg 29 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/video_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defs.h" 4 | 5 | namespace ffmpeg { 6 | 7 | /** 8 | * Class transcode video frames from one format into another 9 | */ 10 | 11 | class VideoSampler : public MediaSampler { 12 | public: 13 | VideoSampler(int swsFlags = SWS_AREA, int64_t loggingUuid = 0); 14 | 15 | ~VideoSampler() override; 16 | 17 | // MediaSampler overrides 18 | bool init(const SamplerParameters& params) override; 19 | int sample(const ByteStorage* in, ByteStorage* out) override; 20 | void shutdown() override; 21 | 22 | // returns number processed/scaling bytes 23 | int sample(AVFrame* frame, ByteStorage* out); 24 | int getImageBytes() const; 25 | 26 | private: 27 | // close resources 28 | void cleanUp(); 29 | // helper functions for rescaling, cropping, etc. 30 | int sample( 31 | const uint8_t* const srcSlice[], 32 | int srcStride[], 33 | ByteStorage* out); 34 | 35 | private: 36 | VideoFormat scaleFormat_; 37 | SwsContext* scaleContext_{nullptr}; 38 | SwsContext* cropContext_{nullptr}; 39 | int swsFlags_{SWS_AREA}; 40 | std::vector scaleBuffer_; 41 | int64_t loggingUuid_{0}; 42 | }; 43 | 44 | } // namespace ffmpeg 45 | -------------------------------------------------------------------------------- /torchvision/csrc/io/decoder/video_stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stream.h" 4 | #include "video_sampler.h" 5 | 6 | namespace ffmpeg { 7 | 8 | /** 9 | * Class uses FFMPEG library to decode one video stream. 10 | */ 11 | 12 | class VideoStream : public Stream { 13 | public: 14 | VideoStream( 15 | AVFormatContext* inputCtx, 16 | int index, 17 | bool convertPtsToWallTime, 18 | const VideoFormat& format, 19 | int64_t loggingUuid); 20 | ~VideoStream() override; 21 | 22 | private: 23 | int initFormat() override; 24 | int copyFrameBytes(ByteStorage* out, bool flush) override; 25 | void setHeader(DecoderHeader* header, bool flush) override; 26 | 27 | private: 28 | std::unique_ptr sampler_; 29 | }; 30 | 31 | } // namespace ffmpeg 32 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace vision { 7 | namespace image { 8 | 9 | /* Should be kept in-sync with Python ImageReadMode enum */ 10 | using ImageReadMode = int64_t; 11 | const ImageReadMode IMAGE_READ_MODE_UNCHANGED = 0; 12 | const ImageReadMode IMAGE_READ_MODE_GRAY = 1; 13 | const ImageReadMode IMAGE_READ_MODE_GRAY_ALPHA = 2; 14 | const ImageReadMode IMAGE_READ_MODE_RGB = 3; 15 | const ImageReadMode IMAGE_READ_MODE_RGB_ALPHA = 4; 16 | 17 | void validate_encoded_data(const torch::Tensor& encoded_data); 18 | 19 | bool should_this_return_rgb_or_rgba_let_me_know_in_the_comments_down_below_guys_see_you_in_the_next_video( 20 | ImageReadMode mode, 21 | bool has_alpha); 22 | 23 | } // namespace image 24 | } // namespace vision 25 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/common_jpeg.cpp: -------------------------------------------------------------------------------- 1 | #include "common_jpeg.h" 2 | 3 | namespace vision { 4 | namespace image { 5 | namespace detail { 6 | 7 | #if JPEG_FOUND 8 | void torch_jpeg_error_exit(j_common_ptr cinfo) { 9 | /* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce 10 | * pointer */ 11 | torch_jpeg_error_ptr myerr = (torch_jpeg_error_ptr)cinfo->err; 12 | 13 | /* Always display the message. */ 14 | /* We could postpone this until after returning, if we chose. */ 15 | // (*cinfo->err->output_message)(cinfo); 16 | /* Create the message */ 17 | (*(cinfo->err->format_message))(cinfo, myerr->jpegLastErrorMsg); 18 | 19 | /* Return control to the setjmp point */ 20 | longjmp(myerr->setjmp_buffer, 1); 21 | } 22 | #endif 23 | 24 | } // namespace detail 25 | } // namespace image 26 | } // namespace vision 27 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/common_jpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if JPEG_FOUND 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace vision { 10 | namespace image { 11 | namespace detail { 12 | 13 | static const JOCTET EOI_BUFFER[1] = {JPEG_EOI}; 14 | struct torch_jpeg_error_mgr { 15 | struct jpeg_error_mgr pub; /* "public" fields */ 16 | char jpegLastErrorMsg[JMSG_LENGTH_MAX]; /* error messages */ 17 | jmp_buf setjmp_buffer; /* for return to caller */ 18 | }; 19 | 20 | using torch_jpeg_error_ptr = struct torch_jpeg_error_mgr*; 21 | void torch_jpeg_error_exit(j_common_ptr cinfo); 22 | 23 | } // namespace detail 24 | } // namespace image 25 | } // namespace vision 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/common_png.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if PNG_FOUND 4 | #include 5 | #include 6 | #endif 7 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/decode_gif.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace vision { 6 | namespace image { 7 | 8 | // encoded_data tensor must be 1D uint8 and contiguous 9 | C10_EXPORT torch::Tensor decode_gif(const torch::Tensor& encoded_data); 10 | 11 | } // namespace image 12 | } // namespace vision 13 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/decode_image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../common.h" 5 | 6 | namespace vision { 7 | namespace image { 8 | 9 | C10_EXPORT torch::Tensor decode_image( 10 | const torch::Tensor& data, 11 | ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED, 12 | bool apply_exif_orientation = false); 13 | 14 | } // namespace image 15 | } // namespace vision 16 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/decode_jpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../common.h" 5 | 6 | namespace vision { 7 | namespace image { 8 | 9 | C10_EXPORT torch::Tensor decode_jpeg( 10 | const torch::Tensor& data, 11 | ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED, 12 | bool apply_exif_orientation = false); 13 | 14 | C10_EXPORT int64_t _jpeg_version(); 15 | C10_EXPORT bool _is_compiled_against_turbo(); 16 | 17 | } // namespace image 18 | } // namespace vision 19 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/decode_png.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../common.h" 5 | 6 | namespace vision { 7 | namespace image { 8 | 9 | C10_EXPORT torch::Tensor decode_png( 10 | const torch::Tensor& data, 11 | ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED, 12 | bool apply_exif_orientation = false); 13 | 14 | } // namespace image 15 | } // namespace vision 16 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/decode_webp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../common.h" 5 | 6 | namespace vision { 7 | namespace image { 8 | 9 | C10_EXPORT torch::Tensor decode_webp( 10 | const torch::Tensor& encoded_data, 11 | ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED); 12 | 13 | } // namespace image 14 | } // namespace vision 15 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/encode_jpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace vision { 6 | namespace image { 7 | 8 | C10_EXPORT torch::Tensor encode_jpeg( 9 | const torch::Tensor& data, 10 | int64_t quality); 11 | 12 | } // namespace image 13 | } // namespace vision 14 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/encode_png.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace vision { 6 | namespace image { 7 | 8 | C10_EXPORT torch::Tensor encode_png( 9 | const torch::Tensor& data, 10 | int64_t compression_level); 11 | 12 | } // namespace image 13 | } // namespace vision 14 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cpu/read_write_file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace vision { 6 | namespace image { 7 | 8 | C10_EXPORT torch::Tensor read_file(const std::string& filename); 9 | 10 | C10_EXPORT void write_file(const std::string& filename, torch::Tensor& data); 11 | 12 | } // namespace image 13 | } // namespace vision 14 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/cuda/encode_jpegs_cuda.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #if NVJPEG_FOUND 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace vision { 11 | namespace image { 12 | 13 | class CUDAJpegEncoder { 14 | public: 15 | CUDAJpegEncoder(const torch::Device& device); 16 | ~CUDAJpegEncoder(); 17 | 18 | torch::Tensor encode_jpeg(const torch::Tensor& src_image); 19 | 20 | void set_quality(const int64_t quality); 21 | 22 | const torch::Device original_device; 23 | const torch::Device target_device; 24 | const c10::cuda::CUDAStream stream; 25 | const c10::cuda::CUDAStream current_stream; 26 | 27 | protected: 28 | nvjpegEncoderState_t nv_enc_state; 29 | nvjpegEncoderParams_t nv_enc_params; 30 | nvjpegHandle_t nvjpeg_handle; 31 | }; 32 | } // namespace image 33 | } // namespace vision 34 | #endif 35 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/image.cpp: -------------------------------------------------------------------------------- 1 | #include "image.h" 2 | 3 | #include 4 | 5 | namespace vision { 6 | namespace image { 7 | 8 | static auto registry = 9 | torch::RegisterOperators() 10 | .op("image::decode_gif", &decode_gif) 11 | .op("image::decode_png(Tensor data, int mode, bool apply_exif_orientation=False) -> Tensor", 12 | &decode_png) 13 | .op("image::encode_png", &encode_png) 14 | .op("image::decode_jpeg(Tensor data, int mode, bool apply_exif_orientation=False) -> Tensor", 15 | &decode_jpeg) 16 | .op("image::decode_webp(Tensor encoded_data, int mode) -> Tensor", 17 | &decode_webp) 18 | .op("image::encode_jpeg", &encode_jpeg) 19 | .op("image::read_file", &read_file) 20 | .op("image::write_file", &write_file) 21 | .op("image::decode_image(Tensor data, int mode, bool apply_exif_orientation=False) -> Tensor", 22 | &decode_image) 23 | .op("image::decode_jpegs_cuda", &decode_jpegs_cuda) 24 | .op("image::encode_jpegs_cuda", &encode_jpegs_cuda) 25 | .op("image::_jpeg_version", &_jpeg_version) 26 | .op("image::_is_compiled_against_turbo", &_is_compiled_against_turbo); 27 | 28 | } // namespace image 29 | } // namespace vision 30 | -------------------------------------------------------------------------------- /torchvision/csrc/io/image/image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cpu/decode_gif.h" 4 | #include "cpu/decode_image.h" 5 | #include "cpu/decode_jpeg.h" 6 | #include "cpu/decode_png.h" 7 | #include "cpu/decode_webp.h" 8 | #include "cpu/encode_jpeg.h" 9 | #include "cpu/encode_png.h" 10 | #include "cpu/read_write_file.h" 11 | #include "cuda/encode_decode_jpegs_cuda.h" 12 | -------------------------------------------------------------------------------- /torchvision/csrc/macros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(_WIN32) && !defined(TORCHVISION_BUILD_STATIC_LIBS) 4 | #if defined(torchvision_EXPORTS) 5 | #define VISION_API __declspec(dllexport) 6 | #else 7 | #define VISION_API __declspec(dllimport) 8 | #endif 9 | #else 10 | #define VISION_API 11 | #endif 12 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/autocast/ps_roi_align_kernel.cpp: -------------------------------------------------------------------------------- 1 | #include "../ps_roi_align.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace vision { 8 | namespace ops { 9 | 10 | namespace { 11 | 12 | std::tuple ps_roi_align_autocast( 13 | const at::Tensor& input, 14 | const at::Tensor& rois, 15 | double spatial_scale, 16 | int64_t pooled_height, 17 | int64_t pooled_width, 18 | int64_t sampling_ratio) { 19 | c10::impl::ExcludeDispatchKeyGuard no_autocast(c10::DispatchKey::Autocast); 20 | auto result = ps_roi_align( 21 | at::autocast::cached_cast(at::kFloat, input), 22 | at::autocast::cached_cast(at::kFloat, rois), 23 | spatial_scale, 24 | pooled_height, 25 | pooled_width, 26 | sampling_ratio); 27 | 28 | return std::make_tuple( 29 | std::get<0>(result).to(input.scalar_type()), 30 | std::get<1>(result).to(input.scalar_type())); 31 | } 32 | 33 | } // namespace 34 | 35 | TORCH_LIBRARY_IMPL(torchvision, Autocast, m) { 36 | m.impl( 37 | TORCH_SELECTIVE_NAME("torchvision::ps_roi_align"), 38 | TORCH_FN(ps_roi_align_autocast)); 39 | } 40 | 41 | } // namespace ops 42 | } // namespace vision 43 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/autocast/ps_roi_pool_kernel.cpp: -------------------------------------------------------------------------------- 1 | #include "../ps_roi_pool.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace vision { 8 | namespace ops { 9 | 10 | namespace { 11 | 12 | std::tuple ps_roi_pool_autocast( 13 | const at::Tensor& input, 14 | const at::Tensor& rois, 15 | double spatial_scale, 16 | int64_t pooled_height, 17 | int64_t pooled_width) { 18 | c10::impl::ExcludeDispatchKeyGuard no_autocast(c10::DispatchKey::Autocast); 19 | auto result = ps_roi_pool( 20 | at::autocast::cached_cast(at::kFloat, input), 21 | at::autocast::cached_cast(at::kFloat, rois), 22 | spatial_scale, 23 | pooled_height, 24 | pooled_width); 25 | 26 | return std::make_tuple( 27 | std::get<0>(result).to(input.scalar_type()), 28 | std::get<1>(result).to(input.scalar_type())); 29 | } 30 | 31 | } // namespace 32 | 33 | TORCH_LIBRARY_IMPL(torchvision, Autocast, m) { 34 | m.impl( 35 | TORCH_SELECTIVE_NAME("torchvision::ps_roi_pool"), 36 | TORCH_FN(ps_roi_pool_autocast)); 37 | } 38 | 39 | } // namespace ops 40 | } // namespace vision 41 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/autocast/roi_pool_kernel.cpp: -------------------------------------------------------------------------------- 1 | #include "../roi_pool.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace vision { 8 | namespace ops { 9 | 10 | namespace { 11 | 12 | std::tuple roi_pool_autocast( 13 | const at::Tensor& input, 14 | const at::Tensor& rois, 15 | double spatial_scale, 16 | int64_t pooled_height, 17 | int64_t pooled_width) { 18 | c10::impl::ExcludeDispatchKeyGuard no_autocast(c10::DispatchKey::Autocast); 19 | auto result = roi_pool( 20 | at::autocast::cached_cast(at::kFloat, input), 21 | at::autocast::cached_cast(at::kFloat, rois), 22 | spatial_scale, 23 | pooled_height, 24 | pooled_width); 25 | 26 | return std::make_tuple( 27 | std::get<0>(result).to(input.scalar_type()), 28 | std::get<1>(result).to(input.scalar_type())); 29 | } 30 | 31 | } // namespace 32 | 33 | TORCH_LIBRARY_IMPL(torchvision, Autocast, m) { 34 | m.impl( 35 | TORCH_SELECTIVE_NAME("torchvision::roi_pool"), 36 | TORCH_FN(roi_pool_autocast)); 37 | } 38 | 39 | } // namespace ops 40 | } // namespace vision 41 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/cuda/cuda_helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace vision { 4 | namespace ops { 5 | 6 | #define CUDA_1D_KERNEL_LOOP_T(i, n, index_t) \ 7 | for (index_t i = (blockIdx.x * blockDim.x) + threadIdx.x; i < (n); \ 8 | i += (blockDim.x * gridDim.x)) 9 | 10 | #define CUDA_1D_KERNEL_LOOP(i, n) CUDA_1D_KERNEL_LOOP_T(i, n, int) 11 | 12 | template 13 | constexpr __host__ __device__ inline integer ceil_div(integer n, integer m) { 14 | return (n + m - 1) / m; 15 | } 16 | 17 | } // namespace ops 18 | } // namespace vision 19 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/mps/mps_helpers.h: -------------------------------------------------------------------------------- 1 | constexpr int threadsPerBlock = 512; 2 | 3 | template 4 | constexpr inline T ceil_div(T n, T m) { 5 | return (n + m - 1) / m; 6 | } 7 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/nms.cpp: -------------------------------------------------------------------------------- 1 | #include "nms.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace vision { 8 | namespace ops { 9 | 10 | at::Tensor nms( 11 | const at::Tensor& dets, 12 | const at::Tensor& scores, 13 | double iou_threshold) { 14 | C10_LOG_API_USAGE_ONCE("torchvision.csrc.ops.nms.nms"); 15 | static auto op = c10::Dispatcher::singleton() 16 | .findSchemaOrThrow("torchvision::nms", "") 17 | .typed(); 18 | return op.call(dets, scores, iou_threshold); 19 | } 20 | 21 | TORCH_LIBRARY_FRAGMENT(torchvision, m) { 22 | m.set_python_module("torchvision._meta_registrations"); 23 | m.def(TORCH_SELECTIVE_SCHEMA( 24 | "torchvision::nms(Tensor dets, Tensor scores, float iou_threshold) -> Tensor")); 25 | } 26 | 27 | } // namespace ops 28 | } // namespace vision 29 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/nms.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../macros.h" 5 | 6 | namespace vision { 7 | namespace ops { 8 | 9 | VISION_API at::Tensor nms( 10 | const at::Tensor& dets, 11 | const at::Tensor& scores, 12 | double iou_threshold); 13 | 14 | } // namespace ops 15 | } // namespace vision 16 | -------------------------------------------------------------------------------- /torchvision/csrc/ops/ops.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "deform_conv2d.h" 4 | #include "nms.h" 5 | #include "ps_roi_align.h" 6 | #include "ps_roi_pool.h" 7 | #include "roi_align.h" 8 | #include "roi_pool.h" 9 | -------------------------------------------------------------------------------- /torchvision/csrc/vision.cpp: -------------------------------------------------------------------------------- 1 | #include "vision.h" 2 | 3 | #include 4 | 5 | #ifdef WITH_CUDA 6 | #include 7 | #endif 8 | #ifdef WITH_HIP 9 | #include 10 | #endif 11 | 12 | // If we are in a Windows environment, we need to define 13 | // initialization functions for the _custom_ops extension. 14 | #if !defined(MOBILE) && defined(_WIN32) 15 | void* PyInit__C(void) { 16 | return nullptr; 17 | } 18 | #endif // !defined(MOBILE) && defined(_WIN32) 19 | 20 | namespace vision { 21 | int64_t cuda_version() { 22 | #ifdef WITH_CUDA 23 | return CUDA_VERSION; 24 | #else 25 | return -1; 26 | #endif 27 | } 28 | 29 | TORCH_LIBRARY_FRAGMENT(torchvision, m) { 30 | m.def("_cuda_version", &cuda_version); 31 | } 32 | } // namespace vision 33 | -------------------------------------------------------------------------------- /torchvision/csrc/vision.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "macros.h" 5 | 6 | namespace vision { 7 | VISION_API int64_t cuda_version(); 8 | 9 | namespace detail { 10 | extern "C" inline auto _register_ops = &cuda_version; 11 | } // namespace detail 12 | } // namespace vision 13 | -------------------------------------------------------------------------------- /torchvision/datasets/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip_sampler import DistributedSampler, RandomClipSampler, UniformClipSampler 2 | 3 | __all__ = ("DistributedSampler", "UniformClipSampler", "RandomClipSampler") 4 | -------------------------------------------------------------------------------- /torchvision/io/_load_gpu_decoder.py: -------------------------------------------------------------------------------- 1 | from ..extension import _load_library 2 | 3 | 4 | try: 5 | _load_library("gpu_decoder") 6 | _HAS_GPU_VIDEO_DECODER = True 7 | except (ImportError, OSError): 8 | _HAS_GPU_VIDEO_DECODER = False 9 | -------------------------------------------------------------------------------- /torchvision/io/_video_deprecation_warning.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | 3 | import torch 4 | 5 | 6 | def _raise_video_deprecation_warning(): 7 | 8 | if not torch.jit.is_scripting() and not torch.jit.is_tracing(): 9 | warnings.warn( 10 | "The video decoding and encoding capabilities of torchvision " 11 | "are deprecated from version 0.22 and will be removed in version 0.24. " 12 | "We recommend that you migrate to TorchCodec, where we'll consolidate " 13 | "the future decoding/encoding capabilities of PyTorch: " 14 | "https://github.com/pytorch/torchcodec", 15 | UserWarning, 16 | ) 17 | -------------------------------------------------------------------------------- /torchvision/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .alexnet import * 2 | from .convnext import * 3 | from .densenet import * 4 | from .efficientnet import * 5 | from .googlenet import * 6 | from .inception import * 7 | from .mnasnet import * 8 | from .mobilenet import * 9 | from .regnet import * 10 | from .resnet import * 11 | from .shufflenetv2 import * 12 | from .squeezenet import * 13 | from .vgg import * 14 | from .vision_transformer import * 15 | from .swin_transformer import * 16 | from .maxvit import * 17 | from . import detection, optical_flow, quantization, segmentation, video 18 | 19 | # The Weights and WeightsEnum are developer-facing utils that we make public for 20 | # downstream libs like torchgeo https://github.com/pytorch/vision/issues/7094 21 | # TODO: we could / should document them publicly, but it's not clear where, as 22 | # they're not intended for end users. 23 | from ._api import get_model, get_model_builder, get_model_weights, get_weight, list_models, Weights, WeightsEnum 24 | -------------------------------------------------------------------------------- /torchvision/models/detection/__init__.py: -------------------------------------------------------------------------------- 1 | from .faster_rcnn import * 2 | from .fcos import * 3 | from .keypoint_rcnn import * 4 | from .mask_rcnn import * 5 | from .retinanet import * 6 | from .ssd import * 7 | from .ssdlite import * 8 | -------------------------------------------------------------------------------- /torchvision/models/detection/image_list.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from torch import Tensor 3 | 4 | 5 | class ImageList: 6 | """ 7 | Structure that holds a list of images (of possibly 8 | varying sizes) as a single tensor. 9 | This works by padding the images to the same size, 10 | and storing in a field the original sizes of each image 11 | 12 | Args: 13 | tensors (tensor): Tensor containing images. 14 | image_sizes (list[tuple[int, int]]): List of Tuples each containing size of images. 15 | """ 16 | 17 | def __init__(self, tensors: Tensor, image_sizes: list[tuple[int, int]]) -> None: 18 | self.tensors = tensors 19 | self.image_sizes = image_sizes 20 | 21 | def to(self, device: torch.device) -> "ImageList": 22 | cast_tensor = self.tensors.to(device) 23 | return ImageList(cast_tensor, self.image_sizes) 24 | -------------------------------------------------------------------------------- /torchvision/models/mobilenet.py: -------------------------------------------------------------------------------- 1 | from .mobilenetv2 import * # noqa: F401, F403 2 | from .mobilenetv3 import * # noqa: F401, F403 3 | from .mobilenetv2 import __all__ as mv2_all 4 | from .mobilenetv3 import __all__ as mv3_all 5 | 6 | __all__ = mv2_all + mv3_all 7 | -------------------------------------------------------------------------------- /torchvision/models/optical_flow/__init__.py: -------------------------------------------------------------------------------- 1 | from .raft import * 2 | -------------------------------------------------------------------------------- /torchvision/models/quantization/__init__.py: -------------------------------------------------------------------------------- 1 | from .googlenet import * 2 | from .inception import * 3 | from .mobilenet import * 4 | from .resnet import * 5 | from .shufflenetv2 import * 6 | -------------------------------------------------------------------------------- /torchvision/models/quantization/mobilenet.py: -------------------------------------------------------------------------------- 1 | from .mobilenetv2 import * # noqa: F401, F403 2 | from .mobilenetv3 import * # noqa: F401, F403 3 | from .mobilenetv2 import __all__ as mv2_all 4 | from .mobilenetv3 import __all__ as mv3_all 5 | 6 | __all__ = mv2_all + mv3_all 7 | -------------------------------------------------------------------------------- /torchvision/models/segmentation/__init__.py: -------------------------------------------------------------------------------- 1 | from .deeplabv3 import * 2 | from .fcn import * 3 | from .lraspp import * 4 | -------------------------------------------------------------------------------- /torchvision/models/segmentation/_utils.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | from typing import Optional 3 | 4 | from torch import nn, Tensor 5 | from torch.nn import functional as F 6 | 7 | from ...utils import _log_api_usage_once 8 | 9 | 10 | class _SimpleSegmentationModel(nn.Module): 11 | __constants__ = ["aux_classifier"] 12 | 13 | def __init__(self, backbone: nn.Module, classifier: nn.Module, aux_classifier: Optional[nn.Module] = None) -> None: 14 | super().__init__() 15 | _log_api_usage_once(self) 16 | self.backbone = backbone 17 | self.classifier = classifier 18 | self.aux_classifier = aux_classifier 19 | 20 | def forward(self, x: Tensor) -> dict[str, Tensor]: 21 | input_shape = x.shape[-2:] 22 | # contract: features is a dict of tensors 23 | features = self.backbone(x) 24 | 25 | result = OrderedDict() 26 | x = features["out"] 27 | x = self.classifier(x) 28 | x = F.interpolate(x, size=input_shape, mode="bilinear", align_corners=False) 29 | result["out"] = x 30 | 31 | if self.aux_classifier is not None: 32 | x = features["aux"] 33 | x = self.aux_classifier(x) 34 | x = F.interpolate(x, size=input_shape, mode="bilinear", align_corners=False) 35 | result["aux"] = x 36 | 37 | return result 38 | -------------------------------------------------------------------------------- /torchvision/models/video/__init__.py: -------------------------------------------------------------------------------- 1 | from .mvit import * 2 | from .resnet import * 3 | from .s3d import * 4 | from .swin_transformer import * 5 | -------------------------------------------------------------------------------- /torchvision/prototype/__init__.py: -------------------------------------------------------------------------------- 1 | from . import models, transforms, tv_tensors, utils 2 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/README.md: -------------------------------------------------------------------------------- 1 | # Status of prototype datasets 2 | 3 | These prototype datasets are based on [torchdata](https://github.com/pytorch/data)'s datapipes. Torchdata 4 | development [is 5 | paused](https://github.com/pytorch/data/#torchdata-see-note-below-on-current-status) 6 | as of July 2023, so we are not actively maintaining this module. There is no 7 | estimated date for a stable release of these datasets. 8 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | import torchdata 3 | except ModuleNotFoundError: 4 | raise ModuleNotFoundError( 5 | "`torchvision.prototype.datasets` depends on PyTorch's `torchdata` (https://github.com/pytorch/data). " 6 | "You can install it with `pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu" 7 | ) from None 8 | 9 | from . import utils 10 | from ._home import home 11 | 12 | # Load this last, since some parts depend on the above being loaded first 13 | from ._api import list_datasets, info, load, register_info, register_dataset # usort: skip 14 | from ._folder import from_data_folder, from_image_folder 15 | from ._builtin import * 16 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/__init__.py: -------------------------------------------------------------------------------- 1 | from .caltech import Caltech101, Caltech256 2 | from .celeba import CelebA 3 | from .cifar import Cifar10, Cifar100 4 | from .clevr import CLEVR 5 | from .coco import Coco 6 | from .country211 import Country211 7 | from .cub200 import CUB200 8 | from .dtd import DTD 9 | from .eurosat import EuroSAT 10 | from .fer2013 import FER2013 11 | from .food101 import Food101 12 | from .gtsrb import GTSRB 13 | from .imagenet import ImageNet 14 | from .mnist import EMNIST, FashionMNIST, KMNIST, MNIST, QMNIST 15 | from .oxford_iiit_pet import OxfordIIITPet 16 | from .pcam import PCAM 17 | from .sbd import SBD 18 | from .semeion import SEMEION 19 | from .stanford_cars import StanfordCars 20 | from .svhn import SVHN 21 | from .usps import USPS 22 | from .voc import VOC 23 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/cifar10.categories: -------------------------------------------------------------------------------- 1 | airplane 2 | automobile 3 | bird 4 | cat 5 | deer 6 | dog 7 | frog 8 | horse 9 | ship 10 | truck 11 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/cifar100.categories: -------------------------------------------------------------------------------- 1 | apple 2 | aquarium_fish 3 | baby 4 | bear 5 | beaver 6 | bed 7 | bee 8 | beetle 9 | bicycle 10 | bottle 11 | bowl 12 | boy 13 | bridge 14 | bus 15 | butterfly 16 | camel 17 | can 18 | castle 19 | caterpillar 20 | cattle 21 | chair 22 | chimpanzee 23 | clock 24 | cloud 25 | cockroach 26 | couch 27 | crab 28 | crocodile 29 | cup 30 | dinosaur 31 | dolphin 32 | elephant 33 | flatfish 34 | forest 35 | fox 36 | girl 37 | hamster 38 | house 39 | kangaroo 40 | keyboard 41 | lamp 42 | lawn_mower 43 | leopard 44 | lion 45 | lizard 46 | lobster 47 | man 48 | maple_tree 49 | motorcycle 50 | mountain 51 | mouse 52 | mushroom 53 | oak_tree 54 | orange 55 | orchid 56 | otter 57 | palm_tree 58 | pear 59 | pickup_truck 60 | pine_tree 61 | plain 62 | plate 63 | poppy 64 | porcupine 65 | possum 66 | rabbit 67 | raccoon 68 | ray 69 | road 70 | rocket 71 | rose 72 | sea 73 | seal 74 | shark 75 | shrew 76 | skunk 77 | skyscraper 78 | snail 79 | snake 80 | spider 81 | squirrel 82 | streetcar 83 | sunflower 84 | sweet_pepper 85 | table 86 | tank 87 | telephone 88 | television 89 | tiger 90 | tractor 91 | train 92 | trout 93 | tulip 94 | turtle 95 | wardrobe 96 | whale 97 | willow_tree 98 | wolf 99 | woman 100 | worm 101 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/dtd.categories: -------------------------------------------------------------------------------- 1 | banded 2 | blotchy 3 | braided 4 | bubbly 5 | bumpy 6 | chequered 7 | cobwebbed 8 | cracked 9 | crosshatched 10 | crystalline 11 | dotted 12 | fibrous 13 | flecked 14 | freckled 15 | frilly 16 | gauzy 17 | grid 18 | grooved 19 | honeycombed 20 | interlaced 21 | knitted 22 | lacelike 23 | lined 24 | marbled 25 | matted 26 | meshed 27 | paisley 28 | perforated 29 | pitted 30 | pleated 31 | polka-dotted 32 | porous 33 | potholed 34 | scaly 35 | smeared 36 | spiralled 37 | sprinkled 38 | stained 39 | stratified 40 | striped 41 | studded 42 | swirly 43 | veined 44 | waffled 45 | woven 46 | wrinkled 47 | zigzagged 48 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/oxford-iiit-pet.categories: -------------------------------------------------------------------------------- 1 | Abyssinian 2 | American Bulldog 3 | American Pit Bull Terrier 4 | Basset Hound 5 | Beagle 6 | Bengal 7 | Birman 8 | Bombay 9 | Boxer 10 | British Shorthair 11 | Chihuahua 12 | Egyptian Mau 13 | English Cocker Spaniel 14 | English Setter 15 | German Shorthaired 16 | Great Pyrenees 17 | Havanese 18 | Japanese Chin 19 | Keeshond 20 | Leonberger 21 | Maine Coon 22 | Miniature Pinscher 23 | Newfoundland 24 | Persian 25 | Pomeranian 26 | Pug 27 | Ragdoll 28 | Russian Blue 29 | Saint Bernard 30 | Samoyed 31 | Scottish Terrier 32 | Shiba Inu 33 | Siamese 34 | Sphynx 35 | Staffordshire Bull Terrier 36 | Wheaten Terrier 37 | Yorkshire Terrier 38 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/sbd.categories: -------------------------------------------------------------------------------- 1 | aeroplane 2 | bicycle 3 | bird 4 | boat 5 | bottle 6 | bus 7 | car 8 | cat 9 | chair 10 | cow 11 | diningtable 12 | dog 13 | horse 14 | motorbike 15 | person 16 | pottedplant 17 | sheep 18 | sofa 19 | train 20 | tvmonitor 21 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_builtin/voc.categories: -------------------------------------------------------------------------------- 1 | __background__ 2 | aeroplane 3 | bicycle 4 | bird 5 | boat 6 | bottle 7 | bus 8 | car 9 | cat 10 | chair 11 | cow 12 | diningtable 13 | dog 14 | horse 15 | motorbike 16 | person 17 | pottedplant 18 | sheep 19 | sofa 20 | train 21 | tvmonitor 22 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/_home.py: -------------------------------------------------------------------------------- 1 | import os 2 | from typing import Optional 3 | 4 | import torchvision._internally_replaced_utils as _iru 5 | 6 | 7 | def home(root: Optional[str] = None) -> str: 8 | if root is not None: 9 | _iru._HOME = root 10 | return _iru._HOME 11 | 12 | root = os.getenv("TORCHVISION_DATASETS_HOME") 13 | if root is not None: 14 | return root 15 | 16 | return _iru._HOME 17 | 18 | 19 | def use_sharded_dataset(use: Optional[bool] = None) -> bool: 20 | if use is not None: 21 | _iru._USE_SHARDED_DATASETS = use 22 | return _iru._USE_SHARDED_DATASETS 23 | 24 | use = os.getenv("TORCHVISION_SHARDED_DATASETS") 25 | if use is not None: 26 | return use == "1" 27 | 28 | return _iru._USE_SHARDED_DATASETS 29 | -------------------------------------------------------------------------------- /torchvision/prototype/datasets/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import _internal # usort: skip 2 | from ._dataset import Dataset 3 | from ._encoded import EncodedData, EncodedImage 4 | from ._resource import GDriveResource, HttpResource, KaggleDownloadResource, ManualDownloadResource, OnlineResource 5 | -------------------------------------------------------------------------------- /torchvision/prototype/models/__init__.py: -------------------------------------------------------------------------------- 1 | from . import depth 2 | -------------------------------------------------------------------------------- /torchvision/prototype/models/depth/__init__.py: -------------------------------------------------------------------------------- 1 | from . import stereo 2 | -------------------------------------------------------------------------------- /torchvision/prototype/models/depth/stereo/__init__.py: -------------------------------------------------------------------------------- 1 | from .raft_stereo import * 2 | from .crestereo import * 3 | -------------------------------------------------------------------------------- /torchvision/prototype/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | from ._presets import StereoMatching # usort: skip 2 | 3 | from ._augment import SimpleCopyPaste 4 | from ._geometry import FixedSizeCrop 5 | from ._misc import PermuteDimensions, TransposeDimensions 6 | from ._type_conversion import LabelToOneHot 7 | -------------------------------------------------------------------------------- /torchvision/prototype/transforms/_type_conversion.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import torch 4 | 5 | from torch.nn.functional import one_hot 6 | 7 | from torchvision.prototype import tv_tensors as proto_tv_tensors 8 | from torchvision.transforms.v2 import Transform 9 | 10 | 11 | class LabelToOneHot(Transform): 12 | _transformed_types = (proto_tv_tensors.Label,) 13 | 14 | def __init__(self, num_categories: int = -1): 15 | super().__init__() 16 | self.num_categories = num_categories 17 | 18 | def transform(self, inpt: proto_tv_tensors.Label, params: dict[str, Any]) -> proto_tv_tensors.OneHotLabel: 19 | num_categories = self.num_categories 20 | if num_categories == -1 and inpt.categories is not None: 21 | num_categories = len(inpt.categories) 22 | output = one_hot(inpt.as_subclass(torch.Tensor), num_classes=num_categories) 23 | return proto_tv_tensors.OneHotLabel(output, categories=inpt.categories) 24 | 25 | def extra_repr(self) -> str: 26 | if self.num_categories == -1: 27 | return "" 28 | 29 | return f"num_categories={self.num_categories}" 30 | -------------------------------------------------------------------------------- /torchvision/prototype/tv_tensors/__init__.py: -------------------------------------------------------------------------------- 1 | from ._label import Label, OneHotLabel 2 | -------------------------------------------------------------------------------- /torchvision/prototype/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import _internal 2 | -------------------------------------------------------------------------------- /torchvision/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | from .transforms import * 2 | from .autoaugment import * 3 | -------------------------------------------------------------------------------- /torchvision/transforms/v2/_temporal.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import torch 4 | from torchvision.transforms.v2 import functional as F, Transform 5 | 6 | 7 | class UniformTemporalSubsample(Transform): 8 | """Uniformly subsample ``num_samples`` indices from the temporal dimension of the video. 9 | 10 | Videos are expected to be of shape ``[..., T, C, H, W]`` where ``T`` denotes the temporal dimension. 11 | 12 | When ``num_samples`` is larger than the size of temporal dimension of the video, it 13 | will sample frames based on nearest neighbor interpolation. 14 | 15 | Args: 16 | num_samples (int): The number of equispaced samples to be selected 17 | """ 18 | 19 | _transformed_types = (torch.Tensor,) 20 | 21 | def __init__(self, num_samples: int): 22 | super().__init__() 23 | self.num_samples = num_samples 24 | 25 | def transform(self, inpt: Any, params: dict[str, Any]) -> Any: 26 | return self._call_kernel(F.uniform_temporal_subsample, inpt, self.num_samples) 27 | -------------------------------------------------------------------------------- /torchvision/transforms/v2/functional/_deprecated.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | from typing import Any 3 | 4 | import torch 5 | 6 | from torchvision.transforms import functional as _F 7 | 8 | 9 | @torch.jit.unused 10 | def to_tensor(inpt: Any) -> torch.Tensor: 11 | """[DEPREACTED] Use to_image() and to_dtype() instead.""" 12 | warnings.warn( 13 | "The function `to_tensor(...)` is deprecated and will be removed in a future release. " 14 | "Instead, please use `to_image(...)` followed by `to_dtype(..., dtype=torch.float32, scale=True)`." 15 | ) 16 | return _F.to_tensor(inpt) 17 | 18 | 19 | def get_image_size(inpt: torch.Tensor) -> list[int]: 20 | warnings.warn( 21 | "The function `get_image_size(...)` is deprecated and will be removed in a future release. " 22 | "Instead, please use `get_size(...)` which returns `[h, w]` instead of `[w, h]`." 23 | ) 24 | return _F.get_image_size(inpt) 25 | -------------------------------------------------------------------------------- /torchvision/transforms/v2/functional/_temporal.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | from torchvision import tv_tensors 4 | 5 | from torchvision.utils import _log_api_usage_once 6 | 7 | from ._utils import _get_kernel, _register_kernel_internal 8 | 9 | 10 | def uniform_temporal_subsample(inpt: torch.Tensor, num_samples: int) -> torch.Tensor: 11 | """See :class:`~torchvision.transforms.v2.UniformTemporalSubsample` for details.""" 12 | if torch.jit.is_scripting(): 13 | return uniform_temporal_subsample_video(inpt, num_samples=num_samples) 14 | 15 | _log_api_usage_once(uniform_temporal_subsample) 16 | 17 | kernel = _get_kernel(uniform_temporal_subsample, type(inpt)) 18 | return kernel(inpt, num_samples=num_samples) 19 | 20 | 21 | @_register_kernel_internal(uniform_temporal_subsample, torch.Tensor) 22 | @_register_kernel_internal(uniform_temporal_subsample, tv_tensors.Video) 23 | def uniform_temporal_subsample_video(video: torch.Tensor, num_samples: int) -> torch.Tensor: 24 | # Reference: https://github.com/facebookresearch/pytorchvideo/blob/a0a131e/pytorchvideo/transforms/functional.py#L19 25 | t_max = video.shape[-4] - 1 26 | indices = torch.linspace(0, t_max, num_samples, device=video.device).long() 27 | return torch.index_select(video, -4, indices) 28 | -------------------------------------------------------------------------------- /torchvision/transforms/v2/functional/_type_conversion.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | 3 | import numpy as np 4 | import PIL.Image 5 | import torch 6 | from torchvision import tv_tensors 7 | from torchvision.transforms import functional as _F 8 | 9 | 10 | @torch.jit.unused 11 | def to_image(inpt: Union[torch.Tensor, PIL.Image.Image, np.ndarray]) -> tv_tensors.Image: 12 | """See :class:`~torchvision.transforms.v2.ToImage` for details.""" 13 | if isinstance(inpt, np.ndarray): 14 | output = torch.from_numpy(np.atleast_3d(inpt)).permute((2, 0, 1)).contiguous() 15 | elif isinstance(inpt, PIL.Image.Image): 16 | output = pil_to_tensor(inpt) 17 | elif isinstance(inpt, torch.Tensor): 18 | output = inpt 19 | else: 20 | raise TypeError( 21 | f"Input can either be a pure Tensor, a numpy array, or a PIL image, but got {type(inpt)} instead." 22 | ) 23 | return tv_tensors.Image(output) 24 | 25 | 26 | to_pil_image = _F.to_pil_image 27 | pil_to_tensor = _F.pil_to_tensor 28 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 0.25.0a0 2 | --------------------------------------------------------------------------------