Copy disabled (too large)
Download .txt
Showing preview only (21,496K chars total). Download the full file to get everything.
Repository: liuff19/LangScene-X
Branch: main
Commit: f91eaedf97d8
Files: 1984
Total size: 20.0 MB
Directory structure:
gitextract_u3gvlex3/
├── .gitignore
├── LICENSE
├── README.md
├── auto-seg/
│ ├── auto-mask-align.py
│ ├── sam2/
│ │ ├── __init__.py
│ │ ├── automatic_mask_generator.py
│ │ ├── build_sam.py
│ │ ├── csrc/
│ │ │ └── connected_components.cu
│ │ ├── modeling/
│ │ │ ├── __init__.py
│ │ │ ├── backbones/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── hieradet.py
│ │ │ │ ├── image_encoder.py
│ │ │ │ └── utils.py
│ │ │ ├── memory_attention.py
│ │ │ ├── memory_encoder.py
│ │ │ ├── position_encoding.py
│ │ │ ├── sam/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mask_decoder.py
│ │ │ │ ├── prompt_encoder.py
│ │ │ │ └── transformer.py
│ │ │ ├── sam2_base.py
│ │ │ └── sam2_utils.py
│ │ ├── sam2_image_predictor.py
│ │ ├── sam2_video_predictor.py
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── amg.py
│ │ ├── misc.py
│ │ └── transforms.py
│ ├── sam2_configs/
│ │ ├── __init__.py
│ │ ├── sam2_hiera_b+.yaml
│ │ ├── sam2_hiera_l.yaml
│ │ ├── sam2_hiera_s.yaml
│ │ └── sam2_hiera_t.yaml
│ ├── sam2_hiera_l.yaml
│ └── submodules/
│ ├── segment-anything-1/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── scripts/
│ │ │ ├── amg.py
│ │ │ └── export_onnx_model.py
│ │ ├── segment_anything/
│ │ │ ├── __init__.py
│ │ │ ├── automatic_mask_generator.py
│ │ │ ├── build_sam.py
│ │ │ ├── modeling/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── common.py
│ │ │ │ ├── image_encoder.py
│ │ │ │ ├── mask_decoder.py
│ │ │ │ ├── prompt_encoder.py
│ │ │ │ ├── sam.py
│ │ │ │ └── transformer.py
│ │ │ ├── predictor.py
│ │ │ └── utils/
│ │ │ ├── __init__.py
│ │ │ ├── amg.py
│ │ │ ├── onnx.py
│ │ │ └── transforms.py
│ │ ├── setup.cfg
│ │ └── setup.py
│ └── segment-anything-2/
│ ├── .clang-format
│ ├── .gitignore
│ ├── .watchmanconfig
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── INSTALL.md
│ ├── LICENSE
│ ├── LICENSE_cctorch
│ ├── MANIFEST.in
│ ├── README.md
│ ├── backend.Dockerfile
│ ├── checkpoints/
│ │ └── download_ckpts.sh
│ ├── demo/
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── backend/
│ │ │ └── server/
│ │ │ ├── app.py
│ │ │ ├── app_conf.py
│ │ │ └── inference/
│ │ │ ├── data_types.py
│ │ │ ├── multipart.py
│ │ │ └── predictor.py
│ │ └── frontend/
│ │ ├── .babelrc
│ │ ├── .dockerignore
│ │ ├── .eslintignore
│ │ ├── .eslintrc.cjs
│ │ ├── .gitignore
│ │ ├── .prettierignore
│ │ ├── .prettierrc.json
│ │ ├── .watchmanconfig
│ │ ├── frontend.Dockerfile
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── postcss.config.js
│ │ ├── schema.graphql
│ │ ├── schemas/
│ │ │ ├── inference-api-schema.graphql
│ │ │ ├── merge-schemas.ts
│ │ │ └── video-api-schema.graphql
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ ├── assets/
│ │ │ │ └── scss/
│ │ │ │ └── App.scss
│ │ │ ├── common/
│ │ │ │ ├── codecs/
│ │ │ │ │ ├── VideoDecoder.ts
│ │ │ │ │ ├── VideoEncoder.ts
│ │ │ │ │ └── WebCodecUtils.ts
│ │ │ │ ├── components/
│ │ │ │ │ ├── MobileFirstClickBanner.tsx
│ │ │ │ │ ├── Tooltip.tsx
│ │ │ │ │ ├── annotations/
│ │ │ │ │ │ ├── AddObjectButton.tsx
│ │ │ │ │ │ ├── ClearAllPointsInVideoButton.tsx
│ │ │ │ │ │ ├── CloseSessionButton.tsx
│ │ │ │ │ │ ├── FirstClickView.tsx
│ │ │ │ │ │ ├── LimitNotice.tsx
│ │ │ │ │ │ ├── MobileObjectsList.tsx
│ │ │ │ │ │ ├── MobileObjectsToolbar.tsx
│ │ │ │ │ │ ├── MobileObjectsToolbarHeader.tsx
│ │ │ │ │ │ ├── ObjectActions.tsx
│ │ │ │ │ │ ├── ObjectPlaceholder.tsx
│ │ │ │ │ │ ├── ObjectThumbnail.tsx
│ │ │ │ │ │ ├── ObjectUtils.ts
│ │ │ │ │ │ ├── ObjectsToolbar.tsx
│ │ │ │ │ │ ├── ObjectsToolbarBottomActions.tsx
│ │ │ │ │ │ ├── ObjectsToolbarHeader.tsx
│ │ │ │ │ │ ├── PointsToggle.tsx
│ │ │ │ │ │ ├── PrimaryCTAButton.tsx
│ │ │ │ │ │ ├── ToolbarObject.tsx
│ │ │ │ │ │ ├── ToolbarObjectContainer.tsx
│ │ │ │ │ │ ├── TrackletSwimlane.tsx
│ │ │ │ │ │ ├── TrackletsAnnotation.tsx
│ │ │ │ │ │ └── useTracklets.ts
│ │ │ │ │ ├── button/
│ │ │ │ │ │ ├── GradientBorder.tsx
│ │ │ │ │ │ ├── PlaybackButton.tsx
│ │ │ │ │ │ ├── PrimaryCTAButton.tsx
│ │ │ │ │ │ ├── ResponsiveButton.tsx
│ │ │ │ │ │ └── TrackAndPlayButton.tsx
│ │ │ │ │ ├── code/
│ │ │ │ │ │ └── InitializeLocalMonaco.ts
│ │ │ │ │ ├── effects/
│ │ │ │ │ │ ├── BackgroundEffects.tsx
│ │ │ │ │ │ ├── EffectVariantBadge.tsx
│ │ │ │ │ │ ├── EffectsCarousel.tsx
│ │ │ │ │ │ ├── EffectsCarouselShadow.tsx
│ │ │ │ │ │ ├── EffectsToolbar.tsx
│ │ │ │ │ │ ├── EffectsToolbarBottomActions.tsx
│ │ │ │ │ │ ├── EffectsToolbarHeader.tsx
│ │ │ │ │ │ ├── EffectsUtils.ts
│ │ │ │ │ │ ├── HighlightEffects.tsx
│ │ │ │ │ │ ├── MobileEffectsToolbar.tsx
│ │ │ │ │ │ └── MoreFunEffects.tsx
│ │ │ │ │ ├── gallery/
│ │ │ │ │ │ ├── ChangeVideoModal.tsx
│ │ │ │ │ │ ├── DefaultVideoGalleryModalTrigger.tsx
│ │ │ │ │ │ ├── DemoVideoGallery.tsx
│ │ │ │ │ │ ├── DemoVideoGalleryModal.tsx
│ │ │ │ │ │ ├── VideoGalleryUploadPhoto.tsx
│ │ │ │ │ │ ├── VideoPhoto.tsx
│ │ │ │ │ │ ├── __generated__/
│ │ │ │ │ │ │ ├── DemoVideoGalleryModalQuery.graphql.ts
│ │ │ │ │ │ │ ├── DemoVideoGalleryQuery.graphql.ts
│ │ │ │ │ │ │ └── useUploadVideoMutation.graphql.ts
│ │ │ │ │ │ └── useUploadVideo.ts
│ │ │ │ │ ├── icons/
│ │ │ │ │ │ └── GitHubIcon.tsx
│ │ │ │ │ ├── options/
│ │ │ │ │ │ ├── DownloadOption.tsx
│ │ │ │ │ │ ├── GalleryOption.tsx
│ │ │ │ │ │ ├── MoreOptionsToolbar.tsx
│ │ │ │ │ │ ├── MoreOptionsToolbarBottomActions.tsx
│ │ │ │ │ │ ├── OptionButton.tsx
│ │ │ │ │ │ ├── ShareSection.tsx
│ │ │ │ │ │ ├── ShareUtils.ts
│ │ │ │ │ │ ├── TryAnotherVideoSection.tsx
│ │ │ │ │ │ ├── UploadOption.tsx
│ │ │ │ │ │ ├── __generated__/
│ │ │ │ │ │ │ └── GetLinkOptionShareVideoMutation.graphql.ts
│ │ │ │ │ │ └── useDownloadVideo.ts
│ │ │ │ │ ├── session/
│ │ │ │ │ │ ├── RestartSessionButton.tsx
│ │ │ │ │ │ ├── __generated__/
│ │ │ │ │ │ │ └── useCloseSessionBeforeUnloadMutation.graphql.ts
│ │ │ │ │ │ ├── useCloseSessionBeforeUnload.ts
│ │ │ │ │ │ └── useRestartSession.ts
│ │ │ │ │ ├── snackbar/
│ │ │ │ │ │ ├── DemoMessagesSnackbarUtils.ts
│ │ │ │ │ │ ├── MessagesSnackbar.tsx
│ │ │ │ │ │ ├── snackbarAtoms.ts
│ │ │ │ │ │ ├── useDemoMessagesSnackbar.ts
│ │ │ │ │ │ ├── useExpireMessage.ts
│ │ │ │ │ │ └── useMessagesSnackbar.ts
│ │ │ │ │ ├── toolbar/
│ │ │ │ │ │ ├── DesktopToolbar.tsx
│ │ │ │ │ │ ├── MobileToolbar.tsx
│ │ │ │ │ │ ├── Toolbar.tsx
│ │ │ │ │ │ ├── ToolbarActionIcon.tsx
│ │ │ │ │ │ ├── ToolbarBottomActionsWrapper.tsx
│ │ │ │ │ │ ├── ToolbarConfig.tsx
│ │ │ │ │ │ ├── ToolbarHeaderWrapper.tsx
│ │ │ │ │ │ ├── ToolbarProgressChip.tsx
│ │ │ │ │ │ ├── ToolbarSection.tsx
│ │ │ │ │ │ ├── useListenToStreamingState.ts
│ │ │ │ │ │ └── useToolbarTabs.ts
│ │ │ │ │ ├── useFunctionThrottle.tsx
│ │ │ │ │ └── video/
│ │ │ │ │ ├── ChangeVideoModal.tsx
│ │ │ │ │ ├── EventEmitter.ts
│ │ │ │ │ ├── Video.tsx
│ │ │ │ │ ├── VideoFilmstripWithPlayback.tsx
│ │ │ │ │ ├── VideoLoadingOverlay.tsx
│ │ │ │ │ ├── VideoWorker.ts
│ │ │ │ │ ├── VideoWorkerBridge.ts
│ │ │ │ │ ├── VideoWorkerContext.ts
│ │ │ │ │ ├── VideoWorkerTypes.ts
│ │ │ │ │ ├── editor/
│ │ │ │ │ │ ├── DemoVideoEditor.tsx
│ │ │ │ │ │ ├── ImageUtils.ts
│ │ │ │ │ │ ├── VideoEditor.tsx
│ │ │ │ │ │ ├── VideoEditorUtils.ts
│ │ │ │ │ │ ├── atoms.ts
│ │ │ │ │ │ ├── useResetEditor.ts
│ │ │ │ │ │ ├── useVideo.ts
│ │ │ │ │ │ └── useVideoEffect.ts
│ │ │ │ │ ├── effects/
│ │ │ │ │ │ ├── ArrowGLEffect.ts
│ │ │ │ │ │ ├── BackgroundBlurEffect.ts
│ │ │ │ │ │ ├── BackgroundTextEffect.ts
│ │ │ │ │ │ ├── BaseGLEffect.ts
│ │ │ │ │ │ ├── BurstGLEffect.ts
│ │ │ │ │ │ ├── CutoutGLEffect.ts
│ │ │ │ │ │ ├── DesaturateEffect.ts
│ │ │ │ │ │ ├── Effect.ts
│ │ │ │ │ │ ├── EffectUtils.ts
│ │ │ │ │ │ ├── Effects.ts
│ │ │ │ │ │ ├── EraseBackgroundEffect.ts
│ │ │ │ │ │ ├── EraseForegroundEffect.ts
│ │ │ │ │ │ ├── EraseForegroundGLEffect.ts
│ │ │ │ │ │ ├── GradientEffect.ts
│ │ │ │ │ │ ├── NoisyMaskEffect.ts
│ │ │ │ │ │ ├── OriginalEffect.ts
│ │ │ │ │ │ ├── OverlayEffect.ts
│ │ │ │ │ │ ├── PixelateEffect.ts
│ │ │ │ │ │ ├── PixelateMaskGLEffect.ts
│ │ │ │ │ │ ├── ReplaceGLEffect.ts
│ │ │ │ │ │ ├── ScopeGLEffect.ts
│ │ │ │ │ │ ├── SobelEffect.ts
│ │ │ │ │ │ ├── VibrantMaskEffect.ts
│ │ │ │ │ │ └── shaders/
│ │ │ │ │ │ ├── Arrow.frag
│ │ │ │ │ │ ├── BackgroundBlur.frag
│ │ │ │ │ │ ├── Burst.frag
│ │ │ │ │ │ ├── Cutout.frag
│ │ │ │ │ │ ├── DefaultVert.vert
│ │ │ │ │ │ ├── EraseForeground.frag
│ │ │ │ │ │ ├── Gradient.frag
│ │ │ │ │ │ ├── NoisyMask.frag
│ │ │ │ │ │ ├── Overlay.frag
│ │ │ │ │ │ ├── Overlay.vert
│ │ │ │ │ │ ├── Pixelate.frag
│ │ │ │ │ │ ├── PixelateMask.frag
│ │ │ │ │ │ ├── Replace.frag
│ │ │ │ │ │ ├── Scope.frag
│ │ │ │ │ │ ├── Sobel.frag
│ │ │ │ │ │ └── VibrantMask.frag
│ │ │ │ │ ├── filmstrip/
│ │ │ │ │ │ ├── FilmstripUtil.tsx
│ │ │ │ │ │ ├── SelectedFrameHelper.ts
│ │ │ │ │ │ ├── VideoFilmstrip.tsx
│ │ │ │ │ │ ├── atoms.ts
│ │ │ │ │ │ ├── useDisableScrolling.ts
│ │ │ │ │ │ └── useSelectedFrameHelper.ts
│ │ │ │ │ ├── layers/
│ │ │ │ │ │ ├── InteractionLayer.tsx
│ │ │ │ │ │ └── PointsLayer.tsx
│ │ │ │ │ ├── useInputVideo.ts
│ │ │ │ │ └── useVideoWorker.ts
│ │ │ │ ├── error/
│ │ │ │ │ ├── ErrorFallback.tsx
│ │ │ │ │ ├── ErrorReport.tsx
│ │ │ │ │ ├── ErrorSerializationUtils.ts
│ │ │ │ │ ├── ErrorUtils.ts
│ │ │ │ │ ├── errorReportAtom.ts
│ │ │ │ │ └── useReportError.tsx
│ │ │ │ ├── loading/
│ │ │ │ │ ├── LoadingMessage.tsx
│ │ │ │ │ ├── LoadingStateScreen.tsx
│ │ │ │ │ ├── StaticVideoPlayer.tsx
│ │ │ │ │ └── UploadLoadingScreen.tsx
│ │ │ │ ├── logger/
│ │ │ │ │ ├── DemoLogger.ts
│ │ │ │ │ ├── LogEnvironment.ts
│ │ │ │ │ └── Logger.ts
│ │ │ │ ├── screen/
│ │ │ │ │ └── useScreenSize.tsx
│ │ │ │ ├── tracker/
│ │ │ │ │ ├── SAM2Model.ts
│ │ │ │ │ ├── Tracker.ts
│ │ │ │ │ ├── TrackerTypes.ts
│ │ │ │ │ ├── Trackers.ts
│ │ │ │ │ └── __generated__/
│ │ │ │ │ ├── SAM2ModelAddNewPointsMutation.graphql.ts
│ │ │ │ │ ├── SAM2ModelCancelPropagateInVideoMutation.graphql.ts
│ │ │ │ │ ├── SAM2ModelClearPointsInFrameMutation.graphql.ts
│ │ │ │ │ ├── SAM2ModelClearPointsInVideoMutation.graphql.ts
│ │ │ │ │ ├── SAM2ModelCloseSessionMutation.graphql.ts
│ │ │ │ │ ├── SAM2ModelRemoveObjectMutation.graphql.ts
│ │ │ │ │ └── SAM2ModelStartSessionMutation.graphql.ts
│ │ │ │ └── utils/
│ │ │ │ ├── FileUtils.ts
│ │ │ │ ├── ImageUtils.ts
│ │ │ │ ├── MaskUtils.ts
│ │ │ │ ├── MultipartStream.ts
│ │ │ │ ├── ShaderUtils.ts
│ │ │ │ ├── emptyFunction.ts
│ │ │ │ └── uuid.ts
│ │ │ ├── debug/
│ │ │ │ └── stats/
│ │ │ │ ├── Stats.ts
│ │ │ │ └── StatsView.tsx
│ │ │ ├── demo/
│ │ │ │ ├── DemoConfig.tsx
│ │ │ │ ├── DemoErrorFallback.tsx
│ │ │ │ ├── DemoSuspenseFallback.tsx
│ │ │ │ ├── SAM2DemoApp.tsx
│ │ │ │ └── atoms.ts
│ │ │ ├── graphql/
│ │ │ │ ├── RelayEnvironment.ts
│ │ │ │ ├── RelayEnvironmentProvider.tsx
│ │ │ │ ├── errors/
│ │ │ │ │ ├── CreateFilmstripError.ts
│ │ │ │ │ ├── DrawFrameError.ts
│ │ │ │ │ └── WebGLContextError.ts
│ │ │ │ └── fetchGraphQL.ts
│ │ │ ├── jscocotools/
│ │ │ │ └── mask.ts
│ │ │ ├── layouts/
│ │ │ │ ├── DemoPageLayout.tsx
│ │ │ │ └── RootLayout.tsx
│ │ │ ├── routes/
│ │ │ │ ├── DemoPage.tsx
│ │ │ │ ├── DemoPageWrapper.tsx
│ │ │ │ ├── PageNotFoundPage.tsx
│ │ │ │ └── __generated__/
│ │ │ │ └── DemoPageQuery.graphql.ts
│ │ │ ├── settings/
│ │ │ │ ├── ApprovableInput.tsx
│ │ │ │ ├── SAM2Settings.tsx
│ │ │ │ ├── SettingsContextProvider.tsx
│ │ │ │ ├── SettingsModal.tsx
│ │ │ │ ├── SettingsReducer.ts
│ │ │ │ └── useSettingsContext.tsx
│ │ │ ├── theme/
│ │ │ │ ├── colors.ts
│ │ │ │ ├── gradientStyle.ts
│ │ │ │ └── tokens.stylex.ts
│ │ │ ├── types/
│ │ │ │ └── mp4box/
│ │ │ │ └── index.d.ts
│ │ │ └── vite-env.d.ts
│ │ ├── tailwind.config.js
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ ├── docker-compose.yaml
│ ├── pyproject.toml
│ ├── sam2/
│ │ ├── __init__.py
│ │ ├── automatic_mask_generator.py
│ │ ├── build_sam.py
│ │ ├── configs/
│ │ │ ├── sam2/
│ │ │ │ ├── sam2_hiera_b+.yaml
│ │ │ │ ├── sam2_hiera_l.yaml
│ │ │ │ ├── sam2_hiera_s.yaml
│ │ │ │ └── sam2_hiera_t.yaml
│ │ │ ├── sam2.1/
│ │ │ │ ├── sam2.1_hiera_b+.yaml
│ │ │ │ ├── sam2.1_hiera_l.yaml
│ │ │ │ ├── sam2.1_hiera_s.yaml
│ │ │ │ └── sam2.1_hiera_t.yaml
│ │ │ └── sam2.1_training/
│ │ │ └── sam2.1_hiera_b+_MOSE_finetune.yaml
│ │ ├── csrc/
│ │ │ └── connected_components.cu
│ │ ├── modeling/
│ │ │ ├── __init__.py
│ │ │ ├── backbones/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── hieradet.py
│ │ │ │ ├── image_encoder.py
│ │ │ │ └── utils.py
│ │ │ ├── memory_attention.py
│ │ │ ├── memory_encoder.py
│ │ │ ├── position_encoding.py
│ │ │ ├── sam/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── mask_decoder.py
│ │ │ │ ├── prompt_encoder.py
│ │ │ │ └── transformer.py
│ │ │ ├── sam2_base.py
│ │ │ └── sam2_utils.py
│ │ ├── sam2_image_predictor.py
│ │ ├── sam2_video_predictor.py
│ │ ├── sam2_video_predictor_legacy.py
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── amg.py
│ │ ├── misc.py
│ │ └── transforms.py
│ ├── sav_dataset/
│ │ ├── LICENSE
│ │ ├── LICENSE_DAVIS
│ │ ├── LICENSE_VOS_BENCHMARK
│ │ ├── README.md
│ │ ├── example/
│ │ │ ├── sav_000001_auto.json
│ │ │ └── sav_000001_manual.json
│ │ ├── requirements.txt
│ │ ├── sav_evaluator.py
│ │ ├── sav_visualization_example.ipynb
│ │ └── utils/
│ │ └── sav_utils.py
│ ├── setup.py
│ ├── tools/
│ │ ├── README.md
│ │ └── vos_inference.py
│ └── training/
│ ├── README.md
│ ├── __init__.py
│ ├── assets/
│ │ ├── MOSE_sample_train_list.txt
│ │ └── MOSE_sample_val_list.txt
│ ├── dataset/
│ │ ├── __init__.py
│ │ ├── sam2_datasets.py
│ │ ├── transforms.py
│ │ ├── utils.py
│ │ ├── vos_dataset.py
│ │ ├── vos_raw_dataset.py
│ │ ├── vos_sampler.py
│ │ └── vos_segment_loader.py
│ ├── loss_fns.py
│ ├── model/
│ │ └── __init__.py
│ ├── optimizer.py
│ ├── scripts/
│ │ └── sav_frame_extraction_submitit.py
│ ├── train.py
│ ├── trainer.py
│ └── utils/
│ ├── __init__.py
│ ├── checkpoint_utils.py
│ ├── data_utils.py
│ ├── distributed.py
│ ├── logger.py
│ └── train_utils.py
├── cogvideox_interpolation/
│ ├── datasets.py
│ ├── losses.py
│ ├── lpips.py
│ ├── pipeline.py
│ └── utils/
│ ├── colormaps.py
│ ├── colors.py
│ ├── config_utils.py
│ └── misc.py
├── configs/
│ ├── field_construction.yaml
│ ├── test_config.py
│ ├── unet_config_c16.py
│ └── unet_config_c32.py
├── entry_point.py
├── field_construction/
│ ├── auto_encoder.py
│ ├── extract_with_openseg.py
│ ├── gaussian_field.py
│ ├── gaussian_renderer/
│ │ ├── __init__.py
│ │ └── network_gui.py
│ ├── lpipsPyTorch/
│ │ ├── __init__.py
│ │ └── modules/
│ │ ├── lpips.py
│ │ ├── networks.py
│ │ └── utils.py
│ ├── pipeline.py
│ ├── pose_estimator/
│ │ ├── __init__.py
│ │ └── utils.py
│ ├── preprocessor.py
│ ├── scene/
│ │ ├── __init__.py
│ │ ├── app_model.py
│ │ ├── cameras.py
│ │ ├── colmap_loader.py
│ │ ├── dataset_readers.py
│ │ ├── gaussian_model.py
│ │ └── per_point_adam.py
│ ├── submodules/
│ │ ├── diff-langsurf-rasterizer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── build/
│ │ │ │ └── temp.linux-x86_64-cpython-310/
│ │ │ │ ├── .ninja_deps
│ │ │ │ ├── .ninja_log
│ │ │ │ ├── build.ninja
│ │ │ │ ├── cuda_rasterizer/
│ │ │ │ │ ├── backward.o
│ │ │ │ │ ├── forward.o
│ │ │ │ │ └── rasterizer_impl.o
│ │ │ │ ├── ext.o
│ │ │ │ └── rasterize_points.o
│ │ │ ├── cuda_rasterizer/
│ │ │ │ ├── auxiliary.h
│ │ │ │ ├── backward.cu
│ │ │ │ ├── backward.h
│ │ │ │ ├── config.h
│ │ │ │ ├── forward.cu
│ │ │ │ ├── forward.h
│ │ │ │ ├── rasterizer.h
│ │ │ │ ├── rasterizer_impl.cu
│ │ │ │ └── rasterizer_impl.h
│ │ │ ├── diff_LangSurf_rasterization/
│ │ │ │ └── __init__.py
│ │ │ ├── diff_LangSurf_rasterization.egg-info/
│ │ │ │ ├── PKG-INFO
│ │ │ │ ├── SOURCES.txt
│ │ │ │ ├── dependency_links.txt
│ │ │ │ └── top_level.txt
│ │ │ ├── ext.cpp
│ │ │ ├── rasterize_points.cu
│ │ │ ├── rasterize_points.h
│ │ │ ├── setup.py
│ │ │ └── third_party/
│ │ │ ├── glm/
│ │ │ │ ├── .appveyor.yml
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .travis.yml
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── cmake/
│ │ │ │ │ └── cmake_uninstall.cmake.in
│ │ │ │ ├── copying.txt
│ │ │ │ ├── doc/
│ │ │ │ │ ├── api/
│ │ │ │ │ │ ├── a00001_source.html
│ │ │ │ │ │ ├── a00002_source.html
│ │ │ │ │ │ ├── a00003_source.html
│ │ │ │ │ │ ├── a00004_source.html
│ │ │ │ │ │ ├── a00005_source.html
│ │ │ │ │ │ ├── a00006_source.html
│ │ │ │ │ │ ├── a00007.html
│ │ │ │ │ │ ├── a00007_source.html
│ │ │ │ │ │ ├── a00008.html
│ │ │ │ │ │ ├── a00008_source.html
│ │ │ │ │ │ ├── a00009.html
│ │ │ │ │ │ ├── a00009_source.html
│ │ │ │ │ │ ├── a00010.html
│ │ │ │ │ │ ├── a00010_source.html
│ │ │ │ │ │ ├── a00011.html
│ │ │ │ │ │ ├── a00011_source.html
│ │ │ │ │ │ ├── a00012.html
│ │ │ │ │ │ ├── a00012_source.html
│ │ │ │ │ │ ├── a00013.html
│ │ │ │ │ │ ├── a00013_source.html
│ │ │ │ │ │ ├── a00014.html
│ │ │ │ │ │ ├── a00014_source.html
│ │ │ │ │ │ ├── a00015.html
│ │ │ │ │ │ ├── a00015_source.html
│ │ │ │ │ │ ├── a00016.html
│ │ │ │ │ │ ├── a00016_source.html
│ │ │ │ │ │ ├── a00017.html
│ │ │ │ │ │ ├── a00017_source.html
│ │ │ │ │ │ ├── a00018.html
│ │ │ │ │ │ ├── a00018_source.html
│ │ │ │ │ │ ├── a00019_source.html
│ │ │ │ │ │ ├── a00020_source.html
│ │ │ │ │ │ ├── a00021.html
│ │ │ │ │ │ ├── a00021_source.html
│ │ │ │ │ │ ├── a00022.html
│ │ │ │ │ │ ├── a00022_source.html
│ │ │ │ │ │ ├── a00023.html
│ │ │ │ │ │ ├── a00023_source.html
│ │ │ │ │ │ ├── a00024.html
│ │ │ │ │ │ ├── a00024_source.html
│ │ │ │ │ │ ├── a00025.html
│ │ │ │ │ │ ├── a00025_source.html
│ │ │ │ │ │ ├── a00026.html
│ │ │ │ │ │ ├── a00026_source.html
│ │ │ │ │ │ ├── a00027.html
│ │ │ │ │ │ ├── a00027_source.html
│ │ │ │ │ │ ├── a00028.html
│ │ │ │ │ │ ├── a00028_source.html
│ │ │ │ │ │ ├── a00029.html
│ │ │ │ │ │ ├── a00029_source.html
│ │ │ │ │ │ ├── a00030.html
│ │ │ │ │ │ ├── a00030_source.html
│ │ │ │ │ │ ├── a00031.html
│ │ │ │ │ │ ├── a00031_source.html
│ │ │ │ │ │ ├── a00032.html
│ │ │ │ │ │ ├── a00032_source.html
│ │ │ │ │ │ ├── a00033.html
│ │ │ │ │ │ ├── a00033_source.html
│ │ │ │ │ │ ├── a00034.html
│ │ │ │ │ │ ├── a00034_source.html
│ │ │ │ │ │ ├── a00035_source.html
│ │ │ │ │ │ ├── a00036.html
│ │ │ │ │ │ ├── a00036_source.html
│ │ │ │ │ │ ├── a00037.html
│ │ │ │ │ │ ├── a00037_source.html
│ │ │ │ │ │ ├── a00038.html
│ │ │ │ │ │ ├── a00038_source.html
│ │ │ │ │ │ ├── a00039.html
│ │ │ │ │ │ ├── a00039_source.html
│ │ │ │ │ │ ├── a00040.html
│ │ │ │ │ │ ├── a00040_source.html
│ │ │ │ │ │ ├── a00041.html
│ │ │ │ │ │ ├── a00041_source.html
│ │ │ │ │ │ ├── a00042.html
│ │ │ │ │ │ ├── a00042_source.html
│ │ │ │ │ │ ├── a00043.html
│ │ │ │ │ │ ├── a00043_source.html
│ │ │ │ │ │ ├── a00044.html
│ │ │ │ │ │ ├── a00044_source.html
│ │ │ │ │ │ ├── a00045.html
│ │ │ │ │ │ ├── a00045_source.html
│ │ │ │ │ │ ├── a00046.html
│ │ │ │ │ │ ├── a00046_source.html
│ │ │ │ │ │ ├── a00047_source.html
│ │ │ │ │ │ ├── a00048.html
│ │ │ │ │ │ ├── a00048_source.html
│ │ │ │ │ │ ├── a00049.html
│ │ │ │ │ │ ├── a00049_source.html
│ │ │ │ │ │ ├── a00050.html
│ │ │ │ │ │ ├── a00050_source.html
│ │ │ │ │ │ ├── a00051.html
│ │ │ │ │ │ ├── a00051_source.html
│ │ │ │ │ │ ├── a00052.html
│ │ │ │ │ │ ├── a00052_source.html
│ │ │ │ │ │ ├── a00053.html
│ │ │ │ │ │ ├── a00053_source.html
│ │ │ │ │ │ ├── a00054.html
│ │ │ │ │ │ ├── a00054_source.html
│ │ │ │ │ │ ├── a00055.html
│ │ │ │ │ │ ├── a00055_source.html
│ │ │ │ │ │ ├── a00056.html
│ │ │ │ │ │ ├── a00056_source.html
│ │ │ │ │ │ ├── a00057.html
│ │ │ │ │ │ ├── a00057_source.html
│ │ │ │ │ │ ├── a00058.html
│ │ │ │ │ │ ├── a00058_source.html
│ │ │ │ │ │ ├── a00059.html
│ │ │ │ │ │ ├── a00059_source.html
│ │ │ │ │ │ ├── a00060.html
│ │ │ │ │ │ ├── a00060_source.html
│ │ │ │ │ │ ├── a00061.html
│ │ │ │ │ │ ├── a00061_source.html
│ │ │ │ │ │ ├── a00062.html
│ │ │ │ │ │ ├── a00062_source.html
│ │ │ │ │ │ ├── a00063.html
│ │ │ │ │ │ ├── a00063_source.html
│ │ │ │ │ │ ├── a00064.html
│ │ │ │ │ │ ├── a00064_source.html
│ │ │ │ │ │ ├── a00065.html
│ │ │ │ │ │ ├── a00065_source.html
│ │ │ │ │ │ ├── a00066.html
│ │ │ │ │ │ ├── a00066_source.html
│ │ │ │ │ │ ├── a00067.html
│ │ │ │ │ │ ├── a00067_source.html
│ │ │ │ │ │ ├── a00068.html
│ │ │ │ │ │ ├── a00068_source.html
│ │ │ │ │ │ ├── a00069.html
│ │ │ │ │ │ ├── a00069_source.html
│ │ │ │ │ │ ├── a00070.html
│ │ │ │ │ │ ├── a00070_source.html
│ │ │ │ │ │ ├── a00071.html
│ │ │ │ │ │ ├── a00071_source.html
│ │ │ │ │ │ ├── a00072.html
│ │ │ │ │ │ ├── a00072_source.html
│ │ │ │ │ │ ├── a00073.html
│ │ │ │ │ │ ├── a00073_source.html
│ │ │ │ │ │ ├── a00074.html
│ │ │ │ │ │ ├── a00074_source.html
│ │ │ │ │ │ ├── a00075.html
│ │ │ │ │ │ ├── a00075_source.html
│ │ │ │ │ │ ├── a00076.html
│ │ │ │ │ │ ├── a00076_source.html
│ │ │ │ │ │ ├── a00077.html
│ │ │ │ │ │ ├── a00077_source.html
│ │ │ │ │ │ ├── a00078.html
│ │ │ │ │ │ ├── a00078_source.html
│ │ │ │ │ │ ├── a00079.html
│ │ │ │ │ │ ├── a00079_source.html
│ │ │ │ │ │ ├── a00080.html
│ │ │ │ │ │ ├── a00080_source.html
│ │ │ │ │ │ ├── a00081.html
│ │ │ │ │ │ ├── a00081_source.html
│ │ │ │ │ │ ├── a00082.html
│ │ │ │ │ │ ├── a00082_source.html
│ │ │ │ │ │ ├── a00083.html
│ │ │ │ │ │ ├── a00083_source.html
│ │ │ │ │ │ ├── a00084.html
│ │ │ │ │ │ ├── a00084_source.html
│ │ │ │ │ │ ├── a00085.html
│ │ │ │ │ │ ├── a00085_source.html
│ │ │ │ │ │ ├── a00086.html
│ │ │ │ │ │ ├── a00086_source.html
│ │ │ │ │ │ ├── a00087.html
│ │ │ │ │ │ ├── a00087_source.html
│ │ │ │ │ │ ├── a00088.html
│ │ │ │ │ │ ├── a00088_source.html
│ │ │ │ │ │ ├── a00089.html
│ │ │ │ │ │ ├── a00089_source.html
│ │ │ │ │ │ ├── a00090.html
│ │ │ │ │ │ ├── a00090_source.html
│ │ │ │ │ │ ├── a00091.html
│ │ │ │ │ │ ├── a00091_source.html
│ │ │ │ │ │ ├── a00092.html
│ │ │ │ │ │ ├── a00092_source.html
│ │ │ │ │ │ ├── a00093.html
│ │ │ │ │ │ ├── a00093_source.html
│ │ │ │ │ │ ├── a00094.html
│ │ │ │ │ │ ├── a00094_source.html
│ │ │ │ │ │ ├── a00095_source.html
│ │ │ │ │ │ ├── a00096.html
│ │ │ │ │ │ ├── a00096_source.html
│ │ │ │ │ │ ├── a00097.html
│ │ │ │ │ │ ├── a00097_source.html
│ │ │ │ │ │ ├── a00098.html
│ │ │ │ │ │ ├── a00098_source.html
│ │ │ │ │ │ ├── a00099.html
│ │ │ │ │ │ ├── a00099_source.html
│ │ │ │ │ │ ├── a00100.html
│ │ │ │ │ │ ├── a00100_source.html
│ │ │ │ │ │ ├── a00101.html
│ │ │ │ │ │ ├── a00101_source.html
│ │ │ │ │ │ ├── a00102.html
│ │ │ │ │ │ ├── a00102_source.html
│ │ │ │ │ │ ├── a00103.html
│ │ │ │ │ │ ├── a00103_source.html
│ │ │ │ │ │ ├── a00104.html
│ │ │ │ │ │ ├── a00104_source.html
│ │ │ │ │ │ ├── a00105.html
│ │ │ │ │ │ ├── a00105_source.html
│ │ │ │ │ │ ├── a00106.html
│ │ │ │ │ │ ├── a00106_source.html
│ │ │ │ │ │ ├── a00107.html
│ │ │ │ │ │ ├── a00107_source.html
│ │ │ │ │ │ ├── a00108.html
│ │ │ │ │ │ ├── a00108_source.html
│ │ │ │ │ │ ├── a00109.html
│ │ │ │ │ │ ├── a00109_source.html
│ │ │ │ │ │ ├── a00110.html
│ │ │ │ │ │ ├── a00110_source.html
│ │ │ │ │ │ ├── a00111.html
│ │ │ │ │ │ ├── a00111_source.html
│ │ │ │ │ │ ├── a00112.html
│ │ │ │ │ │ ├── a00112_source.html
│ │ │ │ │ │ ├── a00113.html
│ │ │ │ │ │ ├── a00113_source.html
│ │ │ │ │ │ ├── a00114.html
│ │ │ │ │ │ ├── a00114_source.html
│ │ │ │ │ │ ├── a00115.html
│ │ │ │ │ │ ├── a00115_source.html
│ │ │ │ │ │ ├── a00116.html
│ │ │ │ │ │ ├── a00116_source.html
│ │ │ │ │ │ ├── a00117.html
│ │ │ │ │ │ ├── a00117_source.html
│ │ │ │ │ │ ├── a00118.html
│ │ │ │ │ │ ├── a00118_source.html
│ │ │ │ │ │ ├── a00119.html
│ │ │ │ │ │ ├── a00119_source.html
│ │ │ │ │ │ ├── a00120.html
│ │ │ │ │ │ ├── a00120_source.html
│ │ │ │ │ │ ├── a00121.html
│ │ │ │ │ │ ├── a00121_source.html
│ │ │ │ │ │ ├── a00122.html
│ │ │ │ │ │ ├── a00122_source.html
│ │ │ │ │ │ ├── a00123.html
│ │ │ │ │ │ ├── a00123_source.html
│ │ │ │ │ │ ├── a00124_source.html
│ │ │ │ │ │ ├── a00125.html
│ │ │ │ │ │ ├── a00125_source.html
│ │ │ │ │ │ ├── a00126.html
│ │ │ │ │ │ ├── a00126_source.html
│ │ │ │ │ │ ├── a00127.html
│ │ │ │ │ │ ├── a00127_source.html
│ │ │ │ │ │ ├── a00128.html
│ │ │ │ │ │ ├── a00128_source.html
│ │ │ │ │ │ ├── a00129.html
│ │ │ │ │ │ ├── a00129_source.html
│ │ │ │ │ │ ├── a00130.html
│ │ │ │ │ │ ├── a00130_source.html
│ │ │ │ │ │ ├── a00131.html
│ │ │ │ │ │ ├── a00131_source.html
│ │ │ │ │ │ ├── a00132.html
│ │ │ │ │ │ ├── a00132_source.html
│ │ │ │ │ │ ├── a00133.html
│ │ │ │ │ │ ├── a00133_source.html
│ │ │ │ │ │ ├── a00134.html
│ │ │ │ │ │ ├── a00134_source.html
│ │ │ │ │ │ ├── a00135.html
│ │ │ │ │ │ ├── a00135_source.html
│ │ │ │ │ │ ├── a00136.html
│ │ │ │ │ │ ├── a00136_source.html
│ │ │ │ │ │ ├── a00137.html
│ │ │ │ │ │ ├── a00137_source.html
│ │ │ │ │ │ ├── a00138.html
│ │ │ │ │ │ ├── a00138_source.html
│ │ │ │ │ │ ├── a00139.html
│ │ │ │ │ │ ├── a00139_source.html
│ │ │ │ │ │ ├── a00140.html
│ │ │ │ │ │ ├── a00140_source.html
│ │ │ │ │ │ ├── a00141.html
│ │ │ │ │ │ ├── a00141_source.html
│ │ │ │ │ │ ├── a00142.html
│ │ │ │ │ │ ├── a00142_source.html
│ │ │ │ │ │ ├── a00143.html
│ │ │ │ │ │ ├── a00143_source.html
│ │ │ │ │ │ ├── a00144.html
│ │ │ │ │ │ ├── a00144_source.html
│ │ │ │ │ │ ├── a00145.html
│ │ │ │ │ │ ├── a00145_source.html
│ │ │ │ │ │ ├── a00146.html
│ │ │ │ │ │ ├── a00146_source.html
│ │ │ │ │ │ ├── a00147.html
│ │ │ │ │ │ ├── a00147_source.html
│ │ │ │ │ │ ├── a00148.html
│ │ │ │ │ │ ├── a00148_source.html
│ │ │ │ │ │ ├── a00149.html
│ │ │ │ │ │ ├── a00149_source.html
│ │ │ │ │ │ ├── a00150.html
│ │ │ │ │ │ ├── a00150_source.html
│ │ │ │ │ │ ├── a00151.html
│ │ │ │ │ │ ├── a00151_source.html
│ │ │ │ │ │ ├── a00152.html
│ │ │ │ │ │ ├── a00152_source.html
│ │ │ │ │ │ ├── a00153_source.html
│ │ │ │ │ │ ├── a00154.html
│ │ │ │ │ │ ├── a00154_source.html
│ │ │ │ │ │ ├── a00155.html
│ │ │ │ │ │ ├── a00155_source.html
│ │ │ │ │ │ ├── a00156.html
│ │ │ │ │ │ ├── a00156_source.html
│ │ │ │ │ │ ├── a00157.html
│ │ │ │ │ │ ├── a00157_source.html
│ │ │ │ │ │ ├── a00158.html
│ │ │ │ │ │ ├── a00158_source.html
│ │ │ │ │ │ ├── a00159.html
│ │ │ │ │ │ ├── a00159_source.html
│ │ │ │ │ │ ├── a00160.html
│ │ │ │ │ │ ├── a00160_source.html
│ │ │ │ │ │ ├── a00161.html
│ │ │ │ │ │ ├── a00161_source.html
│ │ │ │ │ │ ├── a00162.html
│ │ │ │ │ │ ├── a00162_source.html
│ │ │ │ │ │ ├── a00163_source.html
│ │ │ │ │ │ ├── a00164_source.html
│ │ │ │ │ │ ├── a00165.html
│ │ │ │ │ │ ├── a00165_source.html
│ │ │ │ │ │ ├── a00166.html
│ │ │ │ │ │ ├── a00166_source.html
│ │ │ │ │ │ ├── a00167.html
│ │ │ │ │ │ ├── a00167_source.html
│ │ │ │ │ │ ├── a00168.html
│ │ │ │ │ │ ├── a00168_source.html
│ │ │ │ │ │ ├── a00169.html
│ │ │ │ │ │ ├── a00169_source.html
│ │ │ │ │ │ ├── a00170.html
│ │ │ │ │ │ ├── a00170_source.html
│ │ │ │ │ │ ├── a00171.html
│ │ │ │ │ │ ├── a00171_source.html
│ │ │ │ │ │ ├── a00172.html
│ │ │ │ │ │ ├── a00172_source.html
│ │ │ │ │ │ ├── a00173.html
│ │ │ │ │ │ ├── a00173_source.html
│ │ │ │ │ │ ├── a00174.html
│ │ │ │ │ │ ├── a00174_source.html
│ │ │ │ │ │ ├── a00175.html
│ │ │ │ │ │ ├── a00175_source.html
│ │ │ │ │ │ ├── a00176.html
│ │ │ │ │ │ ├── a00176_source.html
│ │ │ │ │ │ ├── a00177.html
│ │ │ │ │ │ ├── a00177_source.html
│ │ │ │ │ │ ├── a00178.html
│ │ │ │ │ │ ├── a00178_source.html
│ │ │ │ │ │ ├── a00179.html
│ │ │ │ │ │ ├── a00179_source.html
│ │ │ │ │ │ ├── a00180.html
│ │ │ │ │ │ ├── a00180_source.html
│ │ │ │ │ │ ├── a00181.html
│ │ │ │ │ │ ├── a00181_source.html
│ │ │ │ │ │ ├── a00182.html
│ │ │ │ │ │ ├── a00182_source.html
│ │ │ │ │ │ ├── a00183.html
│ │ │ │ │ │ ├── a00183_source.html
│ │ │ │ │ │ ├── a00184.html
│ │ │ │ │ │ ├── a00184_source.html
│ │ │ │ │ │ ├── a00185.html
│ │ │ │ │ │ ├── a00185_source.html
│ │ │ │ │ │ ├── a00186.html
│ │ │ │ │ │ ├── a00186_source.html
│ │ │ │ │ │ ├── a00187.html
│ │ │ │ │ │ ├── a00187_source.html
│ │ │ │ │ │ ├── a00188.html
│ │ │ │ │ │ ├── a00188_source.html
│ │ │ │ │ │ ├── a00189.html
│ │ │ │ │ │ ├── a00189_source.html
│ │ │ │ │ │ ├── a00190.html
│ │ │ │ │ │ ├── a00190_source.html
│ │ │ │ │ │ ├── a00191.html
│ │ │ │ │ │ ├── a00191_source.html
│ │ │ │ │ │ ├── a00192.html
│ │ │ │ │ │ ├── a00192_source.html
│ │ │ │ │ │ ├── a00193.html
│ │ │ │ │ │ ├── a00193_source.html
│ │ │ │ │ │ ├── a00194.html
│ │ │ │ │ │ ├── a00194_source.html
│ │ │ │ │ │ ├── a00195.html
│ │ │ │ │ │ ├── a00195_source.html
│ │ │ │ │ │ ├── a00196.html
│ │ │ │ │ │ ├── a00196_source.html
│ │ │ │ │ │ ├── a00197.html
│ │ │ │ │ │ ├── a00197_source.html
│ │ │ │ │ │ ├── a00198.html
│ │ │ │ │ │ ├── a00198_source.html
│ │ │ │ │ │ ├── a00199.html
│ │ │ │ │ │ ├── a00199_source.html
│ │ │ │ │ │ ├── a00200.html
│ │ │ │ │ │ ├── a00200_source.html
│ │ │ │ │ │ ├── a00201.html
│ │ │ │ │ │ ├── a00201_source.html
│ │ │ │ │ │ ├── a00202.html
│ │ │ │ │ │ ├── a00202_source.html
│ │ │ │ │ │ ├── a00203.html
│ │ │ │ │ │ ├── a00203_source.html
│ │ │ │ │ │ ├── a00204.html
│ │ │ │ │ │ ├── a00204_source.html
│ │ │ │ │ │ ├── a00205.html
│ │ │ │ │ │ ├── a00205_source.html
│ │ │ │ │ │ ├── a00206.html
│ │ │ │ │ │ ├── a00206_source.html
│ │ │ │ │ │ ├── a00207.html
│ │ │ │ │ │ ├── a00207_source.html
│ │ │ │ │ │ ├── a00208.html
│ │ │ │ │ │ ├── a00208_source.html
│ │ │ │ │ │ ├── a00209.html
│ │ │ │ │ │ ├── a00209_source.html
│ │ │ │ │ │ ├── a00210.html
│ │ │ │ │ │ ├── a00210_source.html
│ │ │ │ │ │ ├── a00211.html
│ │ │ │ │ │ ├── a00211_source.html
│ │ │ │ │ │ ├── a00212.html
│ │ │ │ │ │ ├── a00212_source.html
│ │ │ │ │ │ ├── a00213.html
│ │ │ │ │ │ ├── a00213_source.html
│ │ │ │ │ │ ├── a00214.html
│ │ │ │ │ │ ├── a00214_source.html
│ │ │ │ │ │ ├── a00215.html
│ │ │ │ │ │ ├── a00215_source.html
│ │ │ │ │ │ ├── a00216.html
│ │ │ │ │ │ ├── a00216_source.html
│ │ │ │ │ │ ├── a00217.html
│ │ │ │ │ │ ├── a00217_source.html
│ │ │ │ │ │ ├── a00218.html
│ │ │ │ │ │ ├── a00218_source.html
│ │ │ │ │ │ ├── a00219.html
│ │ │ │ │ │ ├── a00219_source.html
│ │ │ │ │ │ ├── a00220.html
│ │ │ │ │ │ ├── a00220_source.html
│ │ │ │ │ │ ├── a00221.html
│ │ │ │ │ │ ├── a00221_source.html
│ │ │ │ │ │ ├── a00222.html
│ │ │ │ │ │ ├── a00222_source.html
│ │ │ │ │ │ ├── a00223.html
│ │ │ │ │ │ ├── a00223_source.html
│ │ │ │ │ │ ├── a00224.html
│ │ │ │ │ │ ├── a00224_source.html
│ │ │ │ │ │ ├── a00225.html
│ │ │ │ │ │ ├── a00225_source.html
│ │ │ │ │ │ ├── a00226.html
│ │ │ │ │ │ ├── a00226_source.html
│ │ │ │ │ │ ├── a00227.html
│ │ │ │ │ │ ├── a00227_source.html
│ │ │ │ │ │ ├── a00228.html
│ │ │ │ │ │ ├── a00228_source.html
│ │ │ │ │ │ ├── a00229.html
│ │ │ │ │ │ ├── a00229_source.html
│ │ │ │ │ │ ├── a00230.html
│ │ │ │ │ │ ├── a00230_source.html
│ │ │ │ │ │ ├── a00231.html
│ │ │ │ │ │ ├── a00231_source.html
│ │ │ │ │ │ ├── a00232.html
│ │ │ │ │ │ ├── a00232_source.html
│ │ │ │ │ │ ├── a00233.html
│ │ │ │ │ │ ├── a00233_source.html
│ │ │ │ │ │ ├── a00234.html
│ │ │ │ │ │ ├── a00234_source.html
│ │ │ │ │ │ ├── a00235.html
│ │ │ │ │ │ ├── a00235_source.html
│ │ │ │ │ │ ├── a00241.html
│ │ │ │ │ │ ├── a00242.html
│ │ │ │ │ │ ├── a00243.html
│ │ │ │ │ │ ├── a00244.html
│ │ │ │ │ │ ├── a00245.html
│ │ │ │ │ │ ├── a00246.html
│ │ │ │ │ │ ├── a00247.html
│ │ │ │ │ │ ├── a00248.html
│ │ │ │ │ │ ├── a00249.html
│ │ │ │ │ │ ├── a00250.html
│ │ │ │ │ │ ├── a00251.html
│ │ │ │ │ │ ├── a00252.html
│ │ │ │ │ │ ├── a00253.html
│ │ │ │ │ │ ├── a00254.html
│ │ │ │ │ │ ├── a00255.html
│ │ │ │ │ │ ├── a00256.html
│ │ │ │ │ │ ├── a00257.html
│ │ │ │ │ │ ├── a00258.html
│ │ │ │ │ │ ├── a00259.html
│ │ │ │ │ │ ├── a00260.html
│ │ │ │ │ │ ├── a00261.html
│ │ │ │ │ │ ├── a00262.html
│ │ │ │ │ │ ├── a00263.html
│ │ │ │ │ │ ├── a00264.html
│ │ │ │ │ │ ├── a00265.html
│ │ │ │ │ │ ├── a00266.html
│ │ │ │ │ │ ├── a00267.html
│ │ │ │ │ │ ├── a00268.html
│ │ │ │ │ │ ├── a00269.html
│ │ │ │ │ │ ├── a00270.html
│ │ │ │ │ │ ├── a00271.html
│ │ │ │ │ │ ├── a00272.html
│ │ │ │ │ │ ├── a00273.html
│ │ │ │ │ │ ├── a00274.html
│ │ │ │ │ │ ├── a00275.html
│ │ │ │ │ │ ├── a00276.html
│ │ │ │ │ │ ├── a00277.html
│ │ │ │ │ │ ├── a00278.html
│ │ │ │ │ │ ├── a00279.html
│ │ │ │ │ │ ├── a00280.html
│ │ │ │ │ │ ├── a00281.html
│ │ │ │ │ │ ├── a00282.html
│ │ │ │ │ │ ├── a00283.html
│ │ │ │ │ │ ├── a00284.html
│ │ │ │ │ │ ├── a00285.html
│ │ │ │ │ │ ├── a00286.html
│ │ │ │ │ │ ├── a00287.html
│ │ │ │ │ │ ├── a00288.html
│ │ │ │ │ │ ├── a00289.html
│ │ │ │ │ │ ├── a00290.html
│ │ │ │ │ │ ├── a00291.html
│ │ │ │ │ │ ├── a00292.html
│ │ │ │ │ │ ├── a00293.html
│ │ │ │ │ │ ├── a00294.html
│ │ │ │ │ │ ├── a00295.html
│ │ │ │ │ │ ├── a00296.html
│ │ │ │ │ │ ├── a00297.html
│ │ │ │ │ │ ├── a00298.html
│ │ │ │ │ │ ├── a00299.html
│ │ │ │ │ │ ├── a00300.html
│ │ │ │ │ │ ├── a00301.html
│ │ │ │ │ │ ├── a00302.html
│ │ │ │ │ │ ├── a00303.html
│ │ │ │ │ │ ├── a00304.html
│ │ │ │ │ │ ├── a00305.html
│ │ │ │ │ │ ├── a00306.html
│ │ │ │ │ │ ├── a00307.html
│ │ │ │ │ │ ├── a00308.html
│ │ │ │ │ │ ├── a00309.html
│ │ │ │ │ │ ├── a00310.html
│ │ │ │ │ │ ├── a00311.html
│ │ │ │ │ │ ├── a00312.html
│ │ │ │ │ │ ├── a00313.html
│ │ │ │ │ │ ├── a00314.html
│ │ │ │ │ │ ├── a00315.html
│ │ │ │ │ │ ├── a00316.html
│ │ │ │ │ │ ├── a00317.html
│ │ │ │ │ │ ├── a00318.html
│ │ │ │ │ │ ├── a00319.html
│ │ │ │ │ │ ├── a00320.html
│ │ │ │ │ │ ├── a00321.html
│ │ │ │ │ │ ├── a00322.html
│ │ │ │ │ │ ├── a00323.html
│ │ │ │ │ │ ├── a00324.html
│ │ │ │ │ │ ├── a00325.html
│ │ │ │ │ │ ├── a00326.html
│ │ │ │ │ │ ├── a00327.html
│ │ │ │ │ │ ├── a00328.html
│ │ │ │ │ │ ├── a00329.html
│ │ │ │ │ │ ├── a00330.html
│ │ │ │ │ │ ├── a00331.html
│ │ │ │ │ │ ├── a00332.html
│ │ │ │ │ │ ├── a00333.html
│ │ │ │ │ │ ├── a00334.html
│ │ │ │ │ │ ├── a00335.html
│ │ │ │ │ │ ├── a00336.html
│ │ │ │ │ │ ├── a00337.html
│ │ │ │ │ │ ├── a00338.html
│ │ │ │ │ │ ├── a00339.html
│ │ │ │ │ │ ├── a00340.html
│ │ │ │ │ │ ├── a00341.html
│ │ │ │ │ │ ├── a00342.html
│ │ │ │ │ │ ├── a00343.html
│ │ │ │ │ │ ├── a00344.html
│ │ │ │ │ │ ├── a00345.html
│ │ │ │ │ │ ├── a00346.html
│ │ │ │ │ │ ├── a00347.html
│ │ │ │ │ │ ├── a00348.html
│ │ │ │ │ │ ├── a00349.html
│ │ │ │ │ │ ├── a00350.html
│ │ │ │ │ │ ├── a00351.html
│ │ │ │ │ │ ├── a00352.html
│ │ │ │ │ │ ├── a00353.html
│ │ │ │ │ │ ├── a00354.html
│ │ │ │ │ │ ├── a00355.html
│ │ │ │ │ │ ├── a00356.html
│ │ │ │ │ │ ├── a00357.html
│ │ │ │ │ │ ├── a00358.html
│ │ │ │ │ │ ├── a00359.html
│ │ │ │ │ │ ├── a00360.html
│ │ │ │ │ │ ├── a00361.html
│ │ │ │ │ │ ├── a00362.html
│ │ │ │ │ │ ├── a00363.html
│ │ │ │ │ │ ├── a00364.html
│ │ │ │ │ │ ├── a00365.html
│ │ │ │ │ │ ├── a00366.html
│ │ │ │ │ │ ├── a00367.html
│ │ │ │ │ │ ├── a00368.html
│ │ │ │ │ │ ├── a00369.html
│ │ │ │ │ │ ├── a00370.html
│ │ │ │ │ │ ├── a00371.html
│ │ │ │ │ │ ├── a00372.html
│ │ │ │ │ │ ├── a00373.html
│ │ │ │ │ │ ├── a00374.html
│ │ │ │ │ │ ├── dir_033f5edb0915b828d2c46ed4804e5503.html
│ │ │ │ │ │ ├── dir_3a581ba30d25676e4b797b1f96d53b45.html
│ │ │ │ │ │ ├── dir_44e5e654415abd9ca6fdeaddaff8565e.html
│ │ │ │ │ │ ├── dir_4c6bd29c73fa4e5a2509e1c15f846751.html
│ │ │ │ │ │ ├── dir_5189610d3ba09ec39b766fb99b34cd93.html
│ │ │ │ │ │ ├── dir_6b66465792d005310484819a0eb0b0d3.html
│ │ │ │ │ │ ├── dir_9e5fe034a00e89334fd5186c3e7db156.html
│ │ │ │ │ │ ├── dir_a8bee7be44182a33f3820393ae0b105d.html
│ │ │ │ │ │ ├── dir_cef2d71d502cb69a9252bca2297d9549.html
│ │ │ │ │ │ ├── dir_d9496f0844b48bc7e53b5af8c99b9ab2.html
│ │ │ │ │ │ ├── dir_f35778ec600a1b9bbc4524e62e226aa2.html
│ │ │ │ │ │ ├── doxygen.css
│ │ │ │ │ │ ├── dynsections.js
│ │ │ │ │ │ ├── files.html
│ │ │ │ │ │ ├── index.html
│ │ │ │ │ │ ├── jquery.js
│ │ │ │ │ │ ├── modules.html
│ │ │ │ │ │ ├── search/
│ │ │ │ │ │ │ ├── all_0.html
│ │ │ │ │ │ │ ├── all_0.js
│ │ │ │ │ │ │ ├── all_1.html
│ │ │ │ │ │ │ ├── all_1.js
│ │ │ │ │ │ │ ├── all_10.html
│ │ │ │ │ │ │ ├── all_10.js
│ │ │ │ │ │ │ ├── all_11.html
│ │ │ │ │ │ │ ├── all_11.js
│ │ │ │ │ │ │ ├── all_12.html
│ │ │ │ │ │ │ ├── all_12.js
│ │ │ │ │ │ │ ├── all_13.html
│ │ │ │ │ │ │ ├── all_13.js
│ │ │ │ │ │ │ ├── all_14.html
│ │ │ │ │ │ │ ├── all_14.js
│ │ │ │ │ │ │ ├── all_15.html
│ │ │ │ │ │ │ ├── all_15.js
│ │ │ │ │ │ │ ├── all_16.html
│ │ │ │ │ │ │ ├── all_16.js
│ │ │ │ │ │ │ ├── all_2.html
│ │ │ │ │ │ │ ├── all_2.js
│ │ │ │ │ │ │ ├── all_3.html
│ │ │ │ │ │ │ ├── all_3.js
│ │ │ │ │ │ │ ├── all_4.html
│ │ │ │ │ │ │ ├── all_4.js
│ │ │ │ │ │ │ ├── all_5.html
│ │ │ │ │ │ │ ├── all_5.js
│ │ │ │ │ │ │ ├── all_6.html
│ │ │ │ │ │ │ ├── all_6.js
│ │ │ │ │ │ │ ├── all_7.html
│ │ │ │ │ │ │ ├── all_7.js
│ │ │ │ │ │ │ ├── all_8.html
│ │ │ │ │ │ │ ├── all_8.js
│ │ │ │ │ │ │ ├── all_9.html
│ │ │ │ │ │ │ ├── all_9.js
│ │ │ │ │ │ │ ├── all_a.html
│ │ │ │ │ │ │ ├── all_a.js
│ │ │ │ │ │ │ ├── all_b.html
│ │ │ │ │ │ │ ├── all_b.js
│ │ │ │ │ │ │ ├── all_c.html
│ │ │ │ │ │ │ ├── all_c.js
│ │ │ │ │ │ │ ├── all_d.html
│ │ │ │ │ │ │ ├── all_d.js
│ │ │ │ │ │ │ ├── all_e.html
│ │ │ │ │ │ │ ├── all_e.js
│ │ │ │ │ │ │ ├── all_f.html
│ │ │ │ │ │ │ ├── all_f.js
│ │ │ │ │ │ │ ├── files_0.html
│ │ │ │ │ │ │ ├── files_0.js
│ │ │ │ │ │ │ ├── files_1.html
│ │ │ │ │ │ │ ├── files_1.js
│ │ │ │ │ │ │ ├── files_10.html
│ │ │ │ │ │ │ ├── files_10.js
│ │ │ │ │ │ │ ├── files_11.html
│ │ │ │ │ │ │ ├── files_11.js
│ │ │ │ │ │ │ ├── files_12.html
│ │ │ │ │ │ │ ├── files_12.js
│ │ │ │ │ │ │ ├── files_13.html
│ │ │ │ │ │ │ ├── files_13.js
│ │ │ │ │ │ │ ├── files_14.html
│ │ │ │ │ │ │ ├── files_14.js
│ │ │ │ │ │ │ ├── files_2.html
│ │ │ │ │ │ │ ├── files_2.js
│ │ │ │ │ │ │ ├── files_3.html
│ │ │ │ │ │ │ ├── files_3.js
│ │ │ │ │ │ │ ├── files_4.html
│ │ │ │ │ │ │ ├── files_4.js
│ │ │ │ │ │ │ ├── files_5.html
│ │ │ │ │ │ │ ├── files_5.js
│ │ │ │ │ │ │ ├── files_6.html
│ │ │ │ │ │ │ ├── files_6.js
│ │ │ │ │ │ │ ├── files_7.html
│ │ │ │ │ │ │ ├── files_7.js
│ │ │ │ │ │ │ ├── files_8.html
│ │ │ │ │ │ │ ├── files_8.js
│ │ │ │ │ │ │ ├── files_9.html
│ │ │ │ │ │ │ ├── files_9.js
│ │ │ │ │ │ │ ├── files_a.html
│ │ │ │ │ │ │ ├── files_a.js
│ │ │ │ │ │ │ ├── files_b.html
│ │ │ │ │ │ │ ├── files_b.js
│ │ │ │ │ │ │ ├── files_c.html
│ │ │ │ │ │ │ ├── files_c.js
│ │ │ │ │ │ │ ├── files_d.html
│ │ │ │ │ │ │ ├── files_d.js
│ │ │ │ │ │ │ ├── files_e.html
│ │ │ │ │ │ │ ├── files_e.js
│ │ │ │ │ │ │ ├── files_f.html
│ │ │ │ │ │ │ ├── files_f.js
│ │ │ │ │ │ │ ├── functions_0.html
│ │ │ │ │ │ │ ├── functions_0.js
│ │ │ │ │ │ │ ├── functions_1.html
│ │ │ │ │ │ │ ├── functions_1.js
│ │ │ │ │ │ │ ├── functions_10.html
│ │ │ │ │ │ │ ├── functions_10.js
│ │ │ │ │ │ │ ├── functions_11.html
│ │ │ │ │ │ │ ├── functions_11.js
│ │ │ │ │ │ │ ├── functions_12.html
│ │ │ │ │ │ │ ├── functions_12.js
│ │ │ │ │ │ │ ├── functions_13.html
│ │ │ │ │ │ │ ├── functions_13.js
│ │ │ │ │ │ │ ├── functions_14.html
│ │ │ │ │ │ │ ├── functions_14.js
│ │ │ │ │ │ │ ├── functions_15.html
│ │ │ │ │ │ │ ├── functions_15.js
│ │ │ │ │ │ │ ├── functions_16.html
│ │ │ │ │ │ │ ├── functions_16.js
│ │ │ │ │ │ │ ├── functions_2.html
│ │ │ │ │ │ │ ├── functions_2.js
│ │ │ │ │ │ │ ├── functions_3.html
│ │ │ │ │ │ │ ├── functions_3.js
│ │ │ │ │ │ │ ├── functions_4.html
│ │ │ │ │ │ │ ├── functions_4.js
│ │ │ │ │ │ │ ├── functions_5.html
│ │ │ │ │ │ │ ├── functions_5.js
│ │ │ │ │ │ │ ├── functions_6.html
│ │ │ │ │ │ │ ├── functions_6.js
│ │ │ │ │ │ │ ├── functions_7.html
│ │ │ │ │ │ │ ├── functions_7.js
│ │ │ │ │ │ │ ├── functions_8.html
│ │ │ │ │ │ │ ├── functions_8.js
│ │ │ │ │ │ │ ├── functions_9.html
│ │ │ │ │ │ │ ├── functions_9.js
│ │ │ │ │ │ │ ├── functions_a.html
│ │ │ │ │ │ │ ├── functions_a.js
│ │ │ │ │ │ │ ├── functions_b.html
│ │ │ │ │ │ │ ├── functions_b.js
│ │ │ │ │ │ │ ├── functions_c.html
│ │ │ │ │ │ │ ├── functions_c.js
│ │ │ │ │ │ │ ├── functions_d.html
│ │ │ │ │ │ │ ├── functions_d.js
│ │ │ │ │ │ │ ├── functions_e.html
│ │ │ │ │ │ │ ├── functions_e.js
│ │ │ │ │ │ │ ├── functions_f.html
│ │ │ │ │ │ │ ├── functions_f.js
│ │ │ │ │ │ │ ├── groups_0.html
│ │ │ │ │ │ │ ├── groups_0.js
│ │ │ │ │ │ │ ├── groups_1.html
│ │ │ │ │ │ │ ├── groups_1.js
│ │ │ │ │ │ │ ├── groups_2.html
│ │ │ │ │ │ │ ├── groups_2.js
│ │ │ │ │ │ │ ├── groups_3.html
│ │ │ │ │ │ │ ├── groups_3.js
│ │ │ │ │ │ │ ├── groups_4.html
│ │ │ │ │ │ │ ├── groups_4.js
│ │ │ │ │ │ │ ├── groups_5.html
│ │ │ │ │ │ │ ├── groups_5.js
│ │ │ │ │ │ │ ├── groups_6.html
│ │ │ │ │ │ │ ├── groups_6.js
│ │ │ │ │ │ │ ├── groups_7.html
│ │ │ │ │ │ │ ├── groups_7.js
│ │ │ │ │ │ │ ├── groups_8.html
│ │ │ │ │ │ │ ├── groups_8.js
│ │ │ │ │ │ │ ├── groups_9.html
│ │ │ │ │ │ │ ├── groups_9.js
│ │ │ │ │ │ │ ├── nomatches.html
│ │ │ │ │ │ │ ├── pages_0.html
│ │ │ │ │ │ │ ├── pages_0.js
│ │ │ │ │ │ │ ├── search.css
│ │ │ │ │ │ │ ├── search.js
│ │ │ │ │ │ │ ├── searchdata.js
│ │ │ │ │ │ │ ├── typedefs_0.html
│ │ │ │ │ │ │ ├── typedefs_0.js
│ │ │ │ │ │ │ ├── typedefs_1.html
│ │ │ │ │ │ │ ├── typedefs_1.js
│ │ │ │ │ │ │ ├── typedefs_2.html
│ │ │ │ │ │ │ ├── typedefs_2.js
│ │ │ │ │ │ │ ├── typedefs_3.html
│ │ │ │ │ │ │ ├── typedefs_3.js
│ │ │ │ │ │ │ ├── typedefs_4.html
│ │ │ │ │ │ │ ├── typedefs_4.js
│ │ │ │ │ │ │ ├── typedefs_5.html
│ │ │ │ │ │ │ ├── typedefs_5.js
│ │ │ │ │ │ │ ├── typedefs_6.html
│ │ │ │ │ │ │ ├── typedefs_6.js
│ │ │ │ │ │ │ ├── typedefs_7.html
│ │ │ │ │ │ │ ├── typedefs_7.js
│ │ │ │ │ │ │ ├── typedefs_8.html
│ │ │ │ │ │ │ ├── typedefs_8.js
│ │ │ │ │ │ │ ├── typedefs_9.html
│ │ │ │ │ │ │ ├── typedefs_9.js
│ │ │ │ │ │ │ ├── typedefs_a.html
│ │ │ │ │ │ │ ├── typedefs_a.js
│ │ │ │ │ │ │ ├── typedefs_b.html
│ │ │ │ │ │ │ ├── typedefs_b.js
│ │ │ │ │ │ │ ├── typedefs_c.html
│ │ │ │ │ │ │ ├── typedefs_c.js
│ │ │ │ │ │ │ ├── typedefs_d.html
│ │ │ │ │ │ │ └── typedefs_d.js
│ │ │ │ │ │ └── tabs.css
│ │ │ │ │ ├── man.doxy
│ │ │ │ │ └── theme/
│ │ │ │ │ └── doxygen.css
│ │ │ │ ├── glm/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── common.hpp
│ │ │ │ │ ├── detail/
│ │ │ │ │ │ ├── _features.hpp
│ │ │ │ │ │ ├── _fixes.hpp
│ │ │ │ │ │ ├── _noise.hpp
│ │ │ │ │ │ ├── _swizzle.hpp
│ │ │ │ │ │ ├── _swizzle_func.hpp
│ │ │ │ │ │ ├── _vectorize.hpp
│ │ │ │ │ │ ├── compute_common.hpp
│ │ │ │ │ │ ├── compute_vector_relational.hpp
│ │ │ │ │ │ ├── func_common.inl
│ │ │ │ │ │ ├── func_common_simd.inl
│ │ │ │ │ │ ├── func_exponential.inl
│ │ │ │ │ │ ├── func_exponential_simd.inl
│ │ │ │ │ │ ├── func_geometric.inl
│ │ │ │ │ │ ├── func_geometric_simd.inl
│ │ │ │ │ │ ├── func_integer.inl
│ │ │ │ │ │ ├── func_integer_simd.inl
│ │ │ │ │ │ ├── func_matrix.inl
│ │ │ │ │ │ ├── func_matrix_simd.inl
│ │ │ │ │ │ ├── func_packing.inl
│ │ │ │ │ │ ├── func_packing_simd.inl
│ │ │ │ │ │ ├── func_trigonometric.inl
│ │ │ │ │ │ ├── func_trigonometric_simd.inl
│ │ │ │ │ │ ├── func_vector_relational.inl
│ │ │ │ │ │ ├── func_vector_relational_simd.inl
│ │ │ │ │ │ ├── glm.cpp
│ │ │ │ │ │ ├── qualifier.hpp
│ │ │ │ │ │ ├── setup.hpp
│ │ │ │ │ │ ├── type_float.hpp
│ │ │ │ │ │ ├── type_half.hpp
│ │ │ │ │ │ ├── type_half.inl
│ │ │ │ │ │ ├── type_mat2x2.hpp
│ │ │ │ │ │ ├── type_mat2x2.inl
│ │ │ │ │ │ ├── type_mat2x3.hpp
│ │ │ │ │ │ ├── type_mat2x3.inl
│ │ │ │ │ │ ├── type_mat2x4.hpp
│ │ │ │ │ │ ├── type_mat2x4.inl
│ │ │ │ │ │ ├── type_mat3x2.hpp
│ │ │ │ │ │ ├── type_mat3x2.inl
│ │ │ │ │ │ ├── type_mat3x3.hpp
│ │ │ │ │ │ ├── type_mat3x3.inl
│ │ │ │ │ │ ├── type_mat3x4.hpp
│ │ │ │ │ │ ├── type_mat3x4.inl
│ │ │ │ │ │ ├── type_mat4x2.hpp
│ │ │ │ │ │ ├── type_mat4x2.inl
│ │ │ │ │ │ ├── type_mat4x3.hpp
│ │ │ │ │ │ ├── type_mat4x3.inl
│ │ │ │ │ │ ├── type_mat4x4.hpp
│ │ │ │ │ │ ├── type_mat4x4.inl
│ │ │ │ │ │ ├── type_mat4x4_simd.inl
│ │ │ │ │ │ ├── type_quat.hpp
│ │ │ │ │ │ ├── type_quat.inl
│ │ │ │ │ │ ├── type_quat_simd.inl
│ │ │ │ │ │ ├── type_vec1.hpp
│ │ │ │ │ │ ├── type_vec1.inl
│ │ │ │ │ │ ├── type_vec2.hpp
│ │ │ │ │ │ ├── type_vec2.inl
│ │ │ │ │ │ ├── type_vec3.hpp
│ │ │ │ │ │ ├── type_vec3.inl
│ │ │ │ │ │ ├── type_vec4.hpp
│ │ │ │ │ │ ├── type_vec4.inl
│ │ │ │ │ │ └── type_vec4_simd.inl
│ │ │ │ │ ├── exponential.hpp
│ │ │ │ │ ├── ext/
│ │ │ │ │ │ ├── _matrix_vectorize.hpp
│ │ │ │ │ │ ├── matrix_clip_space.hpp
│ │ │ │ │ │ ├── matrix_clip_space.inl
│ │ │ │ │ │ ├── matrix_common.hpp
│ │ │ │ │ │ ├── matrix_common.inl
│ │ │ │ │ │ ├── matrix_double2x2.hpp
│ │ │ │ │ │ ├── matrix_double2x2_precision.hpp
│ │ │ │ │ │ ├── matrix_double2x3.hpp
│ │ │ │ │ │ ├── matrix_double2x3_precision.hpp
│ │ │ │ │ │ ├── matrix_double2x4.hpp
│ │ │ │ │ │ ├── matrix_double2x4_precision.hpp
│ │ │ │ │ │ ├── matrix_double3x2.hpp
│ │ │ │ │ │ ├── matrix_double3x2_precision.hpp
│ │ │ │ │ │ ├── matrix_double3x3.hpp
│ │ │ │ │ │ ├── matrix_double3x3_precision.hpp
│ │ │ │ │ │ ├── matrix_double3x4.hpp
│ │ │ │ │ │ ├── matrix_double3x4_precision.hpp
│ │ │ │ │ │ ├── matrix_double4x2.hpp
│ │ │ │ │ │ ├── matrix_double4x2_precision.hpp
│ │ │ │ │ │ ├── matrix_double4x3.hpp
│ │ │ │ │ │ ├── matrix_double4x3_precision.hpp
│ │ │ │ │ │ ├── matrix_double4x4.hpp
│ │ │ │ │ │ ├── matrix_double4x4_precision.hpp
│ │ │ │ │ │ ├── matrix_float2x2.hpp
│ │ │ │ │ │ ├── matrix_float2x2_precision.hpp
│ │ │ │ │ │ ├── matrix_float2x3.hpp
│ │ │ │ │ │ ├── matrix_float2x3_precision.hpp
│ │ │ │ │ │ ├── matrix_float2x4.hpp
│ │ │ │ │ │ ├── matrix_float2x4_precision.hpp
│ │ │ │ │ │ ├── matrix_float3x2.hpp
│ │ │ │ │ │ ├── matrix_float3x2_precision.hpp
│ │ │ │ │ │ ├── matrix_float3x3.hpp
│ │ │ │ │ │ ├── matrix_float3x3_precision.hpp
│ │ │ │ │ │ ├── matrix_float3x4.hpp
│ │ │ │ │ │ ├── matrix_float3x4_precision.hpp
│ │ │ │ │ │ ├── matrix_float4x2.hpp
│ │ │ │ │ │ ├── matrix_float4x2_precision.hpp
│ │ │ │ │ │ ├── matrix_float4x3.hpp
│ │ │ │ │ │ ├── matrix_float4x3_precision.hpp
│ │ │ │ │ │ ├── matrix_float4x4.hpp
│ │ │ │ │ │ ├── matrix_float4x4_precision.hpp
│ │ │ │ │ │ ├── matrix_int2x2.hpp
│ │ │ │ │ │ ├── matrix_int2x2_sized.hpp
│ │ │ │ │ │ ├── matrix_int2x3.hpp
│ │ │ │ │ │ ├── matrix_int2x3_sized.hpp
│ │ │ │ │ │ ├── matrix_int2x4.hpp
│ │ │ │ │ │ ├── matrix_int2x4_sized.hpp
│ │ │ │ │ │ ├── matrix_int3x2.hpp
│ │ │ │ │ │ ├── matrix_int3x2_sized.hpp
│ │ │ │ │ │ ├── matrix_int3x3.hpp
│ │ │ │ │ │ ├── matrix_int3x3_sized.hpp
│ │ │ │ │ │ ├── matrix_int3x4.hpp
│ │ │ │ │ │ ├── matrix_int3x4_sized.hpp
│ │ │ │ │ │ ├── matrix_int4x2.hpp
│ │ │ │ │ │ ├── matrix_int4x2_sized.hpp
│ │ │ │ │ │ ├── matrix_int4x3.hpp
│ │ │ │ │ │ ├── matrix_int4x3_sized.hpp
│ │ │ │ │ │ ├── matrix_int4x4.hpp
│ │ │ │ │ │ ├── matrix_int4x4_sized.hpp
│ │ │ │ │ │ ├── matrix_integer.hpp
│ │ │ │ │ │ ├── matrix_integer.inl
│ │ │ │ │ │ ├── matrix_projection.hpp
│ │ │ │ │ │ ├── matrix_projection.inl
│ │ │ │ │ │ ├── matrix_relational.hpp
│ │ │ │ │ │ ├── matrix_relational.inl
│ │ │ │ │ │ ├── matrix_transform.hpp
│ │ │ │ │ │ ├── matrix_transform.inl
│ │ │ │ │ │ ├── matrix_uint2x2.hpp
│ │ │ │ │ │ ├── matrix_uint2x2_sized.hpp
│ │ │ │ │ │ ├── matrix_uint2x3.hpp
│ │ │ │ │ │ ├── matrix_uint2x3_sized.hpp
│ │ │ │ │ │ ├── matrix_uint2x4.hpp
│ │ │ │ │ │ ├── matrix_uint2x4_sized.hpp
│ │ │ │ │ │ ├── matrix_uint3x2.hpp
│ │ │ │ │ │ ├── matrix_uint3x2_sized.hpp
│ │ │ │ │ │ ├── matrix_uint3x3.hpp
│ │ │ │ │ │ ├── matrix_uint3x3_sized.hpp
│ │ │ │ │ │ ├── matrix_uint3x4.hpp
│ │ │ │ │ │ ├── matrix_uint3x4_sized.hpp
│ │ │ │ │ │ ├── matrix_uint4x2.hpp
│ │ │ │ │ │ ├── matrix_uint4x2_sized.hpp
│ │ │ │ │ │ ├── matrix_uint4x3.hpp
│ │ │ │ │ │ ├── matrix_uint4x3_sized.hpp
│ │ │ │ │ │ ├── matrix_uint4x4.hpp
│ │ │ │ │ │ ├── matrix_uint4x4_sized.hpp
│ │ │ │ │ │ ├── quaternion_common.hpp
│ │ │ │ │ │ ├── quaternion_common.inl
│ │ │ │ │ │ ├── quaternion_common_simd.inl
│ │ │ │ │ │ ├── quaternion_double.hpp
│ │ │ │ │ │ ├── quaternion_double_precision.hpp
│ │ │ │ │ │ ├── quaternion_exponential.hpp
│ │ │ │ │ │ ├── quaternion_exponential.inl
│ │ │ │ │ │ ├── quaternion_float.hpp
│ │ │ │ │ │ ├── quaternion_float_precision.hpp
│ │ │ │ │ │ ├── quaternion_geometric.hpp
│ │ │ │ │ │ ├── quaternion_geometric.inl
│ │ │ │ │ │ ├── quaternion_relational.hpp
│ │ │ │ │ │ ├── quaternion_relational.inl
│ │ │ │ │ │ ├── quaternion_transform.hpp
│ │ │ │ │ │ ├── quaternion_transform.inl
│ │ │ │ │ │ ├── quaternion_trigonometric.hpp
│ │ │ │ │ │ ├── quaternion_trigonometric.inl
│ │ │ │ │ │ ├── scalar_common.hpp
│ │ │ │ │ │ ├── scalar_common.inl
│ │ │ │ │ │ ├── scalar_constants.hpp
│ │ │ │ │ │ ├── scalar_constants.inl
│ │ │ │ │ │ ├── scalar_int_sized.hpp
│ │ │ │ │ │ ├── scalar_integer.hpp
│ │ │ │ │ │ ├── scalar_integer.inl
│ │ │ │ │ │ ├── scalar_packing.hpp
│ │ │ │ │ │ ├── scalar_packing.inl
│ │ │ │ │ │ ├── scalar_reciprocal.hpp
│ │ │ │ │ │ ├── scalar_reciprocal.inl
│ │ │ │ │ │ ├── scalar_relational.hpp
│ │ │ │ │ │ ├── scalar_relational.inl
│ │ │ │ │ │ ├── scalar_uint_sized.hpp
│ │ │ │ │ │ ├── scalar_ulp.hpp
│ │ │ │ │ │ ├── scalar_ulp.inl
│ │ │ │ │ │ ├── vector_bool1.hpp
│ │ │ │ │ │ ├── vector_bool1_precision.hpp
│ │ │ │ │ │ ├── vector_bool2.hpp
│ │ │ │ │ │ ├── vector_bool2_precision.hpp
│ │ │ │ │ │ ├── vector_bool3.hpp
│ │ │ │ │ │ ├── vector_bool3_precision.hpp
│ │ │ │ │ │ ├── vector_bool4.hpp
│ │ │ │ │ │ ├── vector_bool4_precision.hpp
│ │ │ │ │ │ ├── vector_common.hpp
│ │ │ │ │ │ ├── vector_common.inl
│ │ │ │ │ │ ├── vector_double1.hpp
│ │ │ │ │ │ ├── vector_double1_precision.hpp
│ │ │ │ │ │ ├── vector_double2.hpp
│ │ │ │ │ │ ├── vector_double2_precision.hpp
│ │ │ │ │ │ ├── vector_double3.hpp
│ │ │ │ │ │ ├── vector_double3_precision.hpp
│ │ │ │ │ │ ├── vector_double4.hpp
│ │ │ │ │ │ ├── vector_double4_precision.hpp
│ │ │ │ │ │ ├── vector_float1.hpp
│ │ │ │ │ │ ├── vector_float1_precision.hpp
│ │ │ │ │ │ ├── vector_float2.hpp
│ │ │ │ │ │ ├── vector_float2_precision.hpp
│ │ │ │ │ │ ├── vector_float3.hpp
│ │ │ │ │ │ ├── vector_float3_precision.hpp
│ │ │ │ │ │ ├── vector_float4.hpp
│ │ │ │ │ │ ├── vector_float4_precision.hpp
│ │ │ │ │ │ ├── vector_int1.hpp
│ │ │ │ │ │ ├── vector_int1_sized.hpp
│ │ │ │ │ │ ├── vector_int2.hpp
│ │ │ │ │ │ ├── vector_int2_sized.hpp
│ │ │ │ │ │ ├── vector_int3.hpp
│ │ │ │ │ │ ├── vector_int3_sized.hpp
│ │ │ │ │ │ ├── vector_int4.hpp
│ │ │ │ │ │ ├── vector_int4_sized.hpp
│ │ │ │ │ │ ├── vector_integer.hpp
│ │ │ │ │ │ ├── vector_integer.inl
│ │ │ │ │ │ ├── vector_packing.hpp
│ │ │ │ │ │ ├── vector_packing.inl
│ │ │ │ │ │ ├── vector_reciprocal.hpp
│ │ │ │ │ │ ├── vector_reciprocal.inl
│ │ │ │ │ │ ├── vector_relational.hpp
│ │ │ │ │ │ ├── vector_relational.inl
│ │ │ │ │ │ ├── vector_uint1.hpp
│ │ │ │ │ │ ├── vector_uint1_sized.hpp
│ │ │ │ │ │ ├── vector_uint2.hpp
│ │ │ │ │ │ ├── vector_uint2_sized.hpp
│ │ │ │ │ │ ├── vector_uint3.hpp
│ │ │ │ │ │ ├── vector_uint3_sized.hpp
│ │ │ │ │ │ ├── vector_uint4.hpp
│ │ │ │ │ │ ├── vector_uint4_sized.hpp
│ │ │ │ │ │ ├── vector_ulp.hpp
│ │ │ │ │ │ └── vector_ulp.inl
│ │ │ │ │ ├── ext.hpp
│ │ │ │ │ ├── fwd.hpp
│ │ │ │ │ ├── geometric.hpp
│ │ │ │ │ ├── glm.hpp
│ │ │ │ │ ├── gtc/
│ │ │ │ │ │ ├── bitfield.hpp
│ │ │ │ │ │ ├── bitfield.inl
│ │ │ │ │ │ ├── color_space.hpp
│ │ │ │ │ │ ├── color_space.inl
│ │ │ │ │ │ ├── constants.hpp
│ │ │ │ │ │ ├── constants.inl
│ │ │ │ │ │ ├── epsilon.hpp
│ │ │ │ │ │ ├── epsilon.inl
│ │ │ │ │ │ ├── integer.hpp
│ │ │ │ │ │ ├── integer.inl
│ │ │ │ │ │ ├── matrix_access.hpp
│ │ │ │ │ │ ├── matrix_access.inl
│ │ │ │ │ │ ├── matrix_integer.hpp
│ │ │ │ │ │ ├── matrix_inverse.hpp
│ │ │ │ │ │ ├── matrix_inverse.inl
│ │ │ │ │ │ ├── matrix_transform.hpp
│ │ │ │ │ │ ├── matrix_transform.inl
│ │ │ │ │ │ ├── noise.hpp
│ │ │ │ │ │ ├── noise.inl
│ │ │ │ │ │ ├── packing.hpp
│ │ │ │ │ │ ├── packing.inl
│ │ │ │ │ │ ├── quaternion.hpp
│ │ │ │ │ │ ├── quaternion.inl
│ │ │ │ │ │ ├── quaternion_simd.inl
│ │ │ │ │ │ ├── random.hpp
│ │ │ │ │ │ ├── random.inl
│ │ │ │ │ │ ├── reciprocal.hpp
│ │ │ │ │ │ ├── round.hpp
│ │ │ │ │ │ ├── round.inl
│ │ │ │ │ │ ├── type_aligned.hpp
│ │ │ │ │ │ ├── type_precision.hpp
│ │ │ │ │ │ ├── type_precision.inl
│ │ │ │ │ │ ├── type_ptr.hpp
│ │ │ │ │ │ ├── type_ptr.inl
│ │ │ │ │ │ ├── ulp.hpp
│ │ │ │ │ │ ├── ulp.inl
│ │ │ │ │ │ └── vec1.hpp
│ │ │ │ │ ├── gtx/
│ │ │ │ │ │ ├── associated_min_max.hpp
│ │ │ │ │ │ ├── associated_min_max.inl
│ │ │ │ │ │ ├── bit.hpp
│ │ │ │ │ │ ├── bit.inl
│ │ │ │ │ │ ├── closest_point.hpp
│ │ │ │ │ │ ├── closest_point.inl
│ │ │ │ │ │ ├── color_encoding.hpp
│ │ │ │ │ │ ├── color_encoding.inl
│ │ │ │ │ │ ├── color_space.hpp
│ │ │ │ │ │ ├── color_space.inl
│ │ │ │ │ │ ├── color_space_YCoCg.hpp
│ │ │ │ │ │ ├── color_space_YCoCg.inl
│ │ │ │ │ │ ├── common.hpp
│ │ │ │ │ │ ├── common.inl
│ │ │ │ │ │ ├── compatibility.hpp
│ │ │ │ │ │ ├── compatibility.inl
│ │ │ │ │ │ ├── component_wise.hpp
│ │ │ │ │ │ ├── component_wise.inl
│ │ │ │ │ │ ├── dual_quaternion.hpp
│ │ │ │ │ │ ├── dual_quaternion.inl
│ │ │ │ │ │ ├── easing.hpp
│ │ │ │ │ │ ├── easing.inl
│ │ │ │ │ │ ├── euler_angles.hpp
│ │ │ │ │ │ ├── euler_angles.inl
│ │ │ │ │ │ ├── extend.hpp
│ │ │ │ │ │ ├── extend.inl
│ │ │ │ │ │ ├── extended_min_max.hpp
│ │ │ │ │ │ ├── extended_min_max.inl
│ │ │ │ │ │ ├── exterior_product.hpp
│ │ │ │ │ │ ├── exterior_product.inl
│ │ │ │ │ │ ├── fast_exponential.hpp
│ │ │ │ │ │ ├── fast_exponential.inl
│ │ │ │ │ │ ├── fast_square_root.hpp
│ │ │ │ │ │ ├── fast_square_root.inl
│ │ │ │ │ │ ├── fast_trigonometry.hpp
│ │ │ │ │ │ ├── fast_trigonometry.inl
│ │ │ │ │ │ ├── float_notmalize.inl
│ │ │ │ │ │ ├── functions.hpp
│ │ │ │ │ │ ├── functions.inl
│ │ │ │ │ │ ├── gradient_paint.hpp
│ │ │ │ │ │ ├── gradient_paint.inl
│ │ │ │ │ │ ├── handed_coordinate_space.hpp
│ │ │ │ │ │ ├── handed_coordinate_space.inl
│ │ │ │ │ │ ├── hash.hpp
│ │ │ │ │ │ ├── hash.inl
│ │ │ │ │ │ ├── integer.hpp
│ │ │ │ │ │ ├── integer.inl
│ │ │ │ │ │ ├── intersect.hpp
│ │ │ │ │ │ ├── intersect.inl
│ │ │ │ │ │ ├── io.hpp
│ │ │ │ │ │ ├── io.inl
│ │ │ │ │ │ ├── log_base.hpp
│ │ │ │ │ │ ├── log_base.inl
│ │ │ │ │ │ ├── matrix_cross_product.hpp
│ │ │ │ │ │ ├── matrix_cross_product.inl
│ │ │ │ │ │ ├── matrix_decompose.hpp
│ │ │ │ │ │ ├── matrix_decompose.inl
│ │ │ │ │ │ ├── matrix_factorisation.hpp
│ │ │ │ │ │ ├── matrix_factorisation.inl
│ │ │ │ │ │ ├── matrix_interpolation.hpp
│ │ │ │ │ │ ├── matrix_interpolation.inl
│ │ │ │ │ │ ├── matrix_major_storage.hpp
│ │ │ │ │ │ ├── matrix_major_storage.inl
│ │ │ │ │ │ ├── matrix_operation.hpp
│ │ │ │ │ │ ├── matrix_operation.inl
│ │ │ │ │ │ ├── matrix_query.hpp
│ │ │ │ │ │ ├── matrix_query.inl
│ │ │ │ │ │ ├── matrix_transform_2d.hpp
│ │ │ │ │ │ ├── matrix_transform_2d.inl
│ │ │ │ │ │ ├── mixed_product.hpp
│ │ │ │ │ │ ├── mixed_product.inl
│ │ │ │ │ │ ├── norm.hpp
│ │ │ │ │ │ ├── norm.inl
│ │ │ │ │ │ ├── normal.hpp
│ │ │ │ │ │ ├── normal.inl
│ │ │ │ │ │ ├── normalize_dot.hpp
│ │ │ │ │ │ ├── normalize_dot.inl
│ │ │ │ │ │ ├── number_precision.hpp
│ │ │ │ │ │ ├── number_precision.inl
│ │ │ │ │ │ ├── optimum_pow.hpp
│ │ │ │ │ │ ├── optimum_pow.inl
│ │ │ │ │ │ ├── orthonormalize.hpp
│ │ │ │ │ │ ├── orthonormalize.inl
│ │ │ │ │ │ ├── pca.hpp
│ │ │ │ │ │ ├── pca.inl
│ │ │ │ │ │ ├── perpendicular.hpp
│ │ │ │ │ │ ├── perpendicular.inl
│ │ │ │ │ │ ├── polar_coordinates.hpp
│ │ │ │ │ │ ├── polar_coordinates.inl
│ │ │ │ │ │ ├── projection.hpp
│ │ │ │ │ │ ├── projection.inl
│ │ │ │ │ │ ├── quaternion.hpp
│ │ │ │ │ │ ├── quaternion.inl
│ │ │ │ │ │ ├── range.hpp
│ │ │ │ │ │ ├── raw_data.hpp
│ │ │ │ │ │ ├── raw_data.inl
│ │ │ │ │ │ ├── rotate_normalized_axis.hpp
│ │ │ │ │ │ ├── rotate_normalized_axis.inl
│ │ │ │ │ │ ├── rotate_vector.hpp
│ │ │ │ │ │ ├── rotate_vector.inl
│ │ │ │ │ │ ├── scalar_multiplication.hpp
│ │ │ │ │ │ ├── scalar_relational.hpp
│ │ │ │ │ │ ├── scalar_relational.inl
│ │ │ │ │ │ ├── spline.hpp
│ │ │ │ │ │ ├── spline.inl
│ │ │ │ │ │ ├── std_based_type.hpp
│ │ │ │ │ │ ├── std_based_type.inl
│ │ │ │ │ │ ├── string_cast.hpp
│ │ │ │ │ │ ├── string_cast.inl
│ │ │ │ │ │ ├── texture.hpp
│ │ │ │ │ │ ├── texture.inl
│ │ │ │ │ │ ├── transform.hpp
│ │ │ │ │ │ ├── transform.inl
│ │ │ │ │ │ ├── transform2.hpp
│ │ │ │ │ │ ├── transform2.inl
│ │ │ │ │ │ ├── type_aligned.hpp
│ │ │ │ │ │ ├── type_aligned.inl
│ │ │ │ │ │ ├── type_trait.hpp
│ │ │ │ │ │ ├── type_trait.inl
│ │ │ │ │ │ ├── vec_swizzle.hpp
│ │ │ │ │ │ ├── vector_angle.hpp
│ │ │ │ │ │ ├── vector_angle.inl
│ │ │ │ │ │ ├── vector_query.hpp
│ │ │ │ │ │ ├── vector_query.inl
│ │ │ │ │ │ ├── wrap.hpp
│ │ │ │ │ │ └── wrap.inl
│ │ │ │ │ ├── integer.hpp
│ │ │ │ │ ├── mat2x2.hpp
│ │ │ │ │ ├── mat2x3.hpp
│ │ │ │ │ ├── mat2x4.hpp
│ │ │ │ │ ├── mat3x2.hpp
│ │ │ │ │ ├── mat3x3.hpp
│ │ │ │ │ ├── mat3x4.hpp
│ │ │ │ │ ├── mat4x2.hpp
│ │ │ │ │ ├── mat4x3.hpp
│ │ │ │ │ ├── mat4x4.hpp
│ │ │ │ │ ├── matrix.hpp
│ │ │ │ │ ├── packing.hpp
│ │ │ │ │ ├── simd/
│ │ │ │ │ │ ├── common.h
│ │ │ │ │ │ ├── exponential.h
│ │ │ │ │ │ ├── geometric.h
│ │ │ │ │ │ ├── integer.h
│ │ │ │ │ │ ├── matrix.h
│ │ │ │ │ │ ├── neon.h
│ │ │ │ │ │ ├── packing.h
│ │ │ │ │ │ ├── platform.h
│ │ │ │ │ │ ├── trigonometric.h
│ │ │ │ │ │ └── vector_relational.h
│ │ │ │ │ ├── trigonometric.hpp
│ │ │ │ │ ├── vec2.hpp
│ │ │ │ │ ├── vec3.hpp
│ │ │ │ │ ├── vec4.hpp
│ │ │ │ │ └── vector_relational.hpp
│ │ │ │ ├── manual.md
│ │ │ │ ├── readme.md
│ │ │ │ ├── test/
│ │ │ │ │ ├── bug/
│ │ │ │ │ │ └── bug_ms_vec_static.cpp
│ │ │ │ │ ├── cmake/
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ └── test_find_glm.cpp
│ │ │ │ │ ├── core/
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── core_cpp_constexpr.cpp
│ │ │ │ │ │ ├── core_cpp_defaulted_ctor.cpp
│ │ │ │ │ │ ├── core_force_aligned_gentypes.cpp
│ │ │ │ │ │ ├── core_force_arch_unknown.cpp
│ │ │ │ │ │ ├── core_force_compiler_unknown.cpp
│ │ │ │ │ │ ├── core_force_ctor_init.cpp
│ │ │ │ │ │ ├── core_force_cxx03.cpp
│ │ │ │ │ │ ├── core_force_cxx98.cpp
│ │ │ │ │ │ ├── core_force_cxx_unknown.cpp
│ │ │ │ │ │ ├── core_force_depth_zero_to_one.cpp
│ │ │ │ │ │ ├── core_force_explicit_ctor.cpp
│ │ │ │ │ │ ├── core_force_inline.cpp
│ │ │ │ │ │ ├── core_force_left_handed.cpp
│ │ │ │ │ │ ├── core_force_platform_unknown.cpp
│ │ │ │ │ │ ├── core_force_pure.cpp
│ │ │ │ │ │ ├── core_force_quat_xyzw.cpp
│ │ │ │ │ │ ├── core_force_size_t_length.cpp
│ │ │ │ │ │ ├── core_force_unrestricted_gentype.cpp
│ │ │ │ │ │ ├── core_force_xyzw_only.cpp
│ │ │ │ │ │ ├── core_func_common.cpp
│ │ │ │ │ │ ├── core_func_exponential.cpp
│ │ │ │ │ │ ├── core_func_geometric.cpp
│ │ │ │ │ │ ├── core_func_integer.cpp
│ │ │ │ │ │ ├── core_func_integer_bit_count.cpp
│ │ │ │ │ │ ├── core_func_integer_find_lsb.cpp
│ │ │ │ │ │ ├── core_func_integer_find_msb.cpp
│ │ │ │ │ │ ├── core_func_matrix.cpp
│ │ │ │ │ │ ├── core_func_noise.cpp
│ │ │ │ │ │ ├── core_func_packing.cpp
│ │ │ │ │ │ ├── core_func_swizzle.cpp
│ │ │ │ │ │ ├── core_func_trigonometric.cpp
│ │ │ │ │ │ ├── core_func_vector_relational.cpp
│ │ │ │ │ │ ├── core_setup_force_cxx98.cpp
│ │ │ │ │ │ ├── core_setup_force_size_t_length.cpp
│ │ │ │ │ │ ├── core_setup_message.cpp
│ │ │ │ │ │ ├── core_setup_platform_unknown.cpp
│ │ │ │ │ │ ├── core_setup_precision.cpp
│ │ │ │ │ │ ├── core_type_aligned.cpp
│ │ │ │ │ │ ├── core_type_cast.cpp
│ │ │ │ │ │ ├── core_type_ctor.cpp
│ │ │ │ │ │ ├── core_type_int.cpp
│ │ │ │ │ │ ├── core_type_length.cpp
│ │ │ │ │ │ ├── core_type_mat2x2.cpp
│ │ │ │ │ │ ├── core_type_mat2x3.cpp
│ │ │ │ │ │ ├── core_type_mat2x4.cpp
│ │ │ │ │ │ ├── core_type_mat3x2.cpp
│ │ │ │ │ │ ├── core_type_mat3x3.cpp
│ │ │ │ │ │ ├── core_type_mat3x4.cpp
│ │ │ │ │ │ ├── core_type_mat4x2.cpp
│ │ │ │ │ │ ├── core_type_mat4x3.cpp
│ │ │ │ │ │ ├── core_type_mat4x4.cpp
│ │ │ │ │ │ ├── core_type_vec1.cpp
│ │ │ │ │ │ ├── core_type_vec2.cpp
│ │ │ │ │ │ ├── core_type_vec3.cpp
│ │ │ │ │ │ └── core_type_vec4.cpp
│ │ │ │ │ ├── ext/
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── ext_matrix_clip_space.cpp
│ │ │ │ │ │ ├── ext_matrix_common.cpp
│ │ │ │ │ │ ├── ext_matrix_int2x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int2x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int2x4_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int3x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int3x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int3x4_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int4x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int4x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_int4x4_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_integer.cpp
│ │ │ │ │ │ ├── ext_matrix_projection.cpp
│ │ │ │ │ │ ├── ext_matrix_relational.cpp
│ │ │ │ │ │ ├── ext_matrix_transform.cpp
│ │ │ │ │ │ ├── ext_matrix_uint2x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint2x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint2x4_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint3x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint3x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint3x4_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint4x2_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint4x3_sized.cpp
│ │ │ │ │ │ ├── ext_matrix_uint4x4_sized.cpp
│ │ │ │ │ │ ├── ext_quaternion_common.cpp
│ │ │ │ │ │ ├── ext_quaternion_exponential.cpp
│ │ │ │ │ │ ├── ext_quaternion_geometric.cpp
│ │ │ │ │ │ ├── ext_quaternion_relational.cpp
│ │ │ │ │ │ ├── ext_quaternion_transform.cpp
│ │ │ │ │ │ ├── ext_quaternion_trigonometric.cpp
│ │ │ │ │ │ ├── ext_quaternion_type.cpp
│ │ │ │ │ │ ├── ext_scalar_common.cpp
│ │ │ │ │ │ ├── ext_scalar_constants.cpp
│ │ │ │ │ │ ├── ext_scalar_int_sized.cpp
│ │ │ │ │ │ ├── ext_scalar_integer.cpp
│ │ │ │ │ │ ├── ext_scalar_packing.cpp
│ │ │ │ │ │ ├── ext_scalar_reciprocal.cpp
│ │ │ │ │ │ ├── ext_scalar_relational.cpp
│ │ │ │ │ │ ├── ext_scalar_uint_sized.cpp
│ │ │ │ │ │ ├── ext_scalar_ulp.cpp
│ │ │ │ │ │ ├── ext_vec1.cpp
│ │ │ │ │ │ ├── ext_vector_bool1.cpp
│ │ │ │ │ │ ├── ext_vector_common.cpp
│ │ │ │ │ │ ├── ext_vector_iec559.cpp
│ │ │ │ │ │ ├── ext_vector_int1_sized.cpp
│ │ │ │ │ │ ├── ext_vector_int2_sized.cpp
│ │ │ │ │ │ ├── ext_vector_int3_sized.cpp
│ │ │ │ │ │ ├── ext_vector_int4_sized.cpp
│ │ │ │ │ │ ├── ext_vector_integer.cpp
│ │ │ │ │ │ ├── ext_vector_integer_sized.cpp
│ │ │ │ │ │ ├── ext_vector_packing.cpp
│ │ │ │ │ │ ├── ext_vector_reciprocal.cpp
│ │ │ │ │ │ ├── ext_vector_relational.cpp
│ │ │ │ │ │ ├── ext_vector_uint1_sized.cpp
│ │ │ │ │ │ ├── ext_vector_uint2_sized.cpp
│ │ │ │ │ │ ├── ext_vector_uint3_sized.cpp
│ │ │ │ │ │ ├── ext_vector_uint4_sized.cpp
│ │ │ │ │ │ └── ext_vector_ulp.cpp
│ │ │ │ │ ├── gtc/
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── gtc_bitfield.cpp
│ │ │ │ │ │ ├── gtc_color_space.cpp
│ │ │ │ │ │ ├── gtc_constants.cpp
│ │ │ │ │ │ ├── gtc_epsilon.cpp
│ │ │ │ │ │ ├── gtc_integer.cpp
│ │ │ │ │ │ ├── gtc_matrix_access.cpp
│ │ │ │ │ │ ├── gtc_matrix_inverse.cpp
│ │ │ │ │ │ ├── gtc_matrix_transform.cpp
│ │ │ │ │ │ ├── gtc_noise.cpp
│ │ │ │ │ │ ├── gtc_packing.cpp
│ │ │ │ │ │ ├── gtc_quaternion.cpp
│ │ │ │ │ │ ├── gtc_random.cpp
│ │ │ │ │ │ ├── gtc_reciprocal.cpp
│ │ │ │ │ │ ├── gtc_round.cpp
│ │ │ │ │ │ ├── gtc_type_aligned.cpp
│ │ │ │ │ │ ├── gtc_type_precision.cpp
│ │ │ │ │ │ ├── gtc_type_ptr.cpp
│ │ │ │ │ │ ├── gtc_ulp.cpp
│ │ │ │ │ │ └── gtc_user_defined_types.cpp
│ │ │ │ │ ├── gtx/
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── gtx.cpp
│ │ │ │ │ │ ├── gtx_associated_min_max.cpp
│ │ │ │ │ │ ├── gtx_closest_point.cpp
│ │ │ │ │ │ ├── gtx_color_encoding.cpp
│ │ │ │ │ │ ├── gtx_color_space.cpp
│ │ │ │ │ │ ├── gtx_color_space_YCoCg.cpp
│ │ │ │ │ │ ├── gtx_common.cpp
│ │ │ │ │ │ ├── gtx_compatibility.cpp
│ │ │ │ │ │ ├── gtx_component_wise.cpp
│ │ │ │ │ │ ├── gtx_dual_quaternion.cpp
│ │ │ │ │ │ ├── gtx_easing.cpp
│ │ │ │ │ │ ├── gtx_euler_angle.cpp
│ │ │ │ │ │ ├── gtx_extend.cpp
│ │ │ │ │ │ ├── gtx_extended_min_max.cpp
│ │ │ │ │ │ ├── gtx_extented_min_max.cpp
│ │ │ │ │ │ ├── gtx_exterior_product.cpp
│ │ │ │ │ │ ├── gtx_fast_exponential.cpp
│ │ │ │ │ │ ├── gtx_fast_square_root.cpp
│ │ │ │ │ │ ├── gtx_fast_trigonometry.cpp
│ │ │ │ │ │ ├── gtx_functions.cpp
│ │ │ │ │ │ ├── gtx_gradient_paint.cpp
│ │ │ │ │ │ ├── gtx_handed_coordinate_space.cpp
│ │ │ │ │ │ ├── gtx_hash.cpp
│ │ │ │ │ │ ├── gtx_int_10_10_10_2.cpp
│ │ │ │ │ │ ├── gtx_integer.cpp
│ │ │ │ │ │ ├── gtx_intersect.cpp
│ │ │ │ │ │ ├── gtx_io.cpp
│ │ │ │ │ │ ├── gtx_load.cpp
│ │ │ │ │ │ ├── gtx_log_base.cpp
│ │ │ │ │ │ ├── gtx_matrix_cross_product.cpp
│ │ │ │ │ │ ├── gtx_matrix_decompose.cpp
│ │ │ │ │ │ ├── gtx_matrix_factorisation.cpp
│ │ │ │ │ │ ├── gtx_matrix_interpolation.cpp
│ │ │ │ │ │ ├── gtx_matrix_major_storage.cpp
│ │ │ │ │ │ ├── gtx_matrix_operation.cpp
│ │ │ │ │ │ ├── gtx_matrix_query.cpp
│ │ │ │ │ │ ├── gtx_matrix_transform_2d.cpp
│ │ │ │ │ │ ├── gtx_mixed_product.cpp
│ │ │ │ │ │ ├── gtx_norm.cpp
│ │ │ │ │ │ ├── gtx_normal.cpp
│ │ │ │ │ │ ├── gtx_normalize_dot.cpp
│ │ │ │ │ │ ├── gtx_number_precision.cpp
│ │ │ │ │ │ ├── gtx_optimum_pow.cpp
│ │ │ │ │ │ ├── gtx_orthonormalize.cpp
│ │ │ │ │ │ ├── gtx_pca.cpp
│ │ │ │ │ │ ├── gtx_perpendicular.cpp
│ │ │ │ │ │ ├── gtx_polar_coordinates.cpp
│ │ │ │ │ │ ├── gtx_projection.cpp
│ │ │ │ │ │ ├── gtx_quaternion.cpp
│ │ │ │ │ │ ├── gtx_random.cpp
│ │ │ │ │ │ ├── gtx_range.cpp
│ │ │ │ │ │ ├── gtx_rotate_normalized_axis.cpp
│ │ │ │ │ │ ├── gtx_rotate_vector.cpp
│ │ │ │ │ │ ├── gtx_scalar_multiplication.cpp
│ │ │ │ │ │ ├── gtx_scalar_relational.cpp
│ │ │ │ │ │ ├── gtx_simd_mat4.cpp
│ │ │ │ │ │ ├── gtx_simd_vec4.cpp
│ │ │ │ │ │ ├── gtx_spline.cpp
│ │ │ │ │ │ ├── gtx_string_cast.cpp
│ │ │ │ │ │ ├── gtx_texture.cpp
│ │ │ │ │ │ ├── gtx_type_aligned.cpp
│ │ │ │ │ │ ├── gtx_type_trait.cpp
│ │ │ │ │ │ ├── gtx_vec_swizzle.cpp
│ │ │ │ │ │ ├── gtx_vector_angle.cpp
│ │ │ │ │ │ ├── gtx_vector_query.cpp
│ │ │ │ │ │ └── gtx_wrap.cpp
│ │ │ │ │ └── perf/
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── perf_matrix_div.cpp
│ │ │ │ │ ├── perf_matrix_inverse.cpp
│ │ │ │ │ ├── perf_matrix_mul.cpp
│ │ │ │ │ ├── perf_matrix_mul_vector.cpp
│ │ │ │ │ ├── perf_matrix_transpose.cpp
│ │ │ │ │ └── perf_vector_mul_matrix.cpp
│ │ │ │ └── util/
│ │ │ │ ├── autoexp.txt
│ │ │ │ └── glm.natvis
│ │ │ └── stbi_image_write.h
│ │ └── simple-knn/
│ │ ├── build/
│ │ │ ├── temp.linux-x86_64-cpython-310/
│ │ │ │ ├── .ninja_deps
│ │ │ │ ├── .ninja_log
│ │ │ │ ├── build.ninja
│ │ │ │ ├── ext.o
│ │ │ │ ├── simple_knn.o
│ │ │ │ └── spatial.o
│ │ │ └── temp.linux-x86_64-cpython-38/
│ │ │ ├── ext.o
│ │ │ ├── simple_knn.o
│ │ │ └── spatial.o
│ │ ├── ext.cpp
│ │ ├── setup.py
│ │ ├── simple_knn/
│ │ │ └── .gitkeep
│ │ ├── simple_knn.cu
│ │ ├── simple_knn.egg-info/
│ │ │ ├── PKG-INFO
│ │ │ ├── SOURCES.txt
│ │ │ ├── dependency_links.txt
│ │ │ └── top_level.txt
│ │ ├── simple_knn.h
│ │ ├── spatial.cu
│ │ └── spatial.h
│ ├── utils/
│ │ ├── camera_utils.py
│ │ ├── edit_utils.py
│ │ ├── fusion_util.py
│ │ ├── general_utils.py
│ │ ├── graphics_utils.py
│ │ ├── image_utils.py
│ │ ├── loss_utils.py
│ │ ├── pose_utils.py
│ │ ├── sh_utils.py
│ │ ├── step_track.py
│ │ └── system_utils.py
│ └── video_preprocessor/
│ └── __init__.py
├── get_normal.py
├── quick_start.sh
├── requirements.txt
├── train_all.sh
├── utils/
│ ├── align_traj.py
│ ├── camera_utils.py
│ ├── general_utils.py
│ ├── graphics_utils.py
│ ├── image_utils.py
│ ├── interp_utils.py
│ ├── loss_utils.py
│ ├── pose_utils.py
│ ├── sfm_utils.py
│ ├── sh_utils.py
│ ├── stepfun.py
│ ├── system_utils.py
│ └── utils_poses/
│ ├── ATE/
│ │ ├── align_trajectory.py
│ │ ├── align_utils.py
│ │ ├── compute_trajectory_errors.py
│ │ ├── results_writer.py
│ │ ├── trajectory_utils.py
│ │ └── transformations.py
│ ├── align_traj.py
│ ├── comp_ate.py
│ ├── lie_group_helper.py
│ ├── relative_pose.py
│ ├── vis_cam_traj.py
│ └── vis_pose_utils.py
├── vggt/
│ ├── heads/
│ │ ├── camera_head.py
│ │ ├── dpt_head.py
│ │ ├── head_act.py
│ │ ├── track_head.py
│ │ ├── track_modules/
│ │ │ ├── __init__.py
│ │ │ ├── base_track_predictor.py
│ │ │ ├── blocks.py
│ │ │ ├── modules.py
│ │ │ └── utils.py
│ │ └── utils.py
│ ├── layers/
│ │ ├── __init__.py
│ │ ├── attention.py
│ │ ├── block.py
│ │ ├── drop_path.py
│ │ ├── layer_scale.py
│ │ ├── mlp.py
│ │ ├── patch_embed.py
│ │ ├── rope.py
│ │ ├── swiglu_ffn.py
│ │ └── vision_transformer.py
│ ├── models/
│ │ ├── aggregator.py
│ │ └── vggt.py
│ └── utils/
│ ├── geometry.py
│ ├── load_fn.py
│ ├── pose_enc.py
│ ├── rotation.py
│ └── visual_track.py
└── video_inference.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.vscode
*.log
**/__pycache__/
**/data/
**/output/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2025 Fangfu-0830
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<div align="center">
# ✨LangScene-X: Reconstruct Generalizable 3D Language-Embedded Scenes with TriMap Video Diffusion✨
<p align="center">
<a href="https://liuff19.github.io/">Fangfu Liu</a><sup>1</sup>,
<a href="https://lifuguan.github.io/">Hao Li</a><sup>2</sup>,
<a href="https://github.com/chijw">Jiawei Chi</a><sup>1</sup>,
<a href="https://hanyang-21.github.io/">Hanyang Wang</a><sup>1,3</sup>,
<a href="https://github.com/liuff19/LangScene-X">Minghui Yang</a><sup>3</sup>,
<a href="https://github.com/liuff19/LangScene-X">Fudong Wang</a><sup>3</sup>,
<a href="https://duanyueqi.github.io/">Yueqi Duan</a><sup>1</sup>
<br>
<sup>1</sup>Tsinghua University, <sup>2</sup>NTU, <sup>3</sup>Ant Group
</p>
<h3 align="center">ICCV 2025 🔥</h3>
<a href="https://arxiv.org/abs/2507.02813"><img src='https://img.shields.io/badge/arXiv-2507.02813-b31b1b.svg'></a>
<a href="https://liuff19.github.io/LangScene-X"><img src='https://img.shields.io/badge/Project-Page-Green'></a>
<a href="https://huggingface.co/chijw/LangScene-X"><img src='https://img.shields.io/badge/LangSceneX-huggingface-yellow'></a>
<a><img src='https://img.shields.io/badge/License-MIT-blue'></a>

</div>
**LangScene-X:** We propose LangScene-X, a unified model that generates RGB, segmentation map, and normal map, enabling to reconstruct 3D field from sparse views input.
## 📢 News
- 🔥 [04/07/2025] We release "LangScene-X: Reconstruct Generalizable 3D Language-Embedded Scenes with TriMap Video Diffusion". Check our [project page](https://liuff19.github.io/LangScene-X) and [arXiv paper](https://arxiv.org/abs/2507.02813).
## 🌟 Pipeline

Pipeline of LangScene-X. Our model is composed of a TriMap Video Diffusion model which generates RGB, segmentation map, and normal map videos, an Auto Encoder that compresses the language feature, and a field constructor that reconstructs 3DGS from the generated videos.
## 🎨 Video Demos from TriMap Video Diffusion
https://github.com/user-attachments/assets/55346d53-eb04-490e-bb70-64555e97e040
https://github.com/user-attachments/assets/d6eb28b9-2af8-49a7-bb8b-0d4cba7843a5
https://github.com/user-attachments/assets/396f11ef-85dc-41de-882e-e249c25b9961
## ⚙️ Setup
### 1. Clone Repository
```bash
git clone https://github.com/liuff19/LangScene-X.git
cd LangScene-X
```
### 2. Environment Setup
1. **Create conda environment**
```bash
conda create -n langscenex python=3.10 -y
conda activate langscenex
```
2. **Install dependencies**
```bash
conda install pytorch torchvision -c pytorch -y
pip install -e field_construction/submodules/simple-knn
pip install -e field_construction/submodules/diff-langsurf-rasterizer
pip install -e auto-seg/submodules/segment-anything-1
pip install -e auto-seg/submodules/segment-anything-2
pip install -r requirements.txt
```
### 3. Model Checkpoints
The checkpoints of SAM, SAM2 and fine-tuned CogVideoX can be downloaded from our [huggingface repository](https://huggingface.co/chijw/LangScene-X).
## 💻Running
### Quick Start
You can start quickly by running the following scripts:
```bash
chmod +x quick_start.sh
./quick_start.sh <first_rgb_image_path> <last_rgb_image_path>
```
### Render
Run the following command to render from the reconstructed 3DGS field:
```bash
python entry_point.py \
pipeline.rgb_video_path="does/not/matter" \
pipeline.normal_video_path="does/not/matter" \
pipeline.seg_video_path="does/not/matter" \
pipeline.data_path="does/not/matter" \
gaussian.dataset.source_path="does/not/matter" \
gaussian.dataset.model_path="output/path" \
pipeline.selection=False \
gaussian.opt.max_geo_iter=1500 \
gaussian.opt.normal_optim=True \
gaussian.opt.optim_pose=True \
pipeline.skip_video_process=True \
pipeline.skip_lang_feature_extraction=True \
pipeline.mode="render"
```
You can also configurate by editting `configs/field_construction.yaml`.
## ✒️ TODO List
- [x] Per-scene Auto Encoder released
- [x] Fine-tuned CogVideoX checkpoints released
- [ ] Generalizable Auto Encoder (LQC)
- [ ] Improved TriMap Video Diffusion model
## 🔗Acknowledgement
We are thankful for the following great works when implementing LangScene-X:
- [CogVideoX](https://github.com/THUDM/CogVideo), [CogvideX-Interpolation](https://github.com/feizc/CogvideX-Interpolation), [LangSplat](https://github.com/minghanqin/LangSplat), [LangSurf](https://github.com/lifuguan/LangSurf), [VGGT](https://github.com/facebookresearch/vggt), [3DGS](https://github.com/graphdeco-inria/gaussian-splatting), [SAM2](https://github.com/facebookresearch/sam2)
## 📚Citation
```bibtex
@misc{liu2025langscenexreconstructgeneralizable3d,
title={LangScene-X: Reconstruct Generalizable 3D Language-Embedded Scenes with TriMap Video Diffusion},
author={Fangfu Liu and Hao Li and Jiawei Chi and Hanyang Wang and Minghui Yang and Fudong Wang and Yueqi Duan},
year={2025},
eprint={2507.02813},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2507.02813},
}
```
================================================
FILE: auto-seg/auto-mask-align.py
================================================
import argparse
import os
import random
import cv2
import imageio
import matplotlib.pyplot as plt
import numpy as np
import torch
from loguru import logger
from PIL import Image
from segment_anything import SamAutomaticMaskGenerator, sam_model_registry
from tqdm import tqdm
# use bfloat16 for the entire notebook
torch.autocast(device_type="cuda", dtype=torch.bfloat16).__enter__()
if torch.cuda.get_device_properties(0).major >= 8:
# turn on tfloat32 for Ampere GPUs (https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices)
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
from sam2.build_sam import build_sam2, build_sam2_video_predictor
def show_anns(anns, borders=True):
if len(anns) == 0:
return
sorted_anns = sorted(anns, key=(lambda x: x['area']), reverse=True)
ax = plt.gca()
ax.set_autoscale_on(False)
img = np.ones((sorted_anns[0]['segmentation'].shape[0], sorted_anns[0]['segmentation'].shape[1], 4))
img[:,:,3] = 0
for ann in sorted_anns:
m = ann['segmentation']
color_mask = np.concatenate([np.random.random(3), [0.5]])
img[m] = color_mask
if borders:
import cv2
contours, _ = cv2.findContours(m.astype(np.uint8),cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
# Try to smooth contours
contours = [cv2.approxPolyDP(contour, epsilon=0.01, closed=True) for contour in contours]
cv2.drawContours(img, contours, -1, (0,0,1,0.4), thickness=1)
ax.imshow(img)
def mask_nms(masks, scores, iou_thr=0.7, score_thr=0.1, inner_thr=0.2, **kwargs):
"""
Perform mask non-maximum suppression (NMS) on a set of masks based on their scores.
Args:
masks (torch.Tensor): has shape (num_masks, H, W)
scores (torch.Tensor): The scores of the masks, has shape (num_masks,)
iou_thr (float, optional): The threshold for IoU.
score_thr (float, optional): The threshold for the mask scores.
inner_thr (float, optional): The threshold for the overlap rate.
**kwargs: Additional keyword arguments.
Returns:
selected_idx (torch.Tensor): A tensor representing the selected indices of the masks after NMS.
"""
scores, idx = scores.sort(0, descending=True)
num_masks = idx.shape[0]
masks_ord = masks[idx.view(-1), :]
masks_area = torch.sum(masks_ord, dim=(1, 2), dtype=torch.float)
mask_chunk_size = 20
mask_chunks = masks_ord.split(mask_chunk_size, dim=0)
area_chunks = masks_area.split(mask_chunk_size, dim=0)
iou_matrix = []
inner_iou_matrix = []
for i_areas, i_chunk in zip(area_chunks, mask_chunks):
row_iou_matrix = []
row_inner_iou_matrix = []
for j_areas, j_chunk in zip(area_chunks, mask_chunks):
intersection = torch.logical_and(i_chunk.unsqueeze(1), j_chunk.unsqueeze(0)).sum(dim=(-1, -2))
union = torch.logical_or(i_chunk.unsqueeze(1), j_chunk.unsqueeze(0)).sum(dim=(-1, -2))
local_iou_mat = intersection / union
row_iou_matrix.append(local_iou_mat)
row_inter_mat = intersection / i_areas[:, None]
col_inter_mat = intersection / j_areas[None, :]
inter = torch.logical_and(row_inter_mat < 0.5, col_inter_mat >= 0.85)
local_inner_iou_mat = torch.zeros((len(i_areas), len(j_areas)))
local_inner_iou_mat[inter] = 1 - row_inter_mat[inter] * col_inter_mat[inter]
row_inner_iou_matrix.append(local_inner_iou_mat)
row_iou_matrix = torch.cat(row_iou_matrix, dim=1)
row_inner_iou_matrix = torch.cat(row_inner_iou_matrix, dim=1)
iou_matrix.append(row_iou_matrix)
inner_iou_matrix.append(row_inner_iou_matrix)
iou_matrix = torch.cat(iou_matrix, dim=0)
inner_iou_matrix = torch.cat(inner_iou_matrix, dim=0)
iou_matrix.triu_(diagonal=1)
iou_max, _ = iou_matrix.max(dim=0)
inner_iou_matrix_u = torch.triu(inner_iou_matrix, diagonal=1)
inner_iou_max_u, _ = inner_iou_matrix_u.max(dim=0)
inner_iou_matrix_l = torch.tril(inner_iou_matrix, diagonal=1)
inner_iou_max_l, _ = inner_iou_matrix_l.max(dim=0)
keep = iou_max <= iou_thr
keep_conf = scores > score_thr
keep_inner_u = inner_iou_max_u <= 1 - inner_thr
keep_inner_l = inner_iou_max_l <= 1 - inner_thr
if keep_conf.sum() == 0:
index = scores.topk(3).indices
keep_conf[index, 0] = True
if keep_inner_u.sum() == 0:
index = scores.topk(3).indices
keep_inner_u[index, 0] = True
if keep_inner_l.sum() == 0:
index = scores.topk(3).indices
keep_inner_l[index, 0] = True
keep *= keep_conf
keep *= keep_inner_u
keep *= keep_inner_l
selected_idx = idx[keep]
return selected_idx
def filter(keep: torch.Tensor, masks_result) -> None:
keep = keep.int().cpu().numpy()
result_keep = []
for i, m in enumerate(masks_result):
if i in keep: result_keep.append(m)
return result_keep
def masks_update(*args, **kwargs):
# remove redundant masks based on the scores and overlap rate between masks
masks_new = ()
for masks_lvl in (args):
if isinstance(masks_lvl, tuple):
masks_lvl = masks_lvl[0] # If it's a tuple, take the first element
if len(masks_lvl) == 0:
masks_new += (masks_lvl,)
continue
# Check if masks_lvl is a list of dictionaries
if isinstance(masks_lvl[0], dict):
seg_pred = torch.from_numpy(np.stack([m['segmentation'] for m in masks_lvl], axis=0))
iou_pred = torch.from_numpy(np.stack([m['predicted_iou'] for m in masks_lvl], axis=0))
stability = torch.from_numpy(np.stack([m['stability_score'] for m in masks_lvl], axis=0))
else:
# If it's a direct list of masks, use them directly
seg_pred = torch.from_numpy(np.stack(masks_lvl, axis=0))
# Create default values for cases without iou and stability
iou_pred = torch.ones(len(masks_lvl))
stability = torch.ones(len(masks_lvl))
scores = stability * iou_pred
keep_mask_nms = mask_nms(seg_pred, scores, **kwargs)
masks_lvl = filter(keep_mask_nms, masks_lvl)
masks_new += (masks_lvl,)
return masks_new
def show_mask(mask, ax, obj_id=None, random_color=False):
if random_color:
color = np.concatenate([np.random.random(3), np.array([0.6])], axis=0)
else:
cmap = plt.get_cmap("tab20")
cmap_idx = 0 if obj_id is None else obj_id
color = np.array([*cmap(cmap_idx)[:3], 0.6])
h, w = mask.shape[-2:]
mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
ax.imshow(mask_image)
def save_mask(mask,frame_idx,save_dir):
image_array = (mask * 255).astype(np.uint8)
# Create image object
image = Image.fromarray(image_array[0])
# Save image
image.save(os.path.join(save_dir,f'{frame_idx:03}.png'))
def save_masks(mask_list,frame_idx,save_dir):
os.makedirs(save_dir,exist_ok=True)
if len(mask_list[0].shape) == 3:
# Calculate dimensions for concatenated image
total_width = mask_list[0].shape[2] * len(mask_list)
max_height = mask_list[0].shape[1]
# Create large image
final_image = Image.new('RGB', (total_width, max_height))
for i, img in enumerate(mask_list):
img = Image.fromarray((img[0] * 255).astype(np.uint8)).convert("RGB")
final_image.paste(img, (i * img.width, 0))
final_image.save(os.path.join(save_dir,f"mask_{frame_idx:03}.png"))
else:
# Calculate dimensions for concatenated image
total_width = mask_list[0].shape[1] * len(mask_list)
max_height = mask_list[0].shape[0]
# Create large image
final_image = Image.new('RGB', (total_width, max_height))
for i, img in enumerate(mask_list):
img = Image.fromarray((img * 255).astype(np.uint8)).convert("RGB")
final_image.paste(img, (i * img.width, 0))
final_image.save(os.path.join(save_dir,f"mask_{frame_idx:03}.png"))
def save_masks_npy(mask_list,frame_idx,save_dir):
np.save(os.path.join(save_dir,f"mask_{frame_idx:03}.npy"),np.array(mask_list))
def show_points(coords, labels, ax, marker_size=200):
pos_points = coords[labels==1]
neg_points = coords[labels==0]
ax.scatter(pos_points[:, 0], pos_points[:, 1], color='green', marker='*', s=marker_size, edgecolor='white', linewidth=1.25)
ax.scatter(neg_points[:, 0], neg_points[:, 1], color='red', marker='*', s=marker_size, edgecolor='white', linewidth=1.25)
def make_enlarge_bbox(origin_bbox, max_width,max_height,ratio):
width = origin_bbox[2]
height = origin_bbox[3]
new_box = [max(origin_bbox[0]-width*(ratio-1)/2,0),max(origin_bbox[1]-height*(ratio-1)/2,0)]
new_box.append(min(width*ratio,max_width-new_box[0]))
new_box.append(min(height*ratio,max_height-new_box[1]))
return new_box
def sample_points(masks, enlarge_bbox,positive_num=1,negtive_num=40):
ex, ey, ewidth, eheight = enlarge_bbox
positive_count = positive_num
negtive_count = negtive_num
output_points = []
while True:
x = int(np.random.uniform(ex, ex + ewidth))
y = int(np.random.uniform(ey, ey + eheight))
if masks[y][x]==True and positive_count>0:
output_points.append((x,y,1))
positive_count-=1
elif masks[y][x]==False and negtive_count>0:
output_points.append((x,y,0))
negtive_count-=1
if positive_count == 0 and negtive_count == 0:
break
return output_points
def sample_points_from_mask(mask):
# Get indices of all True values
true_indices = np.argwhere(mask)
# Check if there are any True values
if true_indices.size == 0:
raise ValueError("The mask does not contain any True values.")
# Randomly select a point from True value indices
random_index = np.random.choice(len(true_indices))
sample_point = true_indices[random_index]
return tuple(sample_point)
def search_new_obj(masks_from_prev, mask_list,other_masks_list=None,mask_ratio_thresh=0,ratio=0.5, area_threash = 5000):
new_mask_list = []
# Calculate mask_none, representing areas not included in any previous masks
mask_none = ~masks_from_prev[0].copy()[0]
for prev_mask in masks_from_prev[1:]:
mask_none &= ~prev_mask[0]
for mask in mask_list:
seg = mask['segmentation']
if (mask_none & seg).sum()/seg.sum() > ratio and seg.sum() > area_threash:
new_mask_list.append(mask)
for mask in new_mask_list:
mask_none &= ~mask['segmentation']
logger.info(len(new_mask_list))
logger.info("now ratio:",mask_none.sum() / (mask_none.shape[0] * mask_none.shape[1]) )
logger.info("expected ratios:",mask_ratio_thresh)
if other_masks_list is not None:
for mask in other_masks_list:
if mask_none.sum() / (mask_none.shape[0] * mask_none.shape[1]) > mask_ratio_thresh: # Still a lot of gaps, greater than current thresh
seg = mask['segmentation']
if (mask_none & seg).sum()/seg.sum() > ratio and seg.sum() > area_threash:
new_mask_list.append(mask)
mask_none &= ~seg
else:
break
logger.info(len(new_mask_list))
return new_mask_list
def get_bbox_from_mask(mask):
# Get row and column indices of non-zero elements
rows = np.any(mask, axis=1)
cols = np.any(mask, axis=0)
# Find min and max indices of non-zero rows and columns
ymin, ymax = np.where(rows)[0][[0, -1]]
xmin, xmax = np.where(cols)[0][[0, -1]]
# Calculate width and height
width = xmax - xmin + 1
height = ymax - ymin + 1
return xmin, ymin, width, height
def cal_no_mask_area_ratio(out_mask_list):
h = out_mask_list[0].shape[1]
w = out_mask_list[0].shape[2]
mask_none = ~out_mask_list[0].copy()
for prev_mask in out_mask_list[1:]:
mask_none &= ~prev_mask
return(mask_none.sum() / (h * w))
class Prompts:
def __init__(self,bs:int):
self.batch_size = bs
self.prompts = {}
self.obj_list = []
self.key_frame_list = []
self.key_frame_obj_begin_list = []
def add(self,obj_id,frame_id,mask):
if obj_id not in self.obj_list:
new_obj = True
self.prompts[obj_id] = []
self.obj_list.append(obj_id)
else:
new_obj = False
self.prompts[obj_id].append((frame_id,mask))
if frame_id not in self.key_frame_list and new_obj:
# import ipdb; ipdb.set_trace()
self.key_frame_list.append(frame_id)
self.key_frame_obj_begin_list.append(obj_id)
logger.info("key_frame_obj_begin_list:",self.key_frame_obj_begin_list)
def get_obj_num(self):
return len(self.obj_list)
def __len__(self):
if self.obj_list % self.batch_size == 0:
return len(self.obj_list) // self.batch_size
else:
return len(self.obj_list) // self.batch_size +1
def __iter__(self):
# self.batch_index = 0
self.start_idx = 0
self.iter_frameindex = 0
return self
def __next__(self):
if self.start_idx < len(self.obj_list):
if self.iter_frameindex == len(self.key_frame_list)-1:
end_idx = min(self.start_idx+self.batch_size, len(self.obj_list))
else:
if self.start_idx+self.batch_size < self.key_frame_obj_begin_list[self.iter_frameindex+1]:
end_idx = self.start_idx+self.batch_size
else:
end_idx = self.key_frame_obj_begin_list[self.iter_frameindex+1]
self.iter_frameindex+=1
# end_idx = min(self.start_idx+self.batch_size, self.key_frame_obj_begin_list[self.iter_frameindex+1])
batch_keys = self.obj_list[self.start_idx:end_idx]
batch_prompts = {key: self.prompts[key] for key in batch_keys}
self.start_idx = end_idx
return batch_prompts
# if self.batch_index * self.batch_size < len(self.obj_list):
# start_idx = self.batch_index * self.batch_size
# end_idx = min(start_idx + self.batch_size, len(self.obj_list))
# batch_keys = self.obj_list[start_idx:end_idx]
# batch_prompts = {key: self.prompts[key] for key in batch_keys}
# self.batch_index += 1
# return batch_prompts
else:
raise StopIteration
def get_video_segments(prompts_loader,predictor,inference_state,final_output=False):
video_segments = {}
for batch_prompts in tqdm(prompts_loader,desc="processing prompts\n"):
predictor.reset_state(inference_state)
for id, prompt_list in batch_prompts.items():
for prompt in prompt_list:
# import ipdb; ipdb.set_trace()
_, out_obj_ids, out_mask_logits = predictor.add_new_mask(
inference_state=inference_state,
frame_idx=prompt[0],
obj_id=id,
mask=prompt[1]
)
# start_frame_idx = 0 if final_output else None
for out_frame_idx, out_obj_ids, out_mask_logits in predictor.propagate_in_video(inference_state):
if out_frame_idx not in video_segments:
video_segments[out_frame_idx] = { }
for i, out_obj_id in enumerate(out_obj_ids):
video_segments[out_frame_idx][out_obj_id]= (out_mask_logits[i] > 0.0).cpu().numpy()
if final_output:
for out_frame_idx, out_obj_ids, out_mask_logits in predictor.propagate_in_video(inference_state,reverse=True):
for i, out_obj_id in enumerate(out_obj_ids):
video_segments[out_frame_idx][out_obj_id]= (out_mask_logits[i] > 0.0).cpu().numpy()
return video_segments
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--video_path",type=str,required=True)
parser.add_argument("--output_dir",type=str,required=True)
parser.add_argument("--level",choices=['default','small','middle','large'])
parser.add_argument("--batch_size",type=int,default=20)
parser.add_argument("--sam1_checkpoint",type=str,default="/home/lff/bigdata1/cjw/checkpoints/sam/sam_vit_h_4b8939.pth")
parser.add_argument("--sam2_checkpoint",type=str,default="/home/lff/bigdata1/cjw/checkpoints/sam2/sam2_hiera_large.pt")
parser.add_argument("--detect_stride",type=int,default=10)
parser.add_argument("--use_other_level",type=int,default=1)
parser.add_argument("--postnms",type=int,default=1)
parser.add_argument("--pred_iou_thresh",type=float,default=0.7)
parser.add_argument("--box_nms_thresh",type=float,default=0.7)
parser.add_argument("--stability_score_thresh",type=float,default=0.85)
parser.add_argument("--reverse", action="store_true")
level_dict = {
"default": 0,
"small": 1,
"middle": 2,
"large": 3
}
args = parser.parse_args()
logger.add(os.path.join(args.output_dir,f'{args.level}.log'), rotation="500 MB")
logger.info(args)
video_dir = args.video_path
level = args.level
base_dir = args.output_dir
##### load Sam2 and Sam1 Model #####
sam2_checkpoint = args.sam2_checkpoint
model_cfg = "sam2_hiera_l.yaml"
predictor = build_sam2_video_predictor(model_cfg, sam2_checkpoint)
sam2 = build_sam2(model_cfg, sam2_checkpoint, device='cuda', apply_postprocessing=False)
sam_ckpt_path = args.sam1_checkpoint
sam = sam_model_registry["vit_h"](checkpoint=sam_ckpt_path).to('cuda')
mask_generator = SamAutomaticMaskGenerator(
model=sam,
points_per_side=32,
pred_iou_thresh=args.pred_iou_thresh,
box_nms_thresh=args.box_nms_thresh,
stability_score_thresh=args.stability_score_thresh,
crop_n_layers=1,
crop_n_points_downscale_factor=1,
min_mask_region_area=100,
)
# scan all the JPEG frame names in this directory
frame_names = [
p for p in os.listdir(video_dir)
if os.path.splitext(p)[-1] in [".jpg", ".jpeg", ".JPG", ".JPEG", ".png"]
]
try:
frame_names.sort(key=lambda p: int(os.path.splitext(p)[0]), reverse=args.reverse)
except:
frame_names.sort(key=lambda p: os.path.splitext(p)[0], reverse=args.reverse)
now_frame = 0
inference_state = predictor.init_state(video_path=video_dir)
masks_from_prev = []
sum_id = 0 # Record total number of objects
prompts_loader = Prompts(bs=args.batch_size) # hold all the clicks we add for visualization
while True:
logger.info(f"frame: {now_frame}")
sum_id = prompts_loader.get_obj_num()
image_path = os.path.join(video_dir,frame_names[now_frame])
image = cv2.imread(image_path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# resize if the input is too large:
orig_h, orig_w = image.shape[:2]
if orig_h > 1080:
logger.info("Resizing original image to 1080P...")
scale = 1080 / orig_h
h = int(orig_h * scale)
w = int(orig_w * scale)
image = cv2.resize(image, (w, h))
# Generate only large masks
# masks_l = mask_generator.generate_l(image)
all_masks = mask_generator.generate(image)
masks = all_masks[level_dict[args.level]]
# masks_l = mask_generator.generate(image)
if args.postnms:
# # Pass masks_l directly, no need to wrap in tuple
# # masks_l = masks_update(masks_l, iou_thr=0.8, score_thr=0.7, inner_thr=0.5)[0]
masks = masks_update(masks, iou_thr=0.8, score_thr=0.7, inner_thr=0.5)[0]
# Use large level masks
# masks = masks_l
other_masks = None
if not args.use_other_level:
other_masks = None
if now_frame == 0: # first frame
ann_obj_id_list = range(len(masks))
for ann_obj_id in tqdm(ann_obj_id_list):
seg = masks[ann_obj_id]['segmentation']
prompts_loader.add(ann_obj_id,0,seg)
else:
new_mask_list = search_new_obj(masks_from_prev, masks, other_masks,mask_ratio_thresh)
logger.info(f"number of new obj: {len(new_mask_list)}")
for id,mask in enumerate(masks_from_prev):
if mask.sum() == 0:
continue
prompts_loader.add(id,now_frame,mask[0])
for i in range(len(new_mask_list)):
new_mask = new_mask_list[i]['segmentation']
prompts_loader.add(sum_id+i,now_frame,new_mask)
logger.info(f"obj num: {prompts_loader.get_obj_num()}")
if now_frame==0 or len(new_mask_list)!=0:
video_segments = get_video_segments(prompts_loader,predictor,inference_state)
vis_frame_stride = args.detect_stride
max_area_no_mask = (0,-1)
for out_frame_idx in tqdm(range(0, len(frame_names), vis_frame_stride)):
if out_frame_idx < now_frame:
continue
out_mask_list = []
for out_obj_id, out_mask in video_segments[out_frame_idx].items():
out_mask_list.append(out_mask)
no_mask_ratio = cal_no_mask_area_ratio(out_mask_list)
if now_frame == out_frame_idx:
mask_ratio_thresh = no_mask_ratio
logger.info(f"mask_ratio_thresh: {mask_ratio_thresh}")
if no_mask_ratio > mask_ratio_thresh + 0.01 and out_frame_idx > now_frame:
masks_from_prev = out_mask_list
max_area_no_mask = (no_mask_ratio, out_frame_idx)
logger.info(max_area_no_mask)
break
if max_area_no_mask[1] == -1:
break
logger.info("max_area_no_mask:", max_area_no_mask)
now_frame = max_area_no_mask[1]
###### Final output ######
save_dir = os.path.join(base_dir,level,"final-output")
os.makedirs(save_dir, exist_ok=True)
video_segments = get_video_segments(prompts_loader,predictor,inference_state,final_output=True)
for out_frame_idx in tqdm(range(0, len(frame_names), 1)):
out_mask_list = []
for out_obj_id, out_mask in video_segments[out_frame_idx].items():
out_mask_list.append(out_mask)
no_mask_ratio = cal_no_mask_area_ratio(out_mask_list)
logger.info(no_mask_ratio)
save_masks(out_mask_list, out_frame_idx,save_dir)
save_masks_npy(out_mask_list, out_frame_idx,save_dir)
###### Generate Visualization Frames ######
logger.info("Start generating visualization frames...")
vis_save_dir = os.path.join(base_dir,level,'visualization','full-mask-npy')
os.makedirs(vis_save_dir,exist_ok=True)
frame_save_dir = os.path.join(base_dir,level,'visualization','frames')
os.makedirs(frame_save_dir, exist_ok=True)
# Read all npy files
npy_name_list = []
for name in os.listdir(save_dir):
if 'npy' in name:
npy_name_list.append(name)
npy_name_list.sort()
logger.info(f"Found {len(npy_name_list)} npy files")
npy_list = [np.load(os.path.join(save_dir,name)) for name in npy_name_list]
image_list = [Image.open(os.path.join(video_dir,name)) for name in frame_names]
assert len(npy_list) == len(image_list), "Number of npy files does not match number of images"
logger.info(f"Processing {len(npy_list)} frames in total")
# Generate random colors
def generate_random_colors(num_colors):
colors = []
for _ in range(num_colors):
reroll = True
iter_cnt = 0
while reroll and iter_cnt < 100:
iter_cnt += 1
reroll = False
color = tuple(random.randint(1, 255) for _ in range(3))
for selected_color in colors:
if np.linalg.norm(np.array(color) - np.array(selected_color)) < 70:
reroll = True
break
colors.append(color)
return colors
num_masks = max(len(masks) for masks in npy_list)
colors = generate_random_colors(num_masks)
post_colors = [(0, 0, 0)] + colors
post_colors = np.array(post_colors) # [num_masks, 3]
np.save(os.path.join(base_dir, "colors.npy"), post_colors)
# Only process first and last frames
# frames_to_process = [0, -1] # Indices for first and last frames
for frame_idx in range(len(frame_names)):
# for frame_idx in frames_to_process:
masks = npy_list[frame_idx]
image = image_list[frame_idx]
image_np = np.array(image)
mask_combined = np.zeros_like(image_np, dtype=np.uint8)
for mask_id, mask in enumerate(masks):
mask = mask.squeeze(0)
mask_area = mask > 0
mask_combined[mask_area, :] = colors[mask_id]
# Blend original image with colored mask
mask_combined = np.clip(mask_combined, 0, 255)
# blended_image = cv2.addWeighted(image_np, 0.7, mask_combined, 0.3, 0)
blended_image = mask_combined
# change the save path
frame_name = frame_names[frame_idx]
frame_save_dir = base_dir
output_path = os.path.join(frame_save_dir, frame_name)
Image.fromarray(blended_image).save(output_path)
logger.info(f"Frame saved to: {output_path}")
================================================
FILE: auto-seg/sam2/__init__.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from hydra import initialize_config_module
initialize_config_module("sam2_configs", version_base="1.2")
================================================
FILE: auto-seg/sam2/automatic_mask_generator.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/automatic_mask_generator.py
from typing import Any, Dict, List, Optional, Tuple
import numpy as np
import torch
from torchvision.ops.boxes import batched_nms, box_area # type: ignore
from sam2.modeling.sam2_base import SAM2Base
from sam2.sam2_image_predictor import SAM2ImagePredictor
from sam2.utils.amg import (
area_from_rle,
batch_iterator,
batched_mask_to_box,
box_xyxy_to_xywh,
build_all_layer_point_grids,
calculate_stability_score,
coco_encode_rle,
generate_crop_boxes,
is_box_near_crop_edge,
mask_to_rle_pytorch,
MaskData,
remove_small_regions,
rle_to_mask,
uncrop_boxes_xyxy,
uncrop_masks,
uncrop_points,
)
class SAM2AutomaticMaskGenerator:
def __init__(
self,
model: SAM2Base,
points_per_side: Optional[int] = 32,
points_per_batch: int = 64,
pred_iou_thresh: float = 0.8,
stability_score_thresh: float = 0.95,
stability_score_offset: float = 1.0,
mask_threshold: float = 0.0,
box_nms_thresh: float = 0.7,
crop_n_layers: int = 0,
crop_nms_thresh: float = 0.7,
crop_overlap_ratio: float = 512 / 1500,
crop_n_points_downscale_factor: int = 1,
point_grids: Optional[List[np.ndarray]] = None,
min_mask_region_area: int = 0,
output_mode: str = "binary_mask",
use_m2m: bool = False,
multimask_output: bool = True,
**kwargs,
) -> None:
"""
Using a SAM 2 model, generates masks for the entire image.
Generates a grid of point prompts over the image, then filters
low quality and duplicate masks. The default settings are chosen
for SAM 2 with a HieraL backbone.
Arguments:
model (Sam): The SAM 2 model to use for mask prediction.
points_per_side (int or None): The number of points to be sampled
along one side of the image. The total number of points is
points_per_side**2. If None, 'point_grids' must provide explicit
point sampling.
points_per_batch (int): Sets the number of points run simultaneously
by the model. Higher numbers may be faster but use more GPU memory.
pred_iou_thresh (float): A filtering threshold in [0,1], using the
model's predicted mask quality.
stability_score_thresh (float): A filtering threshold in [0,1], using
the stability of the mask under changes to the cutoff used to binarize
the model's mask predictions.
stability_score_offset (float): The amount to shift the cutoff when
calculated the stability score.
mask_threshold (float): Threshold for binarizing the mask logits
box_nms_thresh (float): The box IoU cutoff used by non-maximal
suppression to filter duplicate masks.
crop_n_layers (int): If >0, mask prediction will be run again on
crops of the image. Sets the number of layers to run, where each
layer has 2**i_layer number of image crops.
crop_nms_thresh (float): The box IoU cutoff used by non-maximal
suppression to filter duplicate masks between different crops.
crop_overlap_ratio (float): Sets the degree to which crops overlap.
In the first crop layer, crops will overlap by this fraction of
the image length. Later layers with more crops scale down this overlap.
crop_n_points_downscale_factor (int): The number of points-per-side
sampled in layer n is scaled down by crop_n_points_downscale_factor**n.
point_grids (list(np.ndarray) or None): A list over explicit grids
of points used for sampling, normalized to [0,1]. The nth grid in the
list is used in the nth crop layer. Exclusive with points_per_side.
min_mask_region_area (int): If >0, postprocessing will be applied
to remove disconnected regions and holes in masks with area smaller
than min_mask_region_area. Requires opencv.
output_mode (str): The form masks are returned in. Can be 'binary_mask',
'uncompressed_rle', or 'coco_rle'. 'coco_rle' requires pycocotools.
For large resolutions, 'binary_mask' may consume large amounts of
memory.
use_m2m (bool): Whether to add a one step refinement using previous mask predictions.
multimask_output (bool): Whether to output multimask at each point of the grid.
"""
assert (points_per_side is None) != (
point_grids is None
), "Exactly one of points_per_side or point_grid must be provided."
if points_per_side is not None:
self.point_grids = build_all_layer_point_grids(
points_per_side,
crop_n_layers,
crop_n_points_downscale_factor,
)
elif point_grids is not None:
self.point_grids = point_grids
else:
raise ValueError("Can't have both points_per_side and point_grid be None.")
assert output_mode in [
"binary_mask",
"uncompressed_rle",
"coco_rle",
], f"Unknown output_mode {output_mode}."
if output_mode == "coco_rle":
try:
from pycocotools import mask as mask_utils # type: ignore # noqa: F401
except ImportError as e:
print("Please install pycocotools")
raise e
self.predictor = SAM2ImagePredictor(
model,
max_hole_area=min_mask_region_area,
max_sprinkle_area=min_mask_region_area,
)
self.points_per_batch = points_per_batch
self.pred_iou_thresh = pred_iou_thresh
self.stability_score_thresh = stability_score_thresh
self.stability_score_offset = stability_score_offset
self.mask_threshold = mask_threshold
self.box_nms_thresh = box_nms_thresh
self.crop_n_layers = crop_n_layers
self.crop_nms_thresh = crop_nms_thresh
self.crop_overlap_ratio = crop_overlap_ratio
self.crop_n_points_downscale_factor = crop_n_points_downscale_factor
self.min_mask_region_area = min_mask_region_area
self.output_mode = output_mode
self.use_m2m = use_m2m
self.multimask_output = multimask_output
@classmethod
def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2AutomaticMaskGenerator":
"""
Load a pretrained model from the Hugging Face hub.
Arguments:
model_id (str): The Hugging Face repository ID.
**kwargs: Additional arguments to pass to the model constructor.
Returns:
(SAM2AutomaticMaskGenerator): The loaded model.
"""
from sam2.build_sam import build_sam2_hf
sam_model = build_sam2_hf(model_id, **kwargs)
return cls(sam_model, **kwargs)
@torch.no_grad()
def generate(self, image: np.ndarray) -> List[Dict[str, Any]]:
"""
Generates masks for the given image.
Arguments:
image (np.ndarray): The image to generate masks for, in HWC uint8 format.
Returns:
list(dict(str, any)): A list over records for masks. Each record is
a dict containing the following keys:
segmentation (dict(str, any) or np.ndarray): The mask. If
output_mode='binary_mask', is an array of shape HW. Otherwise,
is a dictionary containing the RLE.
bbox (list(float)): The box around the mask, in XYWH format.
area (int): The area in pixels of the mask.
predicted_iou (float): The model's own prediction of the mask's
quality. This is filtered by the pred_iou_thresh parameter.
point_coords (list(list(float))): The point coordinates input
to the model to generate this mask.
stability_score (float): A measure of the mask's quality. This
is filtered on using the stability_score_thresh parameter.
crop_box (list(float)): The crop of the image used to generate
the mask, given in XYWH format.
"""
# Generate masks
mask_data = self._generate_masks(image)
# Encode masks
if self.output_mode == "coco_rle":
mask_data["segmentations"] = [
coco_encode_rle(rle) for rle in mask_data["rles"]
]
elif self.output_mode == "binary_mask":
mask_data["segmentations"] = [rle_to_mask(rle) for rle in mask_data["rles"]]
else:
mask_data["segmentations"] = mask_data["rles"]
# Write mask records
curr_anns = []
for idx in range(len(mask_data["segmentations"])):
ann = {
"segmentation": mask_data["segmentations"][idx],
"area": area_from_rle(mask_data["rles"][idx]),
"bbox": box_xyxy_to_xywh(mask_data["boxes"][idx]).tolist(),
"predicted_iou": mask_data["iou_preds"][idx].item(),
"point_coords": [mask_data["points"][idx].tolist()],
"stability_score": mask_data["stability_score"][idx].item(),
"crop_box": box_xyxy_to_xywh(mask_data["crop_boxes"][idx]).tolist(),
}
curr_anns.append(ann)
return curr_anns
def _generate_masks(self, image: np.ndarray) -> MaskData:
orig_size = image.shape[:2]
crop_boxes, layer_idxs = generate_crop_boxes(
orig_size, self.crop_n_layers, self.crop_overlap_ratio
)
# Iterate over image crops
data = MaskData()
for crop_box, layer_idx in zip(crop_boxes, layer_idxs):
crop_data = self._process_crop(image, crop_box, layer_idx, orig_size)
data.cat(crop_data)
# Remove duplicate masks between crops
if len(crop_boxes) > 1:
# Prefer masks from smaller crops
scores = 1 / box_area(data["crop_boxes"])
scores = scores.to(data["boxes"].device)
keep_by_nms = batched_nms(
data["boxes"].float(),
scores,
torch.zeros_like(data["boxes"][:, 0]), # categories
iou_threshold=self.crop_nms_thresh,
)
data.filter(keep_by_nms)
data.to_numpy()
return data
def _process_crop(
self,
image: np.ndarray,
crop_box: List[int],
crop_layer_idx: int,
orig_size: Tuple[int, ...],
) -> MaskData:
# Crop the image and calculate embeddings
x0, y0, x1, y1 = crop_box
cropped_im = image[y0:y1, x0:x1, :]
cropped_im_size = cropped_im.shape[:2]
self.predictor.set_image(cropped_im)
# Get points for this crop
points_scale = np.array(cropped_im_size)[None, ::-1]
points_for_image = self.point_grids[crop_layer_idx] * points_scale
# Generate masks for this crop in batches
data = MaskData()
for (points,) in batch_iterator(self.points_per_batch, points_for_image):
batch_data = self._process_batch(
points, cropped_im_size, crop_box, orig_size, normalize=True
)
data.cat(batch_data)
del batch_data
self.predictor.reset_predictor()
# Remove duplicates within this crop.
keep_by_nms = batched_nms(
data["boxes"].float(),
data["iou_preds"],
torch.zeros_like(data["boxes"][:, 0]), # categories
iou_threshold=self.box_nms_thresh,
)
data.filter(keep_by_nms)
# Return to the original image frame
data["boxes"] = uncrop_boxes_xyxy(data["boxes"], crop_box)
data["points"] = uncrop_points(data["points"], crop_box)
data["crop_boxes"] = torch.tensor([crop_box for _ in range(len(data["rles"]))])
return data
def _process_batch(
self,
points: np.ndarray,
im_size: Tuple[int, ...],
crop_box: List[int],
orig_size: Tuple[int, ...],
normalize=False,
) -> MaskData:
orig_h, orig_w = orig_size
# Run model on this batch
points = torch.as_tensor(
points, dtype=torch.float32, device=self.predictor.device
)
in_points = self.predictor._transforms.transform_coords(
points, normalize=normalize, orig_hw=im_size
)
in_labels = torch.ones(
in_points.shape[0], dtype=torch.int, device=in_points.device
)
masks, iou_preds, low_res_masks = self.predictor._predict(
in_points[:, None, :],
in_labels[:, None],
multimask_output=self.multimask_output,
return_logits=True,
)
# Serialize predictions and store in MaskData
data = MaskData(
masks=masks.flatten(0, 1),
iou_preds=iou_preds.flatten(0, 1),
points=points.repeat_interleave(masks.shape[1], dim=0),
low_res_masks=low_res_masks.flatten(0, 1),
)
del masks
if not self.use_m2m:
# Filter by predicted IoU
if self.pred_iou_thresh > 0.0:
keep_mask = data["iou_preds"] > self.pred_iou_thresh
data.filter(keep_mask)
# Calculate and filter by stability score
data["stability_score"] = calculate_stability_score(
data["masks"], self.mask_threshold, self.stability_score_offset
)
if self.stability_score_thresh > 0.0:
keep_mask = data["stability_score"] >= self.stability_score_thresh
data.filter(keep_mask)
else:
# One step refinement using previous mask predictions
in_points = self.predictor._transforms.transform_coords(
data["points"], normalize=normalize, orig_hw=im_size
)
labels = torch.ones(
in_points.shape[0], dtype=torch.int, device=in_points.device
)
masks, ious = self.refine_with_m2m(
in_points, labels, data["low_res_masks"], self.points_per_batch
)
data["masks"] = masks.squeeze(1)
data["iou_preds"] = ious.squeeze(1)
if self.pred_iou_thresh > 0.0:
keep_mask = data["iou_preds"] > self.pred_iou_thresh
data.filter(keep_mask)
data["stability_score"] = calculate_stability_score(
data["masks"], self.mask_threshold, self.stability_score_offset
)
if self.stability_score_thresh > 0.0:
keep_mask = data["stability_score"] >= self.stability_score_thresh
data.filter(keep_mask)
# Threshold masks and calculate boxes
data["masks"] = data["masks"] > self.mask_threshold
data["boxes"] = batched_mask_to_box(data["masks"])
# Filter boxes that touch crop boundaries
keep_mask = ~is_box_near_crop_edge(
data["boxes"], crop_box, [0, 0, orig_w, orig_h]
)
if not torch.all(keep_mask):
data.filter(keep_mask)
# Compress to RLE
data["masks"] = uncrop_masks(data["masks"], crop_box, orig_h, orig_w)
data["rles"] = mask_to_rle_pytorch(data["masks"])
del data["masks"]
return data
@staticmethod
def postprocess_small_regions(
mask_data: MaskData, min_area: int, nms_thresh: float
) -> MaskData:
"""
Removes small disconnected regions and holes in masks, then reruns
box NMS to remove any new duplicates.
Edits mask_data in place.
Requires open-cv as a dependency.
"""
if len(mask_data["rles"]) == 0:
return mask_data
# Filter small disconnected regions and holes
new_masks = []
scores = []
for rle in mask_data["rles"]:
mask = rle_to_mask(rle)
mask, changed = remove_small_regions(mask, min_area, mode="holes")
unchanged = not changed
mask, changed = remove_small_regions(mask, min_area, mode="islands")
unchanged = unchanged and not changed
new_masks.append(torch.as_tensor(mask).unsqueeze(0))
# Give score=0 to changed masks and score=1 to unchanged masks
# so NMS will prefer ones that didn't need postprocessing
scores.append(float(unchanged))
# Recalculate boxes and remove any new duplicates
masks = torch.cat(new_masks, dim=0)
boxes = batched_mask_to_box(masks)
keep_by_nms = batched_nms(
boxes.float(),
torch.as_tensor(scores),
torch.zeros_like(boxes[:, 0]), # categories
iou_threshold=nms_thresh,
)
# Only recalculate RLEs for masks that have changed
for i_mask in keep_by_nms:
if scores[i_mask] == 0.0:
mask_torch = masks[i_mask].unsqueeze(0)
mask_data["rles"][i_mask] = mask_to_rle_pytorch(mask_torch)[0]
mask_data["boxes"][i_mask] = boxes[i_mask] # update res directly
mask_data.filter(keep_by_nms)
return mask_data
def refine_with_m2m(self, points, point_labels, low_res_masks, points_per_batch):
new_masks = []
new_iou_preds = []
for cur_points, cur_point_labels, low_res_mask in batch_iterator(
points_per_batch, points, point_labels, low_res_masks
):
best_masks, best_iou_preds, _ = self.predictor._predict(
cur_points[:, None, :],
cur_point_labels[:, None],
mask_input=low_res_mask[:, None, :],
multimask_output=False,
return_logits=True,
)
new_masks.append(best_masks)
new_iou_preds.append(best_iou_preds)
masks = torch.cat(new_masks, dim=0)
return masks, torch.cat(new_iou_preds, dim=0)
================================================
FILE: auto-seg/sam2/build_sam.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
import torch
from hydra import compose
from hydra.utils import instantiate
from omegaconf import OmegaConf
def build_sam2(
config_file,
ckpt_path=None,
device="cuda",
mode="eval",
hydra_overrides_extra=[],
apply_postprocessing=True,
**kwargs,
):
if apply_postprocessing:
hydra_overrides_extra = hydra_overrides_extra.copy()
hydra_overrides_extra += [
# dynamically fall back to multi-mask if the single mask is not stable
"++model.sam_mask_decoder_extra_args.dynamic_multimask_via_stability=true",
"++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_delta=0.05",
"++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_thresh=0.98",
]
# Read config and init model
cfg = compose(config_name=config_file, overrides=hydra_overrides_extra)
OmegaConf.resolve(cfg)
model = instantiate(cfg.model, _recursive_=True)
_load_checkpoint(model, ckpt_path)
model = model.to(device)
if mode == "eval":
model.eval()
return model
def build_sam2_video_predictor(
config_file,
ckpt_path=None,
device="cuda",
mode="eval",
hydra_overrides_extra=[],
apply_postprocessing=True,
**kwargs,
):
hydra_overrides = [
"++model._target_=sam2.sam2_video_predictor.SAM2VideoPredictor",
]
if apply_postprocessing:
hydra_overrides_extra = hydra_overrides_extra.copy()
hydra_overrides_extra += [
# dynamically fall back to multi-mask if the single mask is not stable
"++model.sam_mask_decoder_extra_args.dynamic_multimask_via_stability=true",
"++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_delta=0.05",
"++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_thresh=0.98",
# the sigmoid mask logits on interacted frames with clicks in the memory encoder so that the encoded masks are exactly as what users see from clicking
"++model.binarize_mask_from_pts_for_mem_enc=true",
# fill small holes in the low-res masks up to `fill_hole_area` (before resizing them to the original video resolution)
"++model.fill_hole_area=8",
]
hydra_overrides.extend(hydra_overrides_extra)
# Read config and init model
cfg = compose(config_name=config_file, overrides=hydra_overrides)
OmegaConf.resolve(cfg)
model = instantiate(cfg.model, _recursive_=True)
_load_checkpoint(model, ckpt_path)
model = model.to(device)
if mode == "eval":
model.eval()
return model
def build_sam2_hf(model_id, **kwargs):
from huggingface_hub import hf_hub_download
model_id_to_filenames = {
"facebook/sam2-hiera-tiny": ("sam2_hiera_t.yaml", "sam2_hiera_tiny.pt"),
"facebook/sam2-hiera-small": ("sam2_hiera_s.yaml", "sam2_hiera_small.pt"),
"facebook/sam2-hiera-base-plus": (
"sam2_hiera_b+.yaml",
"sam2_hiera_base_plus.pt",
),
"facebook/sam2-hiera-large": ("sam2_hiera_l.yaml", "sam2_hiera_large.pt"),
}
config_name, checkpoint_name = model_id_to_filenames[model_id]
ckpt_path = hf_hub_download(repo_id=model_id, filename=checkpoint_name)
return build_sam2(config_file=config_name, ckpt_path=ckpt_path, **kwargs)
def build_sam2_video_predictor_hf(model_id, **kwargs):
from huggingface_hub import hf_hub_download
model_id_to_filenames = {
"facebook/sam2-hiera-tiny": ("sam2_hiera_t.yaml", "sam2_hiera_tiny.pt"),
"facebook/sam2-hiera-small": ("sam2_hiera_s.yaml", "sam2_hiera_small.pt"),
"facebook/sam2-hiera-base-plus": (
"sam2_hiera_b+.yaml",
"sam2_hiera_base_plus.pt",
),
"facebook/sam2-hiera-large": ("sam2_hiera_l.yaml", "sam2_hiera_large.pt"),
}
config_name, checkpoint_name = model_id_to_filenames[model_id]
ckpt_path = hf_hub_download(repo_id=model_id, filename=checkpoint_name)
return build_sam2_video_predictor(
config_file=config_name, ckpt_path=ckpt_path, **kwargs
)
def _load_checkpoint(model, ckpt_path):
if ckpt_path is not None:
sd = torch.load(ckpt_path, map_location="cpu")["model"]
missing_keys, unexpected_keys = model.load_state_dict(sd)
if missing_keys:
logging.error(missing_keys)
raise RuntimeError()
if unexpected_keys:
logging.error(unexpected_keys)
raise RuntimeError()
logging.info("Loaded checkpoint sucessfully")
================================================
FILE: auto-seg/sam2/csrc/connected_components.cu
================================================
// Copyright (c) Meta Platforms, Inc. and affiliates.
// All rights reserved.
// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.
// adapted from https://github.com/zsef123/Connected_components_PyTorch
// with license found in the LICENSE_cctorch file in the root directory.
#include <ATen/cuda/CUDAContext.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <torch/extension.h>
#include <torch/script.h>
#include <vector>
// 2d
#define BLOCK_ROWS 16
#define BLOCK_COLS 16
namespace cc2d {
template <typename T>
__device__ __forceinline__ unsigned char hasBit(T bitmap, unsigned char pos) {
return (bitmap >> pos) & 1;
}
__device__ int32_t find(const int32_t* s_buf, int32_t n) {
while (s_buf[n] != n)
n = s_buf[n];
return n;
}
__device__ int32_t find_n_compress(int32_t* s_buf, int32_t n) {
const int32_t id = n;
while (s_buf[n] != n) {
n = s_buf[n];
s_buf[id] = n;
}
return n;
}
__device__ void union_(int32_t* s_buf, int32_t a, int32_t b) {
bool done;
do {
a = find(s_buf, a);
b = find(s_buf, b);
if (a < b) {
int32_t old = atomicMin(s_buf + b, a);
done = (old == b);
b = old;
} else if (b < a) {
int32_t old = atomicMin(s_buf + a, b);
done = (old == a);
a = old;
} else
done = true;
} while (!done);
}
__global__ void
init_labeling(int32_t* label, const uint32_t W, const uint32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y) * 2;
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x) * 2;
const uint32_t idx = row * W + col;
if (row < H && col < W)
label[idx] = idx;
}
__global__ void
merge(uint8_t* img, int32_t* label, const uint32_t W, const uint32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y) * 2;
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x) * 2;
const uint32_t idx = row * W + col;
if (row >= H || col >= W)
return;
uint32_t P = 0;
if (img[idx])
P |= 0x777;
if (row + 1 < H && img[idx + W])
P |= 0x777 << 4;
if (col + 1 < W && img[idx + 1])
P |= 0x777 << 1;
if (col == 0)
P &= 0xEEEE;
if (col + 1 >= W)
P &= 0x3333;
else if (col + 2 >= W)
P &= 0x7777;
if (row == 0)
P &= 0xFFF0;
if (row + 1 >= H)
P &= 0xFF;
if (P > 0) {
// If need check about top-left pixel(if flag the first bit) and hit the
// top-left pixel
if (hasBit(P, 0) && img[idx - W - 1]) {
union_(label, idx, idx - 2 * W - 2); // top left block
}
if ((hasBit(P, 1) && img[idx - W]) || (hasBit(P, 2) && img[idx - W + 1]))
union_(label, idx, idx - 2 * W); // top bottom block
if (hasBit(P, 3) && img[idx + 2 - W])
union_(label, idx, idx - 2 * W + 2); // top right block
if ((hasBit(P, 4) && img[idx - 1]) || (hasBit(P, 8) && img[idx + W - 1]))
union_(label, idx, idx - 2); // just left block
}
}
__global__ void compression(int32_t* label, const int32_t W, const int32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y) * 2;
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x) * 2;
const uint32_t idx = row * W + col;
if (row < H && col < W)
find_n_compress(label, idx);
}
__global__ void final_labeling(
const uint8_t* img,
int32_t* label,
const int32_t W,
const int32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y) * 2;
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x) * 2;
const uint32_t idx = row * W + col;
if (row >= H || col >= W)
return;
int32_t y = label[idx] + 1;
if (img[idx])
label[idx] = y;
else
label[idx] = 0;
if (col + 1 < W) {
if (img[idx + 1])
label[idx + 1] = y;
else
label[idx + 1] = 0;
if (row + 1 < H) {
if (img[idx + W + 1])
label[idx + W + 1] = y;
else
label[idx + W + 1] = 0;
}
}
if (row + 1 < H) {
if (img[idx + W])
label[idx + W] = y;
else
label[idx + W] = 0;
}
}
__global__ void init_counting(
const int32_t* label,
int32_t* count_init,
const int32_t W,
const int32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y);
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x);
const uint32_t idx = row * W + col;
if (row >= H || col >= W)
return;
int32_t y = label[idx];
if (y > 0) {
int32_t count_idx = y - 1;
atomicAdd(count_init + count_idx, 1);
}
}
__global__ void final_counting(
const int32_t* label,
const int32_t* count_init,
int32_t* count_final,
const int32_t W,
const int32_t H) {
const uint32_t row = (blockIdx.y * blockDim.y + threadIdx.y);
const uint32_t col = (blockIdx.x * blockDim.x + threadIdx.x);
const uint32_t idx = row * W + col;
if (row >= H || col >= W)
return;
int32_t y = label[idx];
if (y > 0) {
int32_t count_idx = y - 1;
count_final[idx] = count_init[count_idx];
} else {
count_final[idx] = 0;
}
}
} // namespace cc2d
std::vector<torch::Tensor> get_connected_componnets(
const torch::Tensor& inputs) {
AT_ASSERTM(inputs.is_cuda(), "inputs must be a CUDA tensor");
AT_ASSERTM(inputs.ndimension() == 4, "inputs must be [N, 1, H, W] shape");
AT_ASSERTM(
inputs.scalar_type() == torch::kUInt8, "inputs must be a uint8 type");
const uint32_t N = inputs.size(0);
const uint32_t C = inputs.size(1);
const uint32_t H = inputs.size(2);
const uint32_t W = inputs.size(3);
AT_ASSERTM(C == 1, "inputs must be [N, 1, H, W] shape");
AT_ASSERTM((H % 2) == 0, "height must be an even number");
AT_ASSERTM((W % 2) == 0, "width must be an even number");
// label must be uint32_t
auto label_options =
torch::TensorOptions().dtype(torch::kInt32).device(inputs.device());
torch::Tensor labels = torch::zeros({N, C, H, W}, label_options);
torch::Tensor counts_init = torch::zeros({N, C, H, W}, label_options);
torch::Tensor counts_final = torch::zeros({N, C, H, W}, label_options);
dim3 grid = dim3(
((W + 1) / 2 + BLOCK_COLS - 1) / BLOCK_COLS,
((H + 1) / 2 + BLOCK_ROWS - 1) / BLOCK_ROWS);
dim3 block = dim3(BLOCK_COLS, BLOCK_ROWS);
dim3 grid_count =
dim3((W + BLOCK_COLS) / BLOCK_COLS, (H + BLOCK_ROWS) / BLOCK_ROWS);
dim3 block_count = dim3(BLOCK_COLS, BLOCK_ROWS);
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
for (int n = 0; n < N; n++) {
uint32_t offset = n * H * W;
cc2d::init_labeling<<<grid, block, 0, stream>>>(
labels.data_ptr<int32_t>() + offset, W, H);
cc2d::merge<<<grid, block, 0, stream>>>(
inputs.data_ptr<uint8_t>() + offset,
labels.data_ptr<int32_t>() + offset,
W,
H);
cc2d::compression<<<grid, block, 0, stream>>>(
labels.data_ptr<int32_t>() + offset, W, H);
cc2d::final_labeling<<<grid, block, 0, stream>>>(
inputs.data_ptr<uint8_t>() + offset,
labels.data_ptr<int32_t>() + offset,
W,
H);
// get the counting of each pixel
cc2d::init_counting<<<grid_count, block_count, 0, stream>>>(
labels.data_ptr<int32_t>() + offset,
counts_init.data_ptr<int32_t>() + offset,
W,
H);
cc2d::final_counting<<<grid_count, block_count, 0, stream>>>(
labels.data_ptr<int32_t>() + offset,
counts_init.data_ptr<int32_t>() + offset,
counts_final.data_ptr<int32_t>() + offset,
W,
H);
}
// returned values are [labels, counts]
std::vector<torch::Tensor> outputs;
outputs.push_back(labels);
outputs.push_back(counts_final);
return outputs;
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def(
"get_connected_componnets",
&get_connected_componnets,
"get_connected_componnets");
}
================================================
FILE: auto-seg/sam2/modeling/__init__.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
================================================
FILE: auto-seg/sam2/modeling/backbones/__init__.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
================================================
FILE: auto-seg/sam2/modeling/backbones/hieradet.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from functools import partial
from typing import List, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from sam2.modeling.backbones.utils import (
PatchEmbed,
window_partition,
window_unpartition,
)
from sam2.modeling.sam2_utils import DropPath, MLP
def do_pool(x: torch.Tensor, pool: nn.Module, norm: nn.Module = None) -> torch.Tensor:
if pool is None:
return x
# (B, H, W, C) -> (B, C, H, W)
x = x.permute(0, 3, 1, 2)
x = pool(x)
# (B, C, H', W') -> (B, H', W', C)
x = x.permute(0, 2, 3, 1)
if norm:
x = norm(x)
return x
class MultiScaleAttention(nn.Module):
def __init__(
self,
dim: int,
dim_out: int,
num_heads: int,
q_pool: nn.Module = None,
):
super().__init__()
self.dim = dim
self.dim_out = dim_out
self.num_heads = num_heads
self.q_pool = q_pool
self.qkv = nn.Linear(dim, dim_out * 3)
self.proj = nn.Linear(dim_out, dim_out)
def forward(self, x: torch.Tensor) -> torch.Tensor:
B, H, W, _ = x.shape
# qkv with shape (B, H * W, 3, nHead, C)
qkv = self.qkv(x).reshape(B, H * W, 3, self.num_heads, -1)
# q, k, v with shape (B, H * W, nheads, C)
q, k, v = torch.unbind(qkv, 2)
# Q pooling (for downsample at stage changes)
if self.q_pool:
q = do_pool(q.reshape(B, H, W, -1), self.q_pool)
H, W = q.shape[1:3] # downsampled shape
q = q.reshape(B, H * W, self.num_heads, -1)
# Torch's SDPA expects [B, nheads, H*W, C] so we transpose
x = F.scaled_dot_product_attention(
q.transpose(1, 2),
k.transpose(1, 2),
v.transpose(1, 2),
)
# Transpose back
x = x.transpose(1, 2)
x = x.reshape(B, H, W, -1)
x = self.proj(x)
return x
class MultiScaleBlock(nn.Module):
def __init__(
self,
dim: int,
dim_out: int,
num_heads: int,
mlp_ratio: float = 4.0,
drop_path: float = 0.0,
norm_layer: Union[nn.Module, str] = "LayerNorm",
q_stride: Tuple[int, int] = None,
act_layer: nn.Module = nn.GELU,
window_size: int = 0,
):
super().__init__()
if isinstance(norm_layer, str):
norm_layer = partial(getattr(nn, norm_layer), eps=1e-6)
self.dim = dim
self.dim_out = dim_out
self.norm1 = norm_layer(dim)
self.window_size = window_size
self.pool, self.q_stride = None, q_stride
if self.q_stride:
self.pool = nn.MaxPool2d(
kernel_size=q_stride, stride=q_stride, ceil_mode=False
)
self.attn = MultiScaleAttention(
dim,
dim_out,
num_heads=num_heads,
q_pool=self.pool,
)
self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
self.norm2 = norm_layer(dim_out)
self.mlp = MLP(
dim_out,
int(dim_out * mlp_ratio),
dim_out,
num_layers=2,
activation=act_layer,
)
if dim != dim_out:
self.proj = nn.Linear(dim, dim_out)
def forward(self, x: torch.Tensor) -> torch.Tensor:
shortcut = x # B, H, W, C
x = self.norm1(x)
# Skip connection
if self.dim != self.dim_out:
shortcut = do_pool(self.proj(x), self.pool)
# Window partition
window_size = self.window_size
if window_size > 0:
H, W = x.shape[1], x.shape[2]
x, pad_hw = window_partition(x, window_size)
# Window Attention + Q Pooling (if stage change)
x = self.attn(x)
if self.q_stride:
# Shapes have changed due to Q pooling
window_size = self.window_size // self.q_stride[0]
H, W = shortcut.shape[1:3]
pad_h = (window_size - H % window_size) % window_size
pad_w = (window_size - W % window_size) % window_size
pad_hw = (H + pad_h, W + pad_w)
# Reverse window partition
if self.window_size > 0:
x = window_unpartition(x, window_size, pad_hw, (H, W))
x = shortcut + self.drop_path(x)
# MLP
x = x + self.drop_path(self.mlp(self.norm2(x)))
return x
class Hiera(nn.Module):
"""
Reference: https://arxiv.org/abs/2306.00989
"""
def __init__(
self,
embed_dim: int = 96, # initial embed dim
num_heads: int = 1, # initial number of heads
drop_path_rate: float = 0.0, # stochastic depth
q_pool: int = 3, # number of q_pool stages
q_stride: Tuple[int, int] = (2, 2), # downsample stride bet. stages
stages: Tuple[int, ...] = (2, 3, 16, 3), # blocks per stage
dim_mul: float = 2.0, # dim_mul factor at stage shift
head_mul: float = 2.0, # head_mul factor at stage shift
window_pos_embed_bkg_spatial_size: Tuple[int, int] = (14, 14),
# window size per stage, when not using global att.
window_spec: Tuple[int, ...] = (
8,
4,
14,
7,
),
# global attn in these blocks
global_att_blocks: Tuple[int, ...] = (
12,
16,
20,
),
return_interm_layers=True, # return feats from every stage
):
super().__init__()
assert len(stages) == len(window_spec)
self.window_spec = window_spec
depth = sum(stages)
self.q_stride = q_stride
self.stage_ends = [sum(stages[:i]) - 1 for i in range(1, len(stages) + 1)]
assert 0 <= q_pool <= len(self.stage_ends[:-1])
self.q_pool_blocks = [x + 1 for x in self.stage_ends[:-1]][:q_pool]
self.return_interm_layers = return_interm_layers
self.patch_embed = PatchEmbed(
embed_dim=embed_dim,
)
# Which blocks have global att?
self.global_att_blocks = global_att_blocks
# Windowed positional embedding (https://arxiv.org/abs/2311.05613)
self.window_pos_embed_bkg_spatial_size = window_pos_embed_bkg_spatial_size
self.pos_embed = nn.Parameter(
torch.zeros(1, embed_dim, *self.window_pos_embed_bkg_spatial_size)
)
self.pos_embed_window = nn.Parameter(
torch.zeros(1, embed_dim, self.window_spec[0], self.window_spec[0])
)
dpr = [
x.item() for x in torch.linspace(0, drop_path_rate, depth)
] # stochastic depth decay rule
cur_stage = 1
self.blocks = nn.ModuleList()
for i in range(depth):
dim_out = embed_dim
# lags by a block, so first block of
# next stage uses an initial window size
# of previous stage and final window size of current stage
window_size = self.window_spec[cur_stage - 1]
if self.global_att_blocks is not None:
window_size = 0 if i in self.global_att_blocks else window_size
if i - 1 in self.stage_ends:
dim_out = int(embed_dim * dim_mul)
num_heads = int(num_heads * head_mul)
cur_stage += 1
block = MultiScaleBlock(
dim=embed_dim,
dim_out=dim_out,
num_heads=num_heads,
drop_path=dpr[i],
q_stride=self.q_stride if i in self.q_pool_blocks else None,
window_size=window_size,
)
embed_dim = dim_out
self.blocks.append(block)
self.channel_list = (
[self.blocks[i].dim_out for i in self.stage_ends[::-1]]
if return_interm_layers
else [self.blocks[-1].dim_out]
)
def _get_pos_embed(self, hw: Tuple[int, int]) -> torch.Tensor:
h, w = hw
window_embed = self.pos_embed_window
pos_embed = F.interpolate(self.pos_embed, size=(h, w), mode="bicubic")
pos_embed = pos_embed + window_embed.tile(
[x // y for x, y in zip(pos_embed.shape, window_embed.shape)]
)
pos_embed = pos_embed.permute(0, 2, 3, 1)
return pos_embed
def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
x = self.patch_embed(x)
# x: (B, H, W, C)
# Add pos embed
x = x + self._get_pos_embed(x.shape[1:3])
outputs = []
for i, blk in enumerate(self.blocks):
x = blk(x)
if (i == self.stage_ends[-1]) or (
i in self.stage_ends and self.return_interm_layers
):
feats = x.permute(0, 3, 1, 2)
outputs.append(feats)
return outputs
================================================
FILE: auto-seg/sam2/modeling/backbones/image_encoder.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
class ImageEncoder(nn.Module):
def __init__(
self,
trunk: nn.Module,
neck: nn.Module,
scalp: int = 0,
):
super().__init__()
self.trunk = trunk
self.neck = neck
self.scalp = scalp
assert (
self.trunk.channel_list == self.neck.backbone_channel_list
), f"Channel dims of trunk and neck do not match. Trunk: {self.trunk.channel_list}, neck: {self.neck.backbone_channel_list}"
def forward(self, sample: torch.Tensor):
# Forward through backbone
features, pos = self.neck(self.trunk(sample))
if self.scalp > 0:
# Discard the lowest resolution features
features, pos = features[: -self.scalp], pos[: -self.scalp]
src = features[-1]
output = {
"vision_features": src,
"vision_pos_enc": pos,
"backbone_fpn": features,
}
return output
class FpnNeck(nn.Module):
"""
A modified variant of Feature Pyramid Network (FPN) neck
(we remove output conv and also do bicubic interpolation similar to ViT
pos embed interpolation)
"""
def __init__(
self,
position_encoding: nn.Module,
d_model: int,
backbone_channel_list: List[int],
kernel_size: int = 1,
stride: int = 1,
padding: int = 0,
fpn_interp_model: str = "bilinear",
fuse_type: str = "sum",
fpn_top_down_levels: Optional[List[int]] = None,
):
"""Initialize the neck
:param trunk: the backbone
:param position_encoding: the positional encoding to use
:param d_model: the dimension of the model
:param neck_norm: the normalization to use
"""
super().__init__()
self.position_encoding = position_encoding
self.convs = nn.ModuleList()
self.backbone_channel_list = backbone_channel_list
for dim in backbone_channel_list:
current = nn.Sequential()
current.add_module(
"conv",
nn.Conv2d(
in_channels=dim,
out_channels=d_model,
kernel_size=kernel_size,
stride=stride,
padding=padding,
),
)
self.convs.append(current)
self.fpn_interp_model = fpn_interp_model
assert fuse_type in ["sum", "avg"]
self.fuse_type = fuse_type
# levels to have top-down features in its outputs
# e.g. if fpn_top_down_levels is [2, 3], then only outputs of level 2 and 3
# have top-down propagation, while outputs of level 0 and level 1 have only
# lateral features from the same backbone level.
if fpn_top_down_levels is None:
# default is to have top-down features on all levels
fpn_top_down_levels = range(len(self.convs))
self.fpn_top_down_levels = list(fpn_top_down_levels)
def forward(self, xs: List[torch.Tensor]):
out = [None] * len(self.convs)
pos = [None] * len(self.convs)
assert len(xs) == len(self.convs)
# fpn forward pass
# see https://github.com/facebookresearch/detectron2/blob/main/detectron2/modeling/backbone/fpn.py
prev_features = None
# forward in top-down order (from low to high resolution)
n = len(self.convs) - 1
for i in range(n, -1, -1):
x = xs[i]
lateral_features = self.convs[n - i](x)
if i in self.fpn_top_down_levels and prev_features is not None:
top_down_features = F.interpolate(
prev_features.to(dtype=torch.float32),
scale_factor=2.0,
mode=self.fpn_interp_model,
align_corners=(
None if self.fpn_interp_model == "nearest" else False
),
antialias=False,
)
prev_features = lateral_features + top_down_features
if self.fuse_type == "avg":
prev_features /= 2
else:
prev_features = lateral_features
x_out = prev_features
out[i] = x_out
pos[i] = self.position_encoding(x_out).to(x_out.dtype)
return out, pos
================================================
FILE: auto-seg/sam2/modeling/backbones/utils.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Some utilities for backbones, in particular for windowing"""
from typing import Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
def window_partition(x, window_size):
"""
Partition into non-overlapping windows with padding if needed.
Args:
x (tensor): input tokens with [B, H, W, C].
window_size (int): window size.
Returns:
windows: windows after partition with [B * num_windows, window_size, window_size, C].
(Hp, Wp): padded height and width before partition
"""
B, H, W, C = x.shape
pad_h = (window_size - H % window_size) % window_size
pad_w = (window_size - W % window_size) % window_size
if pad_h > 0 or pad_w > 0:
x = F.pad(x, (0, 0, 0, pad_w, 0, pad_h))
Hp, Wp = H + pad_h, W + pad_w
x = x.view(B, Hp // window_size, window_size, Wp // window_size, window_size, C)
windows = (
x.permute(0, 1, 3, 2, 4, 5).contiguous().view(-1, window_size, window_size, C)
)
return windows, (Hp, Wp)
def window_unpartition(windows, window_size, pad_hw, hw):
"""
Window unpartition into original sequences and removing padding.
Args:
x (tensor): input tokens with [B * num_windows, window_size, window_size, C].
window_size (int): window size.
pad_hw (Tuple): padded height and width (Hp, Wp).
hw (Tuple): original height and width (H, W) before padding.
Returns:
x: unpartitioned sequences with [B, H, W, C].
"""
Hp, Wp = pad_hw
H, W = hw
B = windows.shape[0] // (Hp * Wp // window_size // window_size)
x = windows.view(
B, Hp // window_size, Wp // window_size, window_size, window_size, -1
)
x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(B, Hp, Wp, -1)
if Hp > H or Wp > W:
x = x[:, :H, :W, :].contiguous()
return x
class PatchEmbed(nn.Module):
"""
Image to Patch Embedding.
"""
def __init__(
self,
kernel_size: Tuple[int, ...] = (7, 7),
stride: Tuple[int, ...] = (4, 4),
padding: Tuple[int, ...] = (3, 3),
in_chans: int = 3,
embed_dim: int = 768,
):
"""
Args:
kernel_size (Tuple): kernel size of the projection layer.
stride (Tuple): stride of the projection layer.
padding (Tuple): padding size of the projection layer.
in_chans (int): Number of input image channels.
embed_dim (int): embed_dim (int): Patch embedding dimension.
"""
super().__init__()
self.proj = nn.Conv2d(
in_chans, embed_dim, kernel_size=kernel_size, stride=stride, padding=padding
)
def forward(self, x: torch.Tensor) -> torch.Tensor:
x = self.proj(x)
# B C H W -> B H W C
x = x.permute(0, 2, 3, 1)
return x
================================================
FILE: auto-seg/sam2/modeling/memory_attention.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
import torch
from torch import nn, Tensor
from sam2.modeling.sam.transformer import RoPEAttention
from sam2.modeling.sam2_utils import get_activation_fn, get_clones
class MemoryAttentionLayer(nn.Module):
def __init__(
self,
activation: str,
cross_attention: nn.Module,
d_model: int,
dim_feedforward: int,
dropout: float,
pos_enc_at_attn: bool,
pos_enc_at_cross_attn_keys: bool,
pos_enc_at_cross_attn_queries: bool,
self_attention: nn.Module,
):
super().__init__()
self.d_model = d_model
self.dim_feedforward = dim_feedforward
self.dropout_value = dropout
self.self_attn = self_attention
self.cross_attn_image = cross_attention
# Implementation of Feedforward model
self.linear1 = nn.Linear(d_model, dim_feedforward)
self.dropout = nn.Dropout(dropout)
self.linear2 = nn.Linear(dim_feedforward, d_model)
self.norm1 = nn.LayerNorm(d_model)
self.norm2 = nn.LayerNorm(d_model)
self.norm3 = nn.LayerNorm(d_model)
self.dropout1 = nn.Dropout(dropout)
self.dropout2 = nn.Dropout(dropout)
self.dropout3 = nn.Dropout(dropout)
self.activation_str = activation
self.activation = get_activation_fn(activation)
# Where to add pos enc
self.pos_enc_at_attn = pos_enc_at_attn
self.pos_enc_at_cross_attn_queries = pos_enc_at_cross_attn_queries
self.pos_enc_at_cross_attn_keys = pos_enc_at_cross_attn_keys
def _forward_sa(self, tgt, query_pos):
# Self-Attention
tgt2 = self.norm1(tgt)
q = k = tgt2 + query_pos if self.pos_enc_at_attn else tgt2
tgt2 = self.self_attn(q, k, v=tgt2)
tgt = tgt + self.dropout1(tgt2)
return tgt
def _forward_ca(self, tgt, memory, query_pos, pos, num_k_exclude_rope=0):
kwds = {}
if num_k_exclude_rope > 0:
assert isinstance(self.cross_attn_image, RoPEAttention)
kwds = {"num_k_exclude_rope": num_k_exclude_rope}
# Cross-Attention
tgt2 = self.norm2(tgt)
tgt2 = self.cross_attn_image(
q=tgt2 + query_pos if self.pos_enc_at_cross_attn_queries else tgt2,
k=memory + pos if self.pos_enc_at_cross_attn_keys else memory,
v=memory,
**kwds,
)
tgt = tgt + self.dropout2(tgt2)
return tgt
def forward(
self,
tgt,
memory,
pos: Optional[Tensor] = None,
query_pos: Optional[Tensor] = None,
num_k_exclude_rope: int = 0,
) -> torch.Tensor:
# Self-Attn, Cross-Attn
tgt = self._forward_sa(tgt, query_pos)
tgt = self._forward_ca(tgt, memory, query_pos, pos, num_k_exclude_rope)
# MLP
tgt2 = self.norm3(tgt)
tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt2))))
tgt = tgt + self.dropout3(tgt2)
return tgt
class MemoryAttention(nn.Module):
def __init__(
self,
d_model: int,
pos_enc_at_input: bool,
layer: nn.Module,
num_layers: int,
batch_first: bool = True, # Do layers expect batch first input?
):
super().__init__()
self.d_model = d_model
self.layers = get_clones(layer, num_layers)
self.num_layers = num_layers
self.norm = nn.LayerNorm(d_model)
self.pos_enc_at_input = pos_enc_at_input
self.batch_first = batch_first
def forward(
self,
curr: torch.Tensor, # self-attention inputs
memory: torch.Tensor, # cross-attention inputs
curr_pos: Optional[Tensor] = None, # pos_enc for self-attention inputs
memory_pos: Optional[Tensor] = None, # pos_enc for cross-attention inputs
num_obj_ptr_tokens: int = 0, # number of object pointer *tokens*
):
if isinstance(curr, list):
assert isinstance(curr_pos, list)
assert len(curr) == len(curr_pos) == 1
curr, curr_pos = (
curr[0],
curr_pos[0],
)
assert (
curr.shape[1] == memory.shape[1]
), "Batch size must be the same for curr and memory"
output = curr
if self.pos_enc_at_input and curr_pos is not None:
output = output + 0.1 * curr_pos
if self.batch_first:
# Convert to batch first
output = output.transpose(0, 1)
curr_pos = curr_pos.transpose(0, 1)
memory = memory.transpose(0, 1)
memory_pos = memory_pos.transpose(0, 1)
for layer in self.layers:
kwds = {}
if isinstance(layer.cross_attn_image, RoPEAttention):
kwds = {"num_k_exclude_rope": num_obj_ptr_tokens}
output = layer(
tgt=output,
memory=memory,
pos=memory_pos,
query_pos=curr_pos,
**kwds,
)
normed_output = self.norm(output)
if self.batch_first:
# Convert back to seq first
normed_output = normed_output.transpose(0, 1)
curr_pos = curr_pos.transpose(0, 1)
return normed_output
================================================
FILE: auto-seg/sam2/modeling/memory_encoder.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from sam2.modeling.sam2_utils import DropPath, get_clones, LayerNorm2d
class MaskDownSampler(nn.Module):
"""
Progressively downsample a mask by total_stride, each time by stride.
Note that LayerNorm is applied per *token*, like in ViT.
With each downsample (by a factor stride**2), channel capacity increases by the same factor.
In the end, we linearly project to embed_dim channels.
"""
def __init__(
self,
embed_dim=256,
kernel_size=4,
stride=4,
padding=0,
total_stride=16,
activation=nn.GELU,
):
super().__init__()
num_layers = int(math.log2(total_stride) // math.log2(stride))
assert stride**num_layers == total_stride
self.encoder = nn.Sequential()
mask_in_chans, mask_out_chans = 1, 1
for _ in range(num_layers):
mask_out_chans = mask_in_chans * (stride**2)
self.encoder.append(
nn.Conv2d(
mask_in_chans,
mask_out_chans,
kernel_size=kernel_size,
stride=stride,
padding=padding,
)
)
self.encoder.append(LayerNorm2d(mask_out_chans))
self.encoder.append(activation())
mask_in_chans = mask_out_chans
self.encoder.append(nn.Conv2d(mask_out_chans, embed_dim, kernel_size=1))
def forward(self, x):
return self.encoder(x)
# Lightly adapted from ConvNext (https://github.com/facebookresearch/ConvNeXt)
class CXBlock(nn.Module):
r"""ConvNeXt Block. There are two equivalent implementations:
(1) DwConv -> LayerNorm (channels_first) -> 1x1 Conv -> GELU -> 1x1 Conv; all in (N, C, H, W)
(2) DwConv -> Permute to (N, H, W, C); LayerNorm (channels_last) -> Linear -> GELU -> Linear; Permute back
We use (2) as we find it slightly faster in PyTorch
Args:
dim (int): Number of input channels.
drop_path (float): Stochastic depth rate. Default: 0.0
layer_scale_init_value (float): Init value for Layer Scale. Default: 1e-6.
"""
def __init__(
self,
dim,
kernel_size=7,
padding=3,
drop_path=0.0,
layer_scale_init_value=1e-6,
use_dwconv=True,
):
super().__init__()
self.dwconv = nn.Conv2d(
dim,
dim,
kernel_size=kernel_size,
padding=padding,
groups=dim if use_dwconv else 1,
) # depthwise conv
self.norm = LayerNorm2d(dim, eps=1e-6)
self.pwconv1 = nn.Linear(
dim, 4 * dim
) # pointwise/1x1 convs, implemented with linear layers
self.act = nn.GELU()
self.pwconv2 = nn.Linear(4 * dim, dim)
self.gamma = (
nn.Parameter(layer_scale_init_value * torch.ones((dim)), requires_grad=True)
if layer_scale_init_value > 0
else None
)
self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
def forward(self, x):
input = x
x = self.dwconv(x)
x = self.norm(x)
x = x.permute(0, 2, 3, 1) # (N, C, H, W) -> (N, H, W, C)
x = self.pwconv1(x)
x = self.act(x)
x = self.pwconv2(x)
if self.gamma is not None:
x = self.gamma * x
x = x.permute(0, 3, 1, 2) # (N, H, W, C) -> (N, C, H, W)
x = input + self.drop_path(x)
return x
class Fuser(nn.Module):
def __init__(self, layer, num_layers, dim=None, input_projection=False):
super().__init__()
self.proj = nn.Identity()
self.layers = get_clones(layer, num_layers)
if input_projection:
assert dim is not None
self.proj = nn.Conv2d(dim, dim, kernel_size=1)
def forward(self, x):
# normally x: (N, C, H, W)
x = self.proj(x)
for layer in self.layers:
x = layer(x)
return x
class MemoryEncoder(nn.Module):
def __init__(
self,
out_dim,
mask_downsampler,
fuser,
position_encoding,
in_dim=256, # in_dim of pix_feats
):
super().__init__()
self.mask_downsampler = mask_downsampler
self.pix_feat_proj = nn.Conv2d(in_dim, in_dim, kernel_size=1)
self.fuser = fuser
self.position_encoding = position_encoding
self.out_proj = nn.Identity()
if out_dim != in_dim:
self.out_proj = nn.Conv2d(in_dim, out_dim, kernel_size=1)
def forward(
self,
pix_feat: torch.Tensor,
masks: torch.Tensor,
skip_mask_sigmoid: bool = False,
) -> Tuple[torch.Tensor, torch.Tensor]:
## Process masks
# sigmoid, so that less domain shift from gt masks which are bool
if not skip_mask_sigmoid:
masks = F.sigmoid(masks)
masks = self.mask_downsampler(masks)
## Fuse pix_feats and downsampled masks
# in case the visual features are on CPU, cast them to CUDA
pix_feat = pix_feat.to(masks.device)
x = self.pix_feat_proj(pix_feat)
x = x + masks
x = self.fuser(x)
x = self.out_proj(x)
pos = self.position_encoding(x).to(x.dtype)
return {"vision_features": x, "vision_pos_enc": [pos]}
================================================
FILE: auto-seg/sam2/modeling/position_encoding.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Any, Optional, Tuple
import numpy as np
import torch
from torch import nn
class PositionEmbeddingSine(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one
used by the Attention Is All You Need paper, generalized to work on images.
"""
def __init__(
self,
num_pos_feats,
temperature: int = 10000,
normalize: bool = True,
scale: Optional[float] = None,
):
super().__init__()
assert num_pos_feats % 2 == 0, "Expecting even model width"
self.num_pos_feats = num_pos_feats // 2
self.temperature = temperature
self.normalize = normalize
if scale is not None and normalize is False:
raise ValueError("normalize should be True if scale is passed")
if scale is None:
scale = 2 * math.pi
self.scale = scale
self.cache = {}
def _encode_xy(self, x, y):
# The positions are expected to be normalized
assert len(x) == len(y) and x.ndim == y.ndim == 1
x_embed = x * self.scale
y_embed = y * self.scale
dim_t = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
pos_x = x_embed[:, None] / dim_t
pos_y = y_embed[:, None] / dim_t
pos_x = torch.stack(
(pos_x[:, 0::2].sin(), pos_x[:, 1::2].cos()), dim=2
).flatten(1)
pos_y = torch.stack(
(pos_y[:, 0::2].sin(), pos_y[:, 1::2].cos()), dim=2
).flatten(1)
return pos_x, pos_y
@torch.no_grad()
def encode_boxes(self, x, y, w, h):
pos_x, pos_y = self._encode_xy(x, y)
pos = torch.cat((pos_y, pos_x, h[:, None], w[:, None]), dim=1)
return pos
encode = encode_boxes # Backwards compatibility
@torch.no_grad()
def encode_points(self, x, y, labels):
(bx, nx), (by, ny), (bl, nl) = x.shape, y.shape, labels.shape
assert bx == by and nx == ny and bx == bl and nx == nl
pos_x, pos_y = self._encode_xy(x.flatten(), y.flatten())
pos_x, pos_y = pos_x.reshape(bx, nx, -1), pos_y.reshape(by, ny, -1)
pos = torch.cat((pos_y, pos_x, labels[:, :, None]), dim=2)
return pos
@torch.no_grad()
def forward(self, x: torch.Tensor):
cache_key = (x.shape[-2], x.shape[-1])
if cache_key in self.cache:
return self.cache[cache_key][None].repeat(x.shape[0], 1, 1, 1)
y_embed = (
torch.arange(1, x.shape[-2] + 1, dtype=torch.float32, device=x.device)
.view(1, -1, 1)
.repeat(x.shape[0], 1, x.shape[-1])
)
x_embed = (
torch.arange(1, x.shape[-1] + 1, dtype=torch.float32, device=x.device)
.view(1, 1, -1)
.repeat(x.shape[0], x.shape[-2], 1)
)
if self.normalize:
eps = 1e-6
y_embed = y_embed / (y_embed[:, -1:, :] + eps) * self.scale
x_embed = x_embed / (x_embed[:, :, -1:] + eps) * self.scale
dim_t = torch.arange(self.num_pos_feats, dtype=torch.float32, device=x.device)
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
pos_x = x_embed[:, :, :, None] / dim_t
pos_y = y_embed[:, :, :, None] / dim_t
pos_x = torch.stack(
(pos_x[:, :, :, 0::2].sin(), pos_x[:, :, :, 1::2].cos()), dim=4
).flatten(3)
pos_y = torch.stack(
(pos_y[:, :, :, 0::2].sin(), pos_y[:, :, :, 1::2].cos()), dim=4
).flatten(3)
pos = torch.cat((pos_y, pos_x), dim=3).permute(0, 3, 1, 2)
self.cache[cache_key] = pos[0]
return pos
class PositionEmbeddingRandom(nn.Module):
"""
Positional encoding using random spatial frequencies.
"""
def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = None) -> None:
super().__init__()
if scale is None or scale <= 0.0:
scale = 1.0
self.register_buffer(
"positional_encoding_gaussian_matrix",
scale * torch.randn((2, num_pos_feats)),
)
def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:
"""Positionally encode points that are normalized to [0,1]."""
# assuming coords are in [0, 1]^2 square and have d_1 x ... x d_n x 2 shape
coords = 2 * coords - 1
coords = coords @ self.positional_encoding_gaussian_matrix
coords = 2 * np.pi * coords
# outputs d_1 x ... x d_n x C shape
return torch.cat([torch.sin(coords), torch.cos(coords)], dim=-1)
def forward(self, size: Tuple[int, int]) -> torch.Tensor:
"""Generate positional encoding for a grid of the specified size."""
h, w = size
device: Any = self.positional_encoding_gaussian_matrix.device
grid = torch.ones((h, w), device=device, dtype=torch.float32)
y_embed = grid.cumsum(dim=0) - 0.5
x_embed = grid.cumsum(dim=1) - 0.5
y_embed = y_embed / h
x_embed = x_embed / w
pe = self._pe_encoding(torch.stack([x_embed, y_embed], dim=-1))
return pe.permute(2, 0, 1) # C x H x W
def forward_with_coords(
self, coords_input: torch.Tensor, image_size: Tuple[int, int]
) -> torch.Tensor:
"""Positionally encode points that are not normalized to [0,1]."""
coords = coords_input.clone()
coords[:, :, 0] = coords[:, :, 0] / image_size[1]
coords[:, :, 1] = coords[:, :, 1] / image_size[0]
return self._pe_encoding(coords.to(torch.float)) # B x N x C
# Rotary Positional Encoding, adapted from:
# 1. https://github.com/meta-llama/codellama/blob/main/llama/model.py
# 2. https://github.com/naver-ai/rope-vit
# 3. https://github.com/lucidrains/rotary-embedding-torch
def init_t_xy(end_x: int, end_y: int):
t = torch.arange(end_x * end_y, dtype=torch.float32)
t_x = (t % end_x).float()
t_y = torch.div(t, end_x, rounding_mode="floor").float()
return t_x, t_y
def compute_axial_cis(dim: int, end_x: int, end_y: int, theta: float = 10000.0):
freqs_x = 1.0 / (theta ** (torch.arange(0, dim, 4)[: (dim // 4)].float() / dim))
freqs_y = 1.0 / (theta ** (torch.arange(0, dim, 4)[: (dim // 4)].float() / dim))
t_x, t_y = init_t_xy(end_x, end_y)
freqs_x = torch.outer(t_x, freqs_x)
freqs_y = torch.outer(t_y, freqs_y)
freqs_cis_x = torch.polar(torch.ones_like(freqs_x), freqs_x)
freqs_cis_y = torch.polar(torch.ones_like(freqs_y), freqs_y)
return torch.cat([freqs_cis_x, freqs_cis_y], dim=-1)
def reshape_for_broadcast(freqs_cis: torch.Tensor, x: torch.Tensor):
ndim = x.ndim
assert 0 <= 1 < ndim
assert freqs_cis.shape == (x.shape[-2], x.shape[-1])
shape = [d if i >= ndim - 2 else 1 for i, d in enumerate(x.shape)]
return freqs_cis.view(*shape)
def apply_rotary_enc(
xq: torch.Tensor,
xk: torch.Tensor,
freqs_cis: torch.Tensor,
repeat_freqs_k: bool = False,
):
xq_ = torch.view_as_complex(xq.float().reshape(*xq.shape[:-1], -1, 2))
xk_ = (
torch.view_as_complex(xk.float().reshape(*xk.shape[:-1], -1, 2))
if xk.shape[-2] != 0
else None
)
freqs_cis = reshape_for_broadcast(freqs_cis, xq_)
xq_out = torch.view_as_real(xq_ * freqs_cis).flatten(3)
if xk_ is None:
# no keys to rotate, due to dropout
return xq_out.type_as(xq).to(xq.device), xk
# repeat freqs along seq_len dim to match k seq_len
if repeat_freqs_k:
r = xk_.shape[-2] // xq_.shape[-2]
if freqs_cis.is_cuda:
freqs_cis = freqs_cis.repeat(*([1] * (freqs_cis.ndim - 2)), r, 1)
else:
# torch.repeat on complex numbers may not be supported on non-CUDA devices
# (freqs_cis has 4 dims and we repeat on dim 2) so we use expand + flatten
freqs_cis = freqs_cis.unsqueeze(2).expand(-1, -1, r, -1, -1).flatten(2, 3)
xk_out = torch.view_as_real(xk_ * freqs_cis).flatten(3)
return xq_out.type_as(xq).to(xq.device), xk_out.type_as(xk).to(xk.device)
================================================
FILE: auto-seg/sam2/modeling/sam/__init__.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
================================================
FILE: auto-seg/sam2/modeling/sam/mask_decoder.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional, Tuple, Type
import torch
from torch import nn
from sam2.modeling.sam2_utils import LayerNorm2d, MLP
class MaskDecoder(nn.Module):
def __init__(
self,
*,
transformer_dim: int,
transformer: nn.Module,
num_multimask_outputs: int = 3,
activation: Type[nn.Module] = nn.GELU,
iou_head_depth: int = 3,
iou_head_hidden_dim: int = 256,
use_high_res_features: bool = False,
iou_prediction_use_sigmoid=False,
dynamic_multimask_via_stability=False,
dynamic_multimask_stability_delta=0.05,
dynamic_multimask_stability_thresh=0.98,
pred_obj_scores: bool = False,
pred_obj_scores_mlp: bool = False,
use_multimask_token_for_obj_ptr: bool = False,
) -> None:
"""
Predicts masks given an image and prompt embeddings, using a
transformer architecture.
Arguments:
transformer_dim (int): the channel dimension of the transformer
transformer (nn.Module): the transformer used to predict masks
num_multimask_outputs (int): the number of masks to predict
when disambiguating masks
activation (nn.Module): the type of activation to use when
upscaling masks
iou_head_depth (int): the depth of the MLP used to predict
mask quality
iou_head_hidden_dim (int): the hidden dimension of the MLP
used to predict mask quality
"""
super().__init__()
self.transformer_dim = transformer_dim
self.transformer = transformer
self.num_multimask_outputs = num_multimask_outputs
self.iou_token = nn.Embedding(1, transformer_dim)
self.num_mask_tokens = num_multimask_outputs + 1
self.mask_tokens = nn.Embedding(self.num_mask_tokens, transformer_dim)
self.pred_obj_scores = pred_obj_scores
if self.pred_obj_scores:
self.obj_score_token = nn.Embedding(1, transformer_dim)
self.use_multimask_token_for_obj_ptr = use_multimask_token_for_obj_ptr
self.output_upscaling = nn.Sequential(
nn.ConvTranspose2d(
transformer_dim, transformer_dim // 4, kernel_size=2, stride=2
),
LayerNorm2d(transformer_dim // 4),
activation(),
nn.ConvTranspose2d(
transformer_dim // 4, transformer_dim // 8, kernel_size=2, stride=2
),
activation(),
)
self.use_high_res_features = use_high_res_features
if use_high_res_features:
self.conv_s0 = nn.Conv2d(
transformer_dim, transformer_dim // 8, kernel_size=1, stride=1
)
self.conv_s1 = nn.Conv2d(
transformer_dim, transformer_dim // 4, kernel_size=1, stride=1
)
self.output_hypernetworks_mlps = nn.ModuleList(
[
MLP(transformer_dim, transformer_dim, transformer_dim // 8, 3)
for i in range(self.num_mask_tokens)
]
)
self.iou_prediction_head = MLP(
transformer_dim,
iou_head_hidden_dim,
self.num_mask_tokens,
iou_head_depth,
sigmoid_output=iou_prediction_use_sigmoid,
)
if self.pred_obj_scores:
self.pred_obj_score_head = nn.Linear(transformer_dim, 1)
if pred_obj_scores_mlp:
self.pred_obj_score_head = MLP(transformer_dim, transformer_dim, 1, 3)
# When outputting a single mask, optionally we can dynamically fall back to the best
# multimask output token if the single mask output token gives low stability scores.
self.dynamic_multimask_via_stability = dynamic_multimask_via_stability
self.dynamic_multimask_stability_delta = dynamic_multimask_stability_delta
self.dynamic_multimask_stability_thresh = dynamic_multimask_stability_thresh
def forward(
self,
image_embeddings: torch.Tensor,
image_pe: torch.Tensor,
sparse_prompt_embeddings: torch.Tensor,
dense_prompt_embeddings: torch.Tensor,
multimask_output: bool,
repeat_image: bool,
high_res_features: Optional[List[torch.Tensor]] = None,
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Predict masks given image and prompt embeddings.
Arguments:
image_embeddings (torch.Tensor): the embeddings from the image encoder
image_pe (torch.Tensor): positional encoding with the shape of image_embeddings
sparse_prompt_embeddings (torch.Tensor): the embeddings of the points and boxes
dense_prompt_embeddings (torch.Tensor): the embeddings of the mask inputs
multimask_output (bool): Whether to return multiple masks or a single
mask.
Returns:
torch.Tensor: batched predicted masks
torch.Tensor: batched predictions of mask quality
torch.Tensor: batched SAM token for mask output
"""
masks, iou_pred, mask_tokens_out, object_score_logits = self.predict_masks(
image_embeddings=image_embeddings,
image_pe=image_pe,
sparse_prompt_embeddings=sparse_prompt_embeddings,
dense_prompt_embeddings=dense_prompt_embeddings,
repeat_image=repeat_image,
high_res_features=high_res_features,
)
# Select the correct mask or masks for output
if multimask_output:
masks = masks[:, 1:, :, :]
iou_pred = iou_pred[:, 1:]
elif self.dynamic_multimask_via_stability and not self.training:
masks, iou_pred = self._dynamic_multimask_via_stability(masks, iou_pred)
else:
masks = masks[:, 0:1, :, :]
iou_pred = iou_pred[:, 0:1]
if multimask_output and self.use_multimask_token_for_obj_ptr:
sam_tokens_out = mask_tokens_out[:, 1:] # [b, 3, c] shape
else:
# Take the mask output token. Here we *always* use the token for single mask output.
# At test time, even if we track after 1-click (and using multimask_output=True),
# we still take the single mask token here. The rationale is that we always track
# after multiple clicks during training, so the past tokens seen during training
# are always the single mask token (and we'll let it be the object-memory token).
sam_tokens_out = mask_tokens_out[:, 0:1] # [b, 1, c] shape
# Prepare output
return masks, iou_pred, sam_tokens_out, object_score_logits
def predict_masks(
self,
image_embeddings: torch.Tensor,
image_pe: torch.Tensor,
sparse_prompt_embeddings: torch.Tensor,
dense_prompt_embeddings: torch.Tensor,
repeat_image: bool,
high_res_features: Optional[List[torch.Tensor]] = None,
) -> Tuple[torch.Tensor, torch.Tensor]:
"""Predicts masks. See 'forward' for more details."""
# Concatenate output tokens
s = 0
if self.pred_obj_scores:
output_tokens = torch.cat(
[
self.obj_score_token.weight,
self.iou_token.weight,
self.mask_tokens.weight,
],
dim=0,
)
s = 1
else:
output_tokens = torch.cat(
[self.iou_token.weight, self.mask_tokens.weight], dim=0
)
output_tokens = output_tokens.unsqueeze(0).expand(
sparse_prompt_embeddings.size(0), -1, -1
)
tokens = torch.cat((output_tokens, sparse_prompt_embeddings), dim=1)
# Expand per-image data in batch direction to be per-mask
if repeat_image:
src = torch.repeat_interleave(image_embeddings, tokens.shape[0], dim=0)
else:
assert image_embeddings.shape[0] == tokens.shape[0]
src = image_embeddings
src = src + dense_prompt_embeddings
assert (
image_pe.size(0) == 1
), "image_pe should have size 1 in batch dim (from `get_dense_pe()`)"
pos_src = torch.repeat_interleave(image_pe, tokens.shape[0], dim=0)
b, c, h, w = src.shape
# Run the transformer
hs, src = self.transformer(src, pos_src, tokens)
iou_token_out = hs[:, s, :]
mask_tokens_out = hs[:, s + 1 : (s + 1 + self.num_mask_tokens), :]
# Upscale mask embeddings and predict masks using the mask tokens
src = src.transpose(1, 2).view(b, c, h, w)
if not self.use_high_res_features:
upscaled_embedding = self.output_upscaling(src)
else:
dc1, ln1, act1, dc2, act2 = self.output_upscaling
feat_s0, feat_s1 = high_res_features
upscaled_embedding = act1(ln1(dc1(src) + feat_s1))
upscaled_embedding = act2(dc2(upscaled_embedding) + feat_s0)
hyper_in_list: List[torch.Tensor] = []
for i in range(self.num_mask_tokens):
hyper_in_list.append(
self.output_hypernetworks_mlps[i](mask_tokens_out[:, i, :])
)
hyper_in = torch.stack(hyper_in_list, dim=1)
b, c, h, w = upscaled_embedding.shape
masks = (hyper_in @ upscaled_embedding.view(b, c, h * w)).view(b, -1, h, w)
# Generate mask quality predictions
iou_pred = self.iou_prediction_head(iou_token_out)
if self.pred_obj_scores:
assert s == 1
object_score_logits = self.pred_obj_score_head(hs[:, 0, :])
else:
# Obj scores logits - default to 10.0, i.e. assuming the object is present, sigmoid(10)=1
object_score_logits = 10.0 * iou_pred.new_ones(iou_pred.shape[0], 1)
return masks, iou_pred, mask_tokens_out, object_score_logits
def _get_stability_scores(self, mask_logits):
"""
Compute stability scores of the mask logits based on the IoU between upper and
lower thresholds, similar to https://github.com/fairinternal/onevision/pull/568.
"""
mask_logits = mask_logits.flatten(-2)
stability_delta = self.dynamic_multimask_stability_delta
area_i = torch.sum(mask_logits > stability_delta, dim=-1).float()
area_u = torch.sum(mask_logits > -stability_delta, dim=-1).float()
stability_scores = torch.where(area_u > 0, area_i / area_u, 1.0)
return stability_scores
def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_scores):
"""
When outputting a single mask, if the stability score from the current single-mask
output (based on output token 0) falls below a threshold, we instead select from
multi-mask outputs (based on output token 1~3) the mask with the highest predicted
IoU score. This is intended to ensure a valid mask for both clicking and tracking.
"""
# The best mask from multimask output tokens (1~3)
multimask_logits = all_mask_logits[:, 1:, :, :]
multimask_iou_scores = all_iou_scores[:, 1:]
best_scores_inds = torch.argmax(multimask_iou_scores, dim=-1)
batch_inds = torch.arange(
multimask_iou_scores.size(0), device=all_iou_scores.device
)
best_multimask_logits = multimask_logits[batch_inds, best_scores_inds]
best_multimask_logits = best_multimask_logits.unsqueeze(1)
best_multimask_iou_scores = multimask_iou_scores[batch_inds, best_scores_inds]
best_multimask_iou_scores = best_multimask_iou_scores.unsqueeze(1)
# The mask from singlemask output token 0 and its stability score
singlemask_logits = all_mask_logits[:, 0:1, :, :]
singlemask_iou_scores = all_iou_scores[:, 0:1]
stability_scores = self._get_stability_scores(singlemask_logits)
is_stable = stability_scores >= self.dynamic_multimask_stability_thresh
# Dynamically fall back to best multimask output upon low stability scores.
mask_logits_out = torch.where(
is_stable[..., None, None].expand_as(singlemask_logits),
singlemask_logits,
best_multimask_logits,
)
iou_scores_out = torch.where(
is_stable.expand_as(singlemask_iou_scores),
singlemask_iou_scores,
best_multimask_iou_scores,
)
return mask_logits_out, iou_scores_out
================================================
FILE: auto-seg/sam2/modeling/sam/prompt_encoder.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional, Tuple, Type
import torch
from torch import nn
from sam2.modeling.position_encoding import PositionEmbeddingRandom
from sam2.modeling.sam2_utils import LayerNorm2d
class PromptEncoder(nn.Module):
def __init__(
self,
embed_dim: int,
image_embedding_size: Tuple[int, int],
input_image_size: Tuple[int, int],
mask_in_chans: int,
activation: Type[nn.Module] = nn.GELU,
) -> None:
"""
Encodes prompts for input to SAM's mask decoder.
Arguments:
embed_dim (int): The prompts' embedding dimension
image_embedding_size (tuple(int, int)): The spatial size of the
image embedding, as (H, W).
input_image_size (int): The padded size of the image as input
to the image encoder, as (H, W).
mask_in_chans (int): The number of hidden channels used for
encoding input masks.
activation (nn.Module): The activation to use when encoding
input masks.
"""
super().__init__()
self.embed_dim = embed_dim
self.input_image_size = input_image_size
self.image_embedding_size = image_embedding_size
self.pe_layer = PositionEmbeddingRandom(embed_dim // 2)
self.num_point_embeddings: int = 4 # pos/neg point + 2 box corners
point_embeddings = [
nn.Embedding(1, embed_dim) for i in range(self.num_point_embeddings)
]
self.point_embeddings = nn.ModuleList(point_embeddings)
self.not_a_point_embed = nn.Embedding(1, embed_dim)
self.mask_input_size = (
4 * image_embedding_size[0],
4 * image_embedding_size[1],
)
self.mask_downscaling = nn.Sequential(
nn.Conv2d(1, mask_in_chans // 4, kernel_size=2, stride=2),
LayerNorm2d(mask_in_chans // 4),
activation(),
nn.Conv2d(mask_in_chans // 4, mask_in_chans, kernel_size=2, stride=2),
LayerNorm2d(mask_in_chans),
activation(),
nn.Conv2d(mask_in_chans, embed_dim, kernel_size=1),
)
self.no_mask_embed = nn.Embedding(1, embed_dim)
def get_dense_pe(self) -> torch.Tensor:
"""
Returns the positional encoding used to encode point prompts,
applied to a dense set of points the shape of the image encoding.
Returns:
torch.Tensor: Positional encoding with shape
1x(embed_dim)x(embedding_h)x(embedding_w)
"""
return self.pe_layer(self.image_embedding_size).unsqueeze(0)
def _embed_points(
self,
points: torch.Tensor,
labels: torch.Tensor,
pad: bool,
) -> torch.Tensor:
"""Embeds point prompts."""
points = points + 0.5 # Shift to center of pixel
if pad:
padding_point = torch.zeros((points.shape[0], 1, 2), device=points.device)
padding_label = -torch.ones((labels.shape[0], 1), device=labels.device)
points = torch.cat([points, padding_point], dim=1)
labels = torch.cat([labels, padding_label], dim=1)
point_embedding = self.pe_layer.forward_with_coords(
points, self.input_image_size
)
point_embedding[labels == -1] = 0.0
point_embedding[labels == -1] += self.not_a_point_embed.weight
point_embedding[labels == 0] += self.point_embeddings[0].weight
point_embedding[labels == 1] += self.point_embeddings[1].weight
point_embedding[labels == 2] += self.point_embeddings[2].weight
point_embedding[labels == 3] += self.point_embeddings[3].weight
return point_embedding
def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor:
"""Embeds box prompts."""
boxes = boxes + 0.5 # Shift to center of pixel
coords = boxes.reshape(-1, 2, 2)
corner_embedding = self.pe_layer.forward_with_coords(
coords, self.input_image_size
)
corner_embedding[:, 0, :] += self.point_embeddings[2].weight
corner_embedding[:, 1, :] += self.point_embeddings[3].weight
return corner_embedding
def _embed_masks(self, masks: torch.Tensor) -> torch.Tensor:
"""Embeds mask inputs."""
mask_embedding = self.mask_downscaling(masks)
return mask_embedding
def _get_batch_size(
self,
points: Optional[Tuple[torch.Tensor, torch.Tensor]],
boxes: Optional[torch.Tensor],
masks: Optional[torch.Tensor],
) -> int:
"""
Gets the batch size of the output given the batch size of the input prompts.
"""
if points is not None:
return points[0].shape[0]
elif boxes is not None:
return boxes.shape[0]
elif masks is not None:
return masks.shape[0]
else:
return 1
def _get_device(self) -> torch.device:
return self.point_embeddings[0].weight.device
def forward(
self,
points: Optional[Tuple[torch.Tensor, torch.Tensor]],
boxes: Optional[torch.Tensor],
masks: Optional[torch.Tensor],
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Embeds different types of prompts, returning both sparse and dense
embeddings.
Arguments:
points (tuple(torch.Tensor, torch.Tensor) or none): point coordinates
and labels to embed.
boxes (torch.Tensor or none): boxes to embed
masks (torch.Tensor or none): masks to embed
Returns:
torch.Tensor: sparse embeddings for the points and boxes, with shape
BxNx(embed_dim), where N is determined by the number of input points
and boxes.
torch.Tensor: dense embeddings for the masks, in the shape
Bx(embed_dim)x(embed_H)x(embed_W)
"""
bs = self._get_batch_size(points, boxes, masks)
sparse_embeddings = torch.empty(
(bs, 0, self.embed_dim), device=self._get_device()
)
if points is not None:
coords, labels = points
point_embeddings = self._embed_points(coords, labels, pad=(boxes is None))
sparse_embeddings = torch.cat([sparse_embeddings, point_embeddings], dim=1)
if boxes is not None:
box_embeddings = self._embed_boxes(boxes)
sparse_embeddings = torch.cat([sparse_embeddings, box_embeddings], dim=1)
if masks is not None:
dense_embeddings = self._embed_masks(masks)
else:
dense_embeddings = self.no_mask_embed.weight.reshape(1, -1, 1, 1).expand(
bs, -1, self.image_embedding_size[0], self.image_embedding_size[1]
)
return sparse_embeddings, dense_embeddings
================================================
FILE: auto-seg/sam2/modeling/sam/transformer.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import math
import warnings
from functools import partial
from typing import Tuple, Type
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from sam2.modeling.position_encoding import apply_rotary_enc, compute_axial_cis
from sam2.modeling.sam2_utils import MLP
from sam2.utils.misc import get_sdpa_settings
warnings.simplefilter(action="ignore", category=FutureWarning)
# Check whether Flash Attention is available (and use it by default)
OLD_GPU, USE_FLASH_ATTN, MATH_KERNEL_ON = get_sdpa_settings()
# A fallback setting to allow all available kernels if Flash Attention fails
ALLOW_ALL_KERNELS = False
def sdp_kernel_context(dropout_p):
"""
Get the context for the attention scaled dot-product kernel. We use Flash Attention
by default, but fall back to all available kernels if Flash Attention fails.
"""
if ALLOW_ALL_KERNELS:
return contextlib.nullcontext()
return torch.backends.cuda.sdp_kernel(
enable_flash=USE_FLASH_ATTN,
# if Flash attention kernel is off, then math kernel needs to be enabled
enable_math=(OLD_GPU and dropout_p > 0.0) or MATH_KERNEL_ON,
enable_mem_efficient=OLD_GPU,
)
class TwoWayTransformer(nn.Module):
def __init__(
self,
depth: int,
embedding_dim: int,
num_heads: int,
mlp_dim: int,
activation: Type[nn.Module] = nn.ReLU,
attention_downsample_rate: int = 2,
) -> None:
"""
A transformer decoder that attends to an input image using
queries whose positional embedding is supplied.
Args:
depth (int): number of layers in the transformer
embedding_dim (int): the channel dimension for the input embeddings
num_heads (int): the number of heads for multihead attention. Must
divide embedding_dim
mlp_dim (int): the channel dimension internal to the MLP block
activation (nn.Module): the activation to use in the MLP block
"""
super().__init__()
self.depth = depth
self.embedding_dim = embedding_dim
self.num_heads = num_heads
self.mlp_dim = mlp_dim
self.layers = nn.ModuleList()
for i in range(depth):
self.layers.append(
TwoWayAttentionBlock(
embedding_dim=embedding_dim,
num_heads=num_heads,
mlp_dim=mlp_dim,
activation=activation,
attention_downsample_rate=attention_downsample_rate,
skip_first_layer_pe=(i == 0),
)
)
self.final_attn_token_to_image = Attention(
embedding_dim, num_heads, downsample_rate=attention_downsample_rate
)
self.norm_final_attn = nn.LayerNorm(embedding_dim)
def forward(
self,
image_embedding: Tensor,
image_pe: Tensor,
point_embedding: Tensor,
) -> Tuple[Tensor, Tensor]:
"""
Args:
image_embedding (torch.Tensor): image to attend to. Should be shape
B x embedding_dim x h x w for any h and w.
image_pe (torch.Tensor): the positional encoding to add to the image. Must
have the same shape as image_embedding.
point_embedding (torch.Tensor): the embedding to add to the query points.
Must have shape B x N_points x embedding_dim for any N_points.
Returns:
torch.Tensor: the processed point_embedding
torch.Tensor: the processed image_embedding
"""
# BxCxHxW -> BxHWxC == B x N_image_tokens x C
bs, c, h, w = image_embedding.shape
image_embedding = image_embedding.flatten(2).permute(0, 2, 1)
image_pe = image_pe.flatten(2).permute(0, 2, 1)
# Prepare queries
queries = point_embedding
keys = image_embedding
# Apply transformer blocks and final layernorm
for layer in self.layers:
queries, keys = layer(
queries=queries,
keys=keys,
query_pe=point_embedding,
key_pe=image_pe,
)
# Apply the final attention layer from the points to the image
q = queries + point_embedding
k = keys + image_pe
attn_out = self.final_attn_token_to_image(q=q, k=k, v=keys)
queries = queries + attn_out
queries = self.norm_final_attn(queries)
return queries, keys
class TwoWayAttentionBlock(nn.Module):
def __init__(
self,
embedding_dim: int,
num_heads: int,
mlp_dim: int = 2048,
activation: Type[nn.Module] = nn.ReLU,
attention_downsample_rate: int = 2,
skip_first_layer_pe: bool = False,
) -> None:
"""
A transformer block with four layers: (1) self-attention of sparse
inputs, (2) cross attention of sparse inputs to dense inputs, (3) mlp
block on sparse inputs, and (4) cross attention of dense inputs to sparse
inputs.
Arguments:
embedding_dim (int): the channel dimension of the embeddings
num_heads (int): the number of heads in the attention layers
mlp_dim (int): the hidden dimension of the mlp block
activation (nn.Module): the activation of the mlp block
skip_first_layer_pe (bool): skip the PE on the first layer
"""
super().__init__()
self.self_attn = Attention(embedding_dim, num_heads)
self.norm1 = nn.LayerNorm(embedding_dim)
self.cross_attn_token_to_image = Attention(
embedding_dim, num_heads, downsample_rate=attention_downsample_rate
)
self.norm2 = nn.LayerNorm(embedding_dim)
self.mlp = MLP(
embedding_dim, mlp_dim, embedding_dim, num_layers=2, activation=activation
)
self.norm3 = nn.LayerNorm(embedding_dim)
self.norm4 = nn.LayerNorm(embedding_dim)
self.cross_attn_image_to_token = Attention(
embedding_dim, num_heads, downsample_rate=attention_downsample_rate
)
self.skip_first_layer_pe = skip_first_layer_pe
def forward(
self, queries: Tensor, keys: Tensor, query_pe: Tensor, key_pe: Tensor
) -> Tuple[Tensor, Tensor]:
# Self attention block
if self.skip_first_layer_pe:
queries = self.self_attn(q=queries, k=queries, v=queries)
else:
q = queries + query_pe
attn_out = self.self_attn(q=q, k=q, v=queries)
queries = queries + attn_out
queries = self.norm1(queries)
# Cross attention block, tokens attending to image embedding
q = queries + query_pe
k = keys + key_pe
attn_out = self.cross_attn_token_to_image(q=q, k=k, v=keys)
queries = queries + attn_out
queries = self.norm2(queries)
# MLP block
mlp_out = self.mlp(queries)
queries = queries + mlp_out
queries = self.norm3(queries)
# Cross attention block, image embedding attending to tokens
q = queries + query_pe
k = keys + key_pe
attn_out = self.cross_attn_image_to_token(q=k, k=q, v=queries)
keys = keys + attn_out
keys = self.norm4(keys)
return queries, keys
class Attention(nn.Module):
"""
An attention layer that allows for downscaling the size of the embedding
after projection to queries, keys, and values.
"""
def __init__(
self,
embedding_dim: int,
num_heads: int,
downsample_rate: int = 1,
dropout: float = 0.0,
kv_in_dim: int = None,
) -> None:
super().__init__()
self.embedding_dim = embedding_dim
self.kv_in_dim = kv_in_dim if kv_in_dim is not None else embedding_dim
self.internal_dim = embedding_dim // downsample_rate
self.num_heads = num_heads
assert (
self.internal_dim % num_heads == 0
), "num_heads must divide embedding_dim."
self.q_proj = nn.Linear(embedding_dim, self.internal_dim)
self.k_proj = nn.Linear(self.kv_in_dim, self.internal_dim)
self.v_proj = nn.Linear(self.kv_in_dim, self.internal_dim)
self.out_proj = nn.Linear(self.internal_dim, embedding_dim)
self.dropout_p = dropout
def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor:
b, n, c = x.shape
x = x.reshape(b, n, num_heads, c // num_heads)
return x.transpose(1, 2) # B x N_heads x N_tokens x C_per_head
def _recombine_heads(self, x: Tensor) -> Tensor:
b, n_heads, n_tokens, c_per_head = x.shape
x = x.transpose(1, 2)
return x.reshape(b, n_tokens, n_heads * c_per_head) # B x N_tokens x C
def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
# Input projections
q = self.q_proj(q)
k = self.k_proj(k)
v = self.v_proj(v)
# Separate into heads
q = self._separate_heads(q, self.num_heads)
k = self._separate_heads(k, self.num_heads)
v = self._separate_heads(v, self.num_heads)
dropout_p = self.dropout_p if self.training else 0.0
# Attention
try:
with sdp_kernel_context(dropout_p):
out = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
except Exception as e:
# Fall back to all kernels if the Flash attention kernel fails
warnings.warn(
f"Flash Attention kernel failed due to: {e}\nFalling back to all available "
f"kernels for scaled_dot_product_attention (which may have a slower speed).",
category=UserWarning,
stacklevel=2,
)
global ALLOW_ALL_KERNELS
ALLOW_ALL_KERNELS = True
out = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
out = self._recombine_heads(out)
out = self.out_proj(out)
return out
class RoPEAttention(Attention):
"""Attention with rotary position encoding."""
def __init__(
self,
*args,
rope_theta=10000.0,
# whether to repeat q rope to match k length
# this is needed for cross-attention to memories
rope_k_repeat=False,
feat_sizes=(32, 32), # [w, h] for stride 16 feats at 512 resolution
**kwargs,
):
super().__init__(*args, **kwargs)
self.compute_cis = partial(
compute_axial_cis, dim=self.internal_dim // self.num_heads, theta=rope_theta
)
freqs_cis = self.compute_cis(end_x=feat_sizes[0], end_y=feat_sizes[1])
self.freqs_cis = freqs_cis
self.rope_k_repeat = rope_k_repeat
def forward(
self, q: Tensor, k: Tensor, v: Tensor, num_k_exclude_rope: int = 0
) -> Tensor:
# Input projections
q = self.q_proj(q)
k = self.k_proj(k)
v = self.v_proj(v)
# Separate into heads
q = self._separate_heads(q, self.num_heads)
k = self._separate_heads(k, self.num_heads)
v = self._separate_heads(v, self.num_heads)
# Apply rotary position encoding
w = h = math.sqrt(q.shape[-2])
self.freqs_cis = self.freqs_cis.to(q.device)
if self.freqs_cis.shape[0] != q.shape[-2]:
self.freqs_cis = self.compute_cis(end_x=w, end_y=h).to(q.device)
if q.shape[-2] != k.shape[-2]:
assert self.rope_k_repeat
num_k_rope = k.size(-2) - num_k_exclude_rope
q, k[:, :, :num_k_rope] = apply_rotary_enc(
q,
k[:, :, :num_k_rope],
freqs_cis=self.freqs_cis,
repeat_freqs_k=self.rope_k_repeat,
)
dropout_p = self.dropout_p if self.training else 0.0
# Attention
try:
with sdp_kernel_context(dropout_p):
out = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
except Exception as e:
# Fall back to all kernels if the Flash attention kernel fails
warnings.warn(
f"Flash Attention kernel failed due to: {e}\nFalling back to all available "
f"kernels for scaled_dot_product_attention (which may have a slower speed).",
category=UserWarning,
stacklevel=2,
)
global ALLOW_ALL_KERNELS
ALLOW_ALL_KERNELS = True
out = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)
out = self._recombine_heads(out)
out = self.out_proj(out)
return out
================================================
FILE: auto-seg/sam2/modeling/sam2_base.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.distributed
import torch.nn.functional as F
from torch.nn.init import trunc_normal_
from sam2.modeling.sam.mask_decoder import MaskDecoder
from sam2.modeling.sam.prompt_encoder import PromptEncoder
from sam2.modeling.sam.transformer import TwoWayTransformer
from sam2.modeling.sam2_utils import get_1d_sine_pe, MLP, select_closest_cond_frames
# a large negative value as a placeholder score for missing objects
NO_OBJ_SCORE = -1024.0
class SAM2Base(torch.nn.Module):
def __init__(
self,
image_encoder,
memory_attention,
memory_encoder,
num_maskmem=7, # default 1 input frame + 6 previous frames
image_size=512,
backbone_stride=16, # stride of the image backbone output
sigmoid_scale_for_mem_enc=1.0, # scale factor for mask sigmoid prob
sigmoid_bias_for_mem_enc=0.0, # bias factor for mask sigmoid prob
# During evaluation, whether to binarize the sigmoid mask logits on interacted frames with clicks
binarize_mask_from_pts_for_mem_enc=False,
use_mask_input_as_output_without_sam=False, # on frames with mask input, whether to directly output the input mask without using a SAM prompt encoder + mask decoder
# The maximum number of conditioning frames to participate in the memory attention (-1 means no limit; if there are more conditioning frames than this limit,
# we only cross-attend to the temporally closest `max_cond_frames_in_attn` conditioning frames in the encoder when tracking each frame). This gives the model
# a temporal locality when handling a large number of annotated frames (since closer frames should be more important) and also avoids GPU OOM.
max_cond_frames_in_attn=-1,
# on the first frame, whether to directly add the no-memory embedding to the image feature
# (instead of using the transformer encoder)
directly_add_no_mem_embed=False,
# whether to use high-resolution feature maps in the SAM mask decoder
use_high_res_features_in_sam=False,
# whether to output multiple (3) masks for the first click on initial conditioning frames
multimask_output_in_sam=False,
# the minimum and maximum number of clicks to use multimask_output_in_sam (only relevant when `multimask_output_in_sam=True`;
# default is 1 for both, meaning that only the first click gives multimask output; also note that a box counts as two points)
multimask_min_pt_num=1,
multimask_max_pt_num=1,
# whether to also use multimask output for tracking (not just for the first click on initial conditioning frames; only relevant when `multimask_output_in_sam=True`)
multimask_output_for_tracking=False,
# Whether to use multimask tokens for obj ptr; Only relevant when both
# use_obj_ptrs_in_encoder=True and multimask_output_for_tracking=True
use_multimask_token_for_obj_ptr: bool = False,
# whether to use sigmoid to restrict ious prediction to [0-1]
iou_prediction_use_sigmoid=False,
# The memory bank's temporal stride during evaluation (i.e. the `r` parameter in XMem and Cutie; XMem and Cutie use r=5).
# For r>1, the (self.num_maskmem - 1) non-conditioning memory frames consist of
# (self.num_maskmem - 2) nearest frames from every r-th frames, plus the last frame.
memory_temporal_stride_for_eval=1,
# if `add_all_frames_to_correct_as_cond` is True, we also append to the conditioning frame list any frame that receives a later correction click
# if `add_all_frames_to_correct_as_cond` is False, we conditioning frame list to only use those initial conditioning frames
add_all_frames_to_correct_as_cond=False,
# whether to apply non-overlapping constraints on the object masks in the memory encoder during evaluation (to avoid/alleviate superposing masks)
non_overlap_masks_for_mem_enc=False,
# whether to cross-attend to object pointers from other frames (based on SAM output tokens) in the encoder
use_obj_ptrs_in_encoder=False,
# the maximum number of object pointers from other frames in encoder cross attention (only relevant when `use_obj_ptrs_in_encoder=True`)
max_obj_ptrs_in_encoder=16,
# whether to add temporal positional encoding to the object pointers in the encoder (only relevant when `use_obj_ptrs_in_encoder=True`)
add_tpos_enc_to_obj_ptrs=True,
# whether to add an extra linear projection layer for the temporal positional encoding in the object pointers to avoid potential interference
# with spatial positional encoding (only relevant when both `use_obj_ptrs_in_encoder=True` and `add_tpos_enc_to_obj_ptrs=True`)
proj_tpos_enc_in_obj_ptrs=False,
# whether to only attend to object pointers in the past (before the current frame) in the encoder during evaluation
# (only relevant when `use_obj_ptrs_in_encoder=True`; this might avoid pointer information too far in the future to distract the initial tracking)
only_obj_ptrs_in_the_past_for_eval=False,
# Whether to predict if there is an object in the frame
pred_obj_scores: bool = False,
# Whether to use an MLP to predict object scores
pred_obj_scores_mlp: bool = False,
# Only relevant if pred_obj_scores=True and use_obj_ptrs_in_encoder=True;
# Whether to have a fixed no obj pointer when there is no object present
# or to use it as an additive embedding with obj_ptr produced by decoder
fixed_no_obj_ptr: bool = False,
# Soft no object, i.e. mix in no_obj_ptr softly,
# hope to make recovery easier if there is a mistake and mitigate accumulation of errors
soft_no_obj_ptr: bool = False,
use_mlp_for_obj_ptr_proj: bool = False,
# extra arguments used to construct the SAM mask decoder; if not None, it should be a dict of kwargs to be passed into `MaskDecoder` class.
sam_mask_decoder_extra_args=None,
compile_image_encoder: bool = False,
):
super().__init__()
# Part 1: the image backbone
self.image_encoder = image_encoder
# Use level 0, 1, 2 for high-res setting, or just level 2 for the default setting
self.use_high_res_features_in_sam = use_high_res_features_in_sam
self.num_feature_levels = 3 if use_high_res_features_in_sam else 1
self.use_obj_ptrs_in_encoder = use_obj_ptrs_in_encoder
self.max_obj_ptrs_in_encoder = max_obj_ptrs_in_encoder
if use_obj_ptrs_in_encoder:
# A conv layer to downsample the mask prompt to stride 4 (the same stride as
# low-res SAM mask logits) and to change its scales from 0~1 to SAM logit scale,
# so that it can be fed into the SAM mask decoder to generate a pointer.
self.mask_downsample = torch.nn.Conv2d(1, 1, kernel_size=4, stride=4)
self.add_tpos_enc_to_obj_ptrs = add_tpos_enc_to_obj_ptrs
if proj_tpos_enc_in_obj_ptrs:
assert add_tpos_enc_to_obj_ptrs # these options need to be used together
self.proj_tpos_enc_in_obj_ptrs = proj_tpos_enc_in_obj_ptrs
self.only_obj_ptrs_in_the_past_for_eval = only_obj_ptrs_in_the_past_for_eval
# Part 2: memory attention to condition current frame's visual features
# with memories (and obj ptrs) from past frames
self.memory_attention = memory_attention
self.hidden_dim = memory_attention.d_model
# Part 3: memory encoder for the previous frame's outputs
self.memory_encoder = memory_encoder
self.mem_dim = self.hidden_dim
if hasattr(self.memory_encoder, "out_proj") and hasattr(
self.memory_encoder.out_proj, "weight"
):
# if there is compression of memories along channel dim
self.mem_dim = self.memory_encoder.out_proj.weight.shape[0]
self.num_maskmem = num_maskmem # Number of memories accessible
# Temporal encoding of the memories
self.maskmem_tpos_enc = torch.nn.Parameter(
torch.zeros(num_maskmem, 1, 1, self.mem_dim)
)
trunc_normal_(self.maskmem_tpos_enc, std=0.02)
# a single token to indicate no memory embedding from previous frames
self.no_mem_embed = torch.nn.Parameter(torch.zeros(1, 1, self.hidden_dim))
self.no_mem_pos_enc = torch.nn.Parameter(torch.zeros(1, 1, self.hidden_dim))
trunc_normal_(self.no_mem_embed, std=0.02)
trunc_normal_(self.no_mem_pos_enc, std=0.02)
self.directly_add_no_mem_embed = directly_add_no_mem_embed
# Apply sigmoid to the output raw mask logits (to turn them from
# range (-inf, +inf) to range (0, 1)) before feeding them into the memory encoder
self.sigmoid_scale_for_mem_enc = sigmoid_scale_for_mem_enc
self.sigmoid_bias_for_mem_enc = sigmoid_bias_for_mem_enc
self.binarize_mask_from_pts_for_mem_enc = binarize_mask_from_pts_for_mem_enc
self.non_overlap_masks_for_mem_enc = non_overlap_masks_for_mem_enc
self.memory_temporal_stride_for_eval = memory_temporal_stride_for_eval
# On frames with mask input, whether to directly output the input mask without
# using a SAM prompt encoder + mask decoder
self.use_mask_input_as_output_without_sam = use_mask_input_as_output_without_sam
self.multimask_output_in_sam = multimask_output_in_sam
self.multimask_min_pt_num = multimask_min_pt_num
self.multimask_max_pt_num = multimask_max_pt_num
self.multimask_output_for_tracking = multimask_output_for_tracking
self.use_multimask_token_for_obj_ptr = use_multimask_token_for_obj_ptr
self.iou_prediction_use_sigmoid = iou_prediction_use_sigmoid
# Part 4: SAM-style prompt encoder (for both mask and point inputs)
# and SAM-style mask decoder for the final mask output
self.image_size = image_size
self.backbone_stride = backbone_stride
self.sam_mask_decoder_extra_args = sam_mask_decoder_extra_args
self.pred_obj_scores = pred_obj_scores
self.pred_obj_scores_mlp = pred_obj_scores_mlp
self.fixed_no_obj_ptr = fixed_no_obj_ptr
self.soft_no_obj_ptr = soft_no_obj_ptr
if self.fixed_no_obj_ptr:
assert self.pred_obj_scores
assert self.use_obj_ptrs_in_encoder
if self.pred_obj_scores and self.use_obj_ptrs_in_encoder:
self.no_obj_ptr = torch.nn.Parameter(torch.zeros(1, self.hidden_dim))
trunc_normal_(self.no_obj_ptr, std=0.02)
self.use_mlp_for_obj_ptr_proj = use_mlp_for_obj_ptr_proj
self._build_sam_heads()
self.add_all_frames_to_correct_as_cond = add_all_frames_to_correct_as_cond
self.max_cond_frames_in_attn = max_cond_frames_in_attn
# Model compilation
if compile_image_encoder:
# Compile the forward function (not the full module) to allow loading checkpoints.
print(
"Image encoder compilation is enabled. First forward pass will be slow."
)
self.image_encoder.forward = torch.compile(
self.image_encoder.forward,
mode="max-autotune",
fullgraph=True,
dynamic=False,
)
@property
def device(self):
return next(self.parameters()).device
def forward(self, *args, **kwargs):
raise NotImplementedError(
"Please use the corresponding methods in SAM2VideoPredictor for inference."
"See notebooks/video_predictor_example.ipynb for an example."
)
def _build_sam_heads(self):
"""Build SAM-style prompt encoder and mask decoder."""
self.sam_prompt_embed_dim = self.hidden_dim
self.sam_image_embedding_size = self.image_size // self.backbone_stride
# build PromptEncoder and MaskDecoder from SAM
# (their hyperparameters like `mask_in_chans=16` are from SAM code)
self.sam_prompt_encoder = PromptEncoder(
embed_dim=self.sam_prompt_embed_dim,
image_embedding_size=(
self.sam_image_embedding_size,
self.sam_image_embedding_size,
),
input_image_size=(self.image_size, self.image_size),
mask_in_chans=16,
)
self.sam_mask_decoder = MaskDecoder(
num_multimask_outputs=3,
transformer=TwoWayTransformer(
depth=2,
embedding_dim=self.sam_prompt_embed_dim,
mlp_dim=2048,
num_heads=8,
),
transformer_dim=self.sam_prompt_embed_dim,
iou_head_depth=3,
iou_head_hidden_dim=256,
use_high_res_features=self.use_high_res_features_in_sam,
iou_prediction_use_sigmoid=self.iou_prediction_use_sigmoid,
pred_obj_scores=self.pred_obj_scores,
pred_obj_scores_mlp=self.pred_obj_scores_mlp,
use_multimask_token_for_obj_ptr=self.use_multimask_token_for_obj_ptr,
**(self.sam_mask_decoder_extra_args or {}),
)
if self.use_obj_ptrs_in_encoder:
# a linear projection on SAM output tokens to turn them into object pointers
self.obj_ptr_proj = torch.nn.Linear(self.hidden_dim, self.hidden_dim)
if self.use_mlp_for_obj_ptr_proj:
self.obj_ptr_proj = MLP(
self.hidden_dim, self.hidden_dim, self.hidden_dim, 3
)
else:
self.obj_ptr_proj = torch.nn.Identity()
if self.proj_tpos_enc_in_obj_ptrs:
# a linear projection on temporal positional encoding in object pointers to
# avoid potential interference with spatial positional encoding
self.obj_ptr_tpos_proj = torch.nn.Linear(self.hidden_dim, self.mem_dim)
else:
self.obj_ptr_tpos_proj = torch.nn.Identity()
def _forward_sam_heads(
self,
backbone_features,
point_inputs=None,
mask_inputs=None,
high_res_features=None,
multimask_output=False,
):
"""
Forward SAM prompt encoders and mask heads.
Inputs:
- backbone_features: image features of [B, C, H, W] shape
- point_inputs: a dictionary with "point_coords" and "point_labels", where
1) "point_coords" has [B, P, 2] shape and float32 dtype and contains the
absolute pixel-unit coordinate in (x, y) format of the P input points
2) "point_labels" has shape [B, P] and int32 dtype, where 1 means
positive clicks, 0 means negative clicks, and -1 means padding
- mask_inputs: a mask of [B, 1, H*16, W*16] shape, float or bool, with the
same spatial size as the image.
- high_res_features: either 1) None or 2) or a list of length 2 containing
two feature maps of [B, C, 4*H, 4*W] and [B, C, 2*H, 2*W] shapes respectively,
which will be used as high-resolution feature maps for SAM decoder.
- multimask_output: if it's True, we output 3 candidate masks and their 3
corresponding IoU estimates, and if it's False, we output only 1 mask and
its corresponding IoU estimate.
Outputs:
- low_res_multimasks: [B, M, H*4, W*4] shape (where M = 3 if
`multimask_output=True` and M = 1 if `multimask_output=False`), the SAM
output mask logits (before sigmoid) for the low-resolution masks, with 4x
the resolution (1/4 stride) of the input backbone_features.
- high_res_multimasks: [B, M, H*16, W*16] shape (where M = 3
if `multimask_output=True` and M = 1 if `multimask_output=False`),
upsampled from the low-resolution masks, with shape size as the image
(stride is 1 pixel).
- ious, [B, M] shape, where (where M = 3 if `multimask_output=True` and M = 1
if `multimask_output=False`), the estimated IoU of each output mask.
- low_res_masks: [B, 1, H*4, W*4] shape, the best mask in `low_res_multimasks`.
If `multimask_output=True`, it's the mask with the highest IoU estimate.
If `multimask_output=False`, it's the same as `low_res_multimasks`.
- high_res_masks: [B, 1, H*16, W*16] shape, the best mask in `high_res_multimasks`.
If `multimask_output=True`, it's the mask with the highest IoU estimate.
If `multimask_output=False`, it's the same as `high_res_multimasks`.
- obj_ptr: [B, C] shape, the object pointer vector for the output mask, extracted
based on the output token from the SAM mask decoder.
"""
B = backbone_features.size(0)
device = backbone_features.device
assert backbone_features.size(1) == self.sam_prompt_embed_dim
assert backbone_features.size(2) == self.sam_image_embedding_size
assert backbone_features.size(3) == self.sam_image_embedding_size
# a) Handle point prompts
if point_inputs is not None:
sam_point_coords = point_inputs["point_coords"]
sam_point_labels = point_inputs["point_labels"]
assert sam_point_coords.size(0) == B and sam_point_labels.size(0) == B
else:
# If no points are provide, pad with an empty point (with label -1)
sam_point_coords = torch.zeros(B, 1, 2, device=device)
sam_point_labels = -torch.ones(B, 1, dtype=torch.int32, device=device)
# b) Handle mask prompts
if mask_inputs is not None:
# If mask_inputs is provided, downsize it into low-res mask input if needed
# and feed it as a dense mask prompt into the SAM mask encoder
assert len(mask_inputs.shape) == 4 and mask_inputs.shape[:2] == (B, 1)
if mask_inputs.shape[-2:] != self.sam_prompt_encoder.mask_input_size:
sam_mask_prompt = F.interpolate(
mask_inputs.float(),
size=self.sam_prompt_encoder.mask_input_size,
align_corners=False,
mode="bilinear",
antialias=True, # use antialias for downsampling
)
else:
sam_mask_prompt = mask_inputs
else:
# Otherwise, simply feed None (and SAM's prompt encoder will add
# a learned `no_mask_embed` to indicate no mask input in this case).
sam_mask_prompt = None
sparse_embeddings, dense_embeddings = self.sam_prompt_encoder(
points=(sam_point_coords, sam_point_labels),
boxes=None,
masks=sam_mask_prompt,
)
(
low_res_multimasks,
ious,
sam_output_tokens,
object_score_logits,
) = self.sam_mask_decoder(
image_embeddings=backbone_features,
image_pe=self.sam_prompt_encoder.get_dense_pe(),
sparse_prompt_embeddings=sparse_embeddings,
dense_prompt_embeddings=dense_embeddings,
multimask_output=multimask_output,
repeat_image=False, # the image is already batched
high_res_features=high_res_features,
)
if self.pred_obj_scores:
is_obj_appearing = object_score_logits > 0
# Mask used for spatial memories is always a *hard* choice between obj and no obj,
# consistent with the actual mask prediction
low_res_multimasks = torch.where(
is_obj_appearing[:, None, None],
low_res_multimasks,
NO_OBJ_SCORE,
)
# convert masks from possibly bfloat16 (or float16) to float32
# (older PyTorch versions before 2.1 don't support `interpolate` on bf16)
low_res_multimasks = low_res_multimasks.float()
high_res_multimasks = F.interpolate(
low_res_multimasks,
size=(self.image_size, self.image_size),
mode="bilinear",
align_corners=False,
)
sam_output_token = sam_output_tokens[:, 0]
if multimask_output:
# take the best mask prediction (with the highest IoU estimation)
best_iou_inds = torch.argmax(ious, dim=-1)
batch_inds = torch.arange(B, device=device)
low_res_masks = low_res_multimasks[batch_inds, best_iou_inds].unsqueeze(1)
high_res_masks = high_res_multimasks[batch_inds, best_iou_inds].unsqueeze(1)
if sam_output_tokens.size(1) > 1:
sam_output_token = sam_output_tokens[batch_inds, best_iou_inds]
else:
low_res_masks, high_res_masks = low_res_multimasks, high_res_multimasks
# Extract object pointer from the SAM output token (with occlusion handling)
obj_ptr = self.obj_ptr_proj(sam_output_token)
if self.pred_obj_scores:
# Allow *soft* no obj ptr, unlike for masks
if self.soft_no_obj_ptr:
# Only hard possible with gt
assert not self.teacher_force_obj_scores_for_mem
lambda_is_obj_appearing = object_score_logits.sigmoid()
else:
lambda_is_obj_appearing = is_obj_appearing.float()
if self.fixed_no_obj_ptr:
obj_ptr = lambda_is_obj_appearing * obj_ptr
obj_ptr = obj_ptr + (1 - lambda_is_obj_appearing) * self.no_obj_ptr
return (
low_res_multimasks,
high_res_multimasks,
ious,
low_res_masks,
high_res_masks,
obj_ptr,
object_score_logits,
)
def _use_mask_as_output(self, backbone_features, high_res_features, mask_inputs):
"""
Directly turn binary `mask_inputs` into a output mask logits without using SAM.
(same input and output shapes as in _forward_sam_heads above).
"""
# Use -10/+10 as logits for neg/pos pixels (very close to 0/1 in prob after sigmoid).
out_scale, out_bias = 20.0, -10.0 # sigmoid(-10.0)=4.5398e-05
mask_inputs_float = mask_inputs.float()
high_res_masks = mask_inputs_float * out_scale + out_bias
low_res_masks = F.interpolate(
high_res_masks,
size=(high_res_masks.size(-2) // 4, high_res_masks.size(-1) // 4),
align_corners=False,
mode="bilinear",
antialias=True, # use antialias for downsampling
)
# a dummy IoU prediction of all 1's under mask input
ious = mask_inputs.new_ones(mask_inputs.size(0), 1).float()
if not self.use_obj_ptrs_in_encoder:
# all zeros as a dummy object pointer (of shape [B, C])
obj_ptr = torch.zeros(
mask_inputs.size(0), self.hidden_dim, device=mask_inputs.device
)
else:
# produce an object pointer using the SAM decoder from the mask input
_, _, _, _, _, obj_ptr, _ = self._forward_sam_heads(
backbone_features=backbone_features,
mask_inputs=self.mask_downsample(mask_inputs_float),
high_res_features=high_res_features,
)
# In this method, we are treating mask_input as output, e.g. using it directly to create spatial mem;
# Below, we follow the same design axiom to use mask_input to decide if obj appears or not instead of relying
# on the object_scores from the SAM decoder.
is_obj_appearing = torch.any(mask_inputs.flatten(1).float() > 0.0, dim=1)
is_obj_appearing = is_obj_appearing[..., None]
lambda_is_obj_appearing = is_obj_appearing.float()
object_score_logits = out_scale * lambda_is_obj_appearing + out_bias
if self.pred_obj_scores:
if self.fixed_no_obj_ptr:
obj_ptr = lambda_is_obj_appearing * obj_ptr
obj_ptr = obj_ptr + (1 - lambda_is_obj_appearing) * self.no_obj_ptr
return (
low_res_masks,
high_res_masks,
ious,
low_res_masks,
high_res_masks,
obj_ptr,
object_score_logits,
)
def forward_image(self, img_batch: torch.Tensor):
"""Get the image feature on the input batch."""
backbone_out = self.image_encoder(img_batch)
if self.use_high_res_features_in_sam:
# precompute projected level 0 and level 1 features in SAM decoder
# to avoid running it again on every SAM click
backbone_out["backbone_fpn"][0] = self.sam_mask_decoder.conv_s0(
backbone_out["backbone_fpn"][0]
)
backbone_out["backbone_fpn"][1] = self.sam_mask_decoder.conv_s1(
backbone_out["backbone_fpn"][1]
)
return backbone_out
def _prepare_backbone_features(self, backbone_out):
"""Prepare and flatten visual features."""
backbone_out = backbone_out.copy()
assert len(backbone_out["backbone_fpn"]) == len(backbone_out["vision_pos_enc"])
assert len(backbone_out["backbone_fpn"]) >= self.num_feature_levels
feature_maps = backbone_out["backbone_fpn"][-self.num_feature_levels :]
vision_pos_embeds = backbone_out["vision_pos_enc"][-self.num_feature_levels :]
feat_sizes = [(x.shape[-2], x.shape[-1]) for x in vision_pos_embeds]
# flatten NxCxHxW to HWxNxC
vision_feats = [x.flatten(2).permute(2, 0, 1) for x in feature_maps]
vision_pos_embeds = [x.flatten(2).permute(2, 0, 1) for x in vision_pos_embeds]
return backbone_out, vision_feats, vision_pos_embeds, feat_sizes
def _prepare_memory_conditioned_features(
self,
frame_idx,
is_init_cond_frame,
current_vision_feats,
current_vision_pos_embeds,
feat_sizes,
output_dict,
num_frames,
track_in_reverse=False, # tracking in reverse time order (for demo usage)
):
"""Fuse the current frame's visual feature map with previous memory."""
B = current_vision_feats[-1].size(1) # batch size on this frame
C = self.hidden_dim
H, W = feat_sizes[-1] # top-level (lowest-resolution) feature size
device = current_vision_feats[-1].device
# The case of `self.num_maskmem == 0` below is primarily used for reproducing SAM on images.
# In this case, we skip the fusion with any memory.
if self.num_maskmem == 0: # Disable memory and skip fusion
pix_feat = current_vision_feats[-1].permute(1, 2, 0).view(B, C, H, W)
return pix_feat
num_obj_ptr_tokens = 0
# Step 1: condition the visual features of the current frame on previous memories
if not is_init_cond_frame:
# Retrieve the memories encoded with the maskmem backbone
to_cat_memory, to_cat_memory_pos_embed = [], []
# Add conditioning frames's output first (all cond frames have t_pos=0 for
# when getting temporal positional embedding below)
assert len(output_dict["cond_frame_outputs"]) > 0
# Select a maximum number of temporally closest cond frames for cross attention
cond_outputs = output_dict["cond_frame_outputs"]
selected_cond_outputs, unselected_cond_outputs = select_closest_cond_frames(
frame_idx, cond_outputs, self.max_cond_frames_in_attn
)
t_pos_and_prevs = [(0, out) for out in selected_cond_outputs.values()]
# Add last (self.num_maskmem - 1) frames before current frame for non-conditioning memory
# the earliest one has t_pos=1 and the latest one has t_pos=self.num_maskmem-1
# We also allow taking the memory frame non-consecutively (with r>1), in which case
# we take (self.num_maskmem - 2) frames among every r-th frames plus the last frame.
r = self.memory_temporal_stride_for_eval
for t_pos in range(1, self.num_maskmem):
t_rel = self.num_maskmem - t_pos # how many frames before current frame
if t_rel == 1:
# for t_rel == 1, we take the last frame (regardless of r)
if not track_in_reverse:
# the frame immediately before this frame (i.e. frame_idx - 1)
prev_frame_idx = frame_idx - t_rel
else:
# the frame immediately after this frame (i.e. frame_idx + 1)
prev_frame_idx = frame_idx + t_rel
else:
# for t_rel >= 2, we take the memory frame from every r-th frames
if not track_in_reverse:
# first find the nearest frame among every r-th frames before this frame
# for r=1, this would be (frame_idx - 2)
prev_frame_idx = ((frame_idx - 2) // r) * r
# then seek further among every r-th frames
prev_frame_idx = prev_frame_idx - (t_rel - 2) * r
else:
# first find the nearest frame among every r-th frames after this frame
# for r=1, this would be (frame_idx + 2)
prev_frame_idx = -(-(frame_idx + 2) // r) * r
# then seek further among every r-th frames
prev_frame_idx = prev_frame_idx + (t_rel - 2) * r
out = output_dict["non_cond_frame_outputs"].get(prev_frame_idx, None)
if out is None:
# If an unselected conditioning frame is among the last (self.num_maskmem - 1)
# frames, we still attend to it as if it's a non-conditioning frame.
out = unselected_cond_outputs.get(prev_frame_idx, None)
t_pos_and_prevs.append((t_pos, out))
for t_pos, prev in t_pos_and_prevs:
if prev is None:
continue # skip padding frames
# "maskmem_features" might have been offloaded to CPU in demo use cases,
# so we load it back to GPU (it's a no-op if it's already on GPU).
feats = prev["maskmem_features"].to(device, non_blocking=True)
to_cat_memory.append(feats.flatten(2).permute(2, 0, 1))
# Spatial positional encoding (it might have been offloaded to CPU in eval)
maskmem_enc = prev["maskmem_pos_enc"][-1].to(device)
maskmem_enc = maskmem_enc.flatten(2).permute(2, 0, 1)
# Temporal positional encoding
maskmem_enc = (
maskmem_enc + self.maskmem_tpos_enc[self.num_maskmem - t_pos - 1]
)
to_cat_memory_pos_embed.append(maskmem_enc)
# Construct the list of past object pointers
if self.use_obj_ptrs_in_encoder:
max_obj_ptrs_in_encoder = min(num_frames, self.max_obj_ptrs_in_encoder)
# First add those object pointers from selected conditioning frames
# (optionally, only include object pointers in the past during evaluation)
if not self.training and self.only_obj_ptrs_in_the_past_for_eval:
ptr_cond_outputs = {
t: out
for t, out in selected_cond_outputs.items()
if (t >= frame_idx if track_in_reverse else t <= frame_idx)
}
else:
ptr_cond_outputs = selected_cond_outputs
pos_and_ptrs = [
# Temporal pos encoding contains how far away each pointer is from current frame
(abs(frame_idx - t), out["obj_ptr"])
for t, out in ptr_cond_outputs.items()
]
# Add up to (max_obj_ptrs_in_encoder - 1) non-conditioning frames before current frame
for t_diff in range(1, max_obj_ptrs_in_encoder):
t = frame_idx + t_diff if track_in_reverse else frame_idx - t_diff
if t < 0 or (num_frames is not None and t >= num_frames):
break
out = output_dict["non_cond_frame_outputs"].get(
t, unselected_cond_outputs.get(t, None)
)
if out is not None:
pos_and_ptrs.append((t_diff, out["obj_ptr"]))
# If we have at least one object pointer, add them to the across attention
if len(pos_and_ptrs) > 0:
pos_list, ptrs_list = zip(*pos_and_ptrs)
# stack object pointers along dim=0 into [ptr_seq_len, B, C] shape
obj_ptrs = torch.stack(ptrs_list, dim=0)
# a temporal positional embedding based on how far each object pointer is from
# the current frame (sine embedding normalized by the max pointer num).
if self.add_tpos_enc_to_obj_ptrs:
t_diff_max = max_obj_ptrs_in_encoder - 1
tpos_dim = C if self.proj_tpos_enc_in_obj_ptrs else self.mem_dim
obj_pos = torch.tensor(pos_list, device=device)
obj_pos = get_1d_sine_pe(obj_pos / t_diff_max, dim=tpos_dim)
obj_pos = self.obj_ptr_tpos_proj(obj_pos)
obj_pos = obj_pos.unsqueeze(1).expand(-1, B, self.mem_dim)
else:
obj_pos = obj_ptrs.new_zeros(len(pos_list), B, self.mem_dim)
if self.mem_dim < C:
# split a pointer into (C // self.mem_dim) tokens for self.mem_dim < C
obj_ptrs = obj_ptrs.reshape(
-1, B, C // self.mem_dim, self.mem_dim
)
obj_ptrs = obj_ptrs.permute(0, 2, 1, 3).flatten(0, 1)
obj_pos = obj_pos.repeat_interleave(C // self.mem_dim, dim=0)
to_cat_memory.append(obj_ptrs)
to_cat_memory_pos_embed.append(obj_pos)
num_obj_ptr_tokens = obj_ptrs.shape[0]
else:
num_obj_ptr_tokens = 0
else:
# for initial conditioning frames, encode them without using any previous memory
if self.directly_add_no_mem_embed:
# directly add no-mem embedding (instead of using the transformer encoder)
pix_feat_with_mem = current_vision_feats[-1] + self.no_mem_embed
pix_feat_with_mem = pix_feat_with_mem.permute(1, 2, 0).view(B, C, H, W)
return pix_feat_with_mem
# Use a dummy token on the first frame (to avoid empty memory input to tranformer encoder)
to_cat_memory = [self.no_mem_embed.expand(1, B, self.mem_dim)]
to_cat_memory_pos_embed = [self.no_mem_pos_enc.expand(1, B, self.mem_dim)]
# Step 2: Concatenate the memories and forward through the transformer encoder
memory = torch.cat(to_cat_memory, dim=0)
memory_pos_embed = torch.cat(to_cat_memory_pos_embed, dim=0)
pix_feat_with_mem = self.memory_attention(
curr=current_vision_feats,
curr_pos=current_vision_pos_embeds,
memory=memory,
memory_pos=memory_pos_embed,
num_obj_ptr_tokens=num_obj_ptr_tokens,
)
# reshape the output (HW)BC => BCHW
pix_feat_with_mem = pix_feat_with_mem.permute(1, 2, 0).view(B, C, H, W)
return pix_feat_with_mem
def _encode_new_memory(
self,
current_vision_feats,
feat_sizes,
pred_masks_high_res,
is_mask_from_pts,
):
"""Encode the current image and its prediction into a memory feature."""
B = current_vision_feats[-1].size(1) # batch size on this frame
C = self.hidden_dim
H, W = feat_sizes[-1] # top-level (lowest-resolution) feature size
# top-level feature, (HW)BC => BCHW
pix_feat = current_vision_feats[-1].permute(1, 2, 0).view(B, C, H, W)
if self.non_overlap_masks_for_mem_enc and not self.training:
# optionally, apply non-overlapping constraints to the masks (it's applied
# in the batch dimension and should only be used during eval, where all
# the objects come from the same video under batch size 1).
pred_masks_high_res = self._apply_non_overlapping_constraints(
pred_masks_high_res
)
# scale the raw mask logits with a temperature before applying sigmoid
binarize = self.binarize_mask_from_pts_for_mem_enc and is_mask_from_pts
if binarize and not self.training:
mask_for_mem = (pred_masks_high_res > 0).float()
else:
# apply sigmoid on the raw mask logits to turn them into range (0, 1)
mask_for_mem = torch.sigmoid(pred_masks_high_res)
# apply scale and bias terms to the sigmoid probabilities
if self.sigmoid_scale_for_mem_enc != 1.0:
mask_for_mem = mask_for_mem * self.sigmoid_scale_for_mem_enc
if self.sigmoid_bias_for_mem_enc != 0.0:
mask_for_mem = mask_for_mem + self.sigmoid_bias_for_mem_enc
maskmem_out = self.memory_encoder(
pix_feat, mask_for_mem, skip_mask_sigmoid=True # sigmoid already applied
)
maskmem_features = maskmem_out["vision_features"]
maskmem_pos_enc = maskmem_out["vision_pos_enc"]
return maskmem_features, maskmem_pos_enc
def track_step(
self,
frame_idx,
is_init_cond_frame,
current_vision_feats,
current_vision_pos_embeds,
feat_sizes,
point_inputs,
mask_inputs,
output_dict,
num_frames,
track_in_reverse=False, # tracking in reverse time order (for demo usage)
# Whether to run the memory encoder on the predicted masks. Sometimes we might want
# to skip the memory encoder with `run_mem_encoder=False`. For example,
# in demo we might call `track_step` multiple times for each user click,
# and only encode the memory when the user finalizes their clicks. And in ablation
# settings like SAM training on static images, we don't need the memory encoder.
run_mem_encoder=True,
# The previously predicted SAM mask logits (which can be fed together with new clicks in demo).
prev_sam_mask_logits=None,
):
current_out = {"point_inputs": point_inputs, "mask_inputs": mask_inputs}
# High-resolution feature maps for the SAM head, reshape (HW)BC => BCHW
if len(current_vision_feats) > 1:
high_res_features = [
x.permute(1, 2, 0).view(x.size(1), x.size(2), *s)
for x, s in zip(current_vision_feats[:-1], feat_sizes[:-1])
]
else:
high_res_features = None
if mask_inputs is not None and self.use_mask_input_as_output_without_sam:
# When use_mask_input_as_output_without_sam=True, we directly output the mask input
# (see it as a GT mask) without using a SAM prompt encoder + mask decoder.
pix_feat = current_vision_feats[-1].permute(1, 2, 0)
pix_feat = pix_feat.view(-1, self.hidden_dim, *feat_sizes[-1])
sam_outputs = self._use_mask_as_output(
pix_feat, high_res_features, mask_inputs
)
else:
# fused the visual feature with previous memory features in the memory bank
pix_feat_with_mem = self._prepare_memory_conditioned_features(
frame_idx=frame_idx,
is_init_cond_frame=is_init_cond_frame,
current_vision_feats=current_vision_feats[-1:],
current_vision_pos_embeds=current_vision_pos_embeds[-1:],
feat_sizes=feat_sizes[-1:],
output_dict=output_dict,
num_frames=num_frames,
track_in_reverse=track_in_reverse,
)
# apply SAM-style segmentation head
# here we might feed previously predicted low-res SAM mask logits into the SAM mask decoder,
# e.g. in demo where such logits come from earlier interaction instead of correction sampling
# (in this case, any `mask_inputs` shouldn't reach here as they are sent to _use_mask_as_output instead)
if prev_sam_mask_logits is not None:
assert point_inputs is not None and mask_inputs is None
mask_inputs = prev_sam_mask_logits
multimask_output = self._use_multimask(is_init_cond_frame, point_inputs)
sam_outputs = self._forward_sam_heads(
backbone_features=pix_feat_with_mem,
point_inputs=point_inputs,
mask_inputs=mask_inputs,
high_res_features=high_res_features,
multimask_output=multimask_output,
)
(
_,
_,
_,
low_res_masks,
high_res_masks,
obj_ptr,
_,
) = sam_outputs
current_out["pred_masks"] = low_res_masks
current_out["pred_masks_high_res"] = high_res_masks
current_out["obj_ptr"] = obj_ptr
# Finally run the memory encoder on the predicted mask to encode
# it into a new memory feature (that can be used in future frames)
if run_mem_encoder and self.num_maskmem > 0:
high_res_masks_for_mem_enc = high_res_masks
maskmem_features, maskmem_pos_enc = self._encode_new_memory(
current_vision_feats=current_vision_feats,
feat_sizes=feat_sizes,
pred_masks_high_res=high_res_masks_for_mem_enc,
is_mask_from_pts=(point_inputs is not None),
)
current_out["maskmem_features"] = maskmem_features
current_out["maskmem_pos_enc"] = maskmem_pos_enc
else:
current_out["maskmem_features"] = None
current_out["maskmem_pos_enc"] = None
return current_out
def _use_multimask(self, is_init_cond_frame, point_inputs):
"""Whether to use multimask output in the SAM head."""
num_pts = 0 if point_inputs is None else point_inputs["point_labels"].size(1)
multimask_output = (
self.multimask_output_in_sam
and (is_init_cond_frame or self.multimask_output_for_tracking)
and (self.multimask_min_pt_num <= num_pts <= self.multimask_max_pt_num)
)
return multimask_output
def _apply_non_overlapping_constraints(self, pred_masks):
"""
Apply non-overlapping constraints to the object scores in pred_masks. Here we
keep only the highest scoring object at each spatial location in pred_masks.
"""
batch_size = pred_masks.size(0)
if batch_size == 1:
return pred_masks
device = pred_masks.device
# "max_obj_inds": object index of the object with the highest score at each location
max_obj_inds = torch.argmax(pred_masks, dim=0, keepdim=True)
# "batch_obj_inds": object index of each object slice (along dim 0) in `pred_masks`
batch_obj_inds = torch.arange(batch_size, device=device)[:, None, None, None]
keep = max_obj_inds == batch_obj_inds
# suppress overlapping regions' scores below -10.0 so that the foreground regions
# don't overlap (here sigmoid(-10.0)=4.5398e-05)
pred_masks = torch.where(keep, pred_masks, torch.clamp(pred_masks, max=-10.0))
return pred_masks
================================================
FILE: auto-seg/sam2/modeling/sam2_utils.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
def select_closest_cond_frames(frame_idx, cond_frame_outputs, max_cond_frame_num):
"""
Select up to `max_cond_frame_num` conditioning frames from `cond_frame_outputs`
that are temporally closest to the current frame at `frame_idx`. Here, we take
- a) the closest conditioning frame before `frame_idx` (if any);
- b) the closest conditioning frame after `frame_idx` (if any);
- c) any other temporally closest conditioning frames until reaching a total
of `max_cond_frame_num` conditioning frames.
Outputs:
- selected_outputs: selected items (keys & values) from `cond_frame_outputs`.
- unselected_outputs: items (keys & values) not selected in `cond_frame_outputs`.
"""
if max_cond_frame_num == -1 or len(cond_frame_outputs) <= max_cond_frame_num:
selected_outputs = cond_frame_outputs
unselected_outputs = {}
else:
assert max_cond_frame_num >= 2, "we should allow using 2+ conditioning frames"
selected_outputs = {}
# the closest conditioning frame before `frame_idx` (if any)
idx_before = max((t for t in cond_frame_outputs if t < frame_idx), default=None)
if idx_before is not None:
selected_outputs[idx_before] = cond_frame_outputs[idx_before]
# the closest conditioning frame after `frame_idx` (if any)
idx_after = min((t for t in cond_frame_outputs if t >= frame_idx), default=None)
if idx_after is not None:
selected_outputs[idx_after] = cond_frame_outputs[idx_after]
# add other temporally closest conditioning frames until reaching a total
# of `max_cond_frame_num` conditioning frames.
num_remain = max_cond_frame_num - len(selected_outputs)
inds_remain = sorted(
(t for t in cond_frame_outputs if t not in selected_outputs),
key=lambda x: abs(x - frame_idx),
)[:num_remain]
selected_outputs.update((t, cond_frame_outputs[t]) for t in inds_remain)
unselected_outputs = {
t: v for t, v in cond_frame_outputs.items() if t not in selected_outputs
}
return selected_outputs, unselected_outputs
def get_1d_sine_pe(pos_inds, dim, temperature=10000):
"""
Get 1D sine positional embedding as in the original Transformer paper.
"""
pe_dim = dim // 2
dim_t = torch.arange(pe_dim, dtype=torch.float32, device=pos_inds.device)
dim_t = temperature ** (2 * (dim_t // 2) / pe_dim)
pos_embed = pos_inds.unsqueeze(-1) / dim_t
pos_embed = torch.cat([pos_embed.sin(), pos_embed.cos()], dim=-1)
return pos_embed
def get_activation_fn(activation):
"""Return an activation function given a string"""
if activation == "relu":
return F.relu
if activation == "gelu":
return F.gelu
if activation == "glu":
return F.glu
raise RuntimeError(f"activation should be relu/gelu, not {activation}.")
def get_clones(module, N):
return nn.ModuleList([copy.deepcopy(module) for i in range(N)])
class DropPath(nn.Module):
# adapted from https://github.com/huggingface/pytorch-image-models/blob/main/timm/layers/drop.py
def __init__(self, drop_prob=0.0, scale_by_keep=True):
super(DropPath, self).__init__()
self.drop_prob = drop_prob
self.scale_by_keep = scale_by_keep
def forward(self, x):
if self.drop_prob == 0.0 or not self.training:
return x
keep_prob = 1 - self.drop_prob
shape = (x.shape[0],) + (1,) * (x.ndim - 1)
random_tensor = x.new_empty(shape).bernoulli_(keep_prob)
if keep_prob > 0.0 and self.scale_by_keep:
random_tensor.div_(keep_prob)
return x * random_tensor
# Lightly adapted from
# https://github.com/facebookresearch/MaskFormer/blob/main/mask_former/modeling/transformer/transformer_predictor.py # noqa
class MLP(nn.Module):
def __init__(
self,
input_dim: int,
hidden_dim: int,
output_dim: int,
num_layers: int,
activation: nn.Module = nn.ReLU,
sigmoid_output: bool = False,
) -> None:
super().__init__()
self.num_layers = num_layers
h = [hidden_dim] * (num_layers - 1)
self.layers = nn.ModuleList(
nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim])
)
self.sigmoid_output = sigmoid_output
self.act = activation()
def forward(self, x):
for i, layer in enumerate(self.layers):
x = self.act(layer(x)) if i < self.num_layers - 1 else layer(x)
if self.sigmoid_output:
x = F.sigmoid(x)
return x
# From https://github.com/facebookresearch/detectron2/blob/main/detectron2/layers/batch_norm.py # noqa
# Itself from https://github.com/facebookresearch/ConvNeXt/blob/d1fa8f6fef0a165b27399986cc2bdacc92777e40/models/convnext.py#L119 # noqa
class LayerNorm2d(nn.Module):
def __init__(self, num_channels: int, eps: float = 1e-6) -> None:
super().__init__()
self.weight = nn.Parameter(torch.ones(num_channels))
self.bias = nn.Parameter(torch.zeros(num_channels))
self.eps = eps
def forward(self, x: torch.Tensor) -> torch.Tensor:
u = x.mean(1, keepdim=True)
s = (x - u).pow(2).mean(1, keepdim=True)
x = (x - u) / torch.sqrt(s + self.eps)
x = self.weight[:, None, None] * x + self.bias[:, None, None]
return x
================================================
FILE: auto-seg/sam2/sam2_image_predictor.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
from PIL.Image import Image
from sam2.modeling.sam2_base import SAM2Base
from sam2.utils.transforms import SAM2Transforms
class SAM2ImagePredictor:
def __init__(
self,
sam_model: SAM2Base,
mask_threshold=0.0,
max_hole_area=0.0,
max_sprinkle_area=0.0,
**kwargs,
) -> None:
"""
Uses SAM-2 to calculate the image embedding for an image, and then
allow repeated, efficient mask prediction given prompts.
Arguments:
sam_model (Sam-2): The model to use for mask prediction.
mask_threshold (float): The threshold to use when converting mask logits
to binary masks. Masks are thresholded at 0 by default.
max_hole_area (int): If max_hole_area > 0, we fill small holes in up to
the maximum area of max_hole_area in low_res_masks.
max_sprinkle_area (int): If max_sprinkle_area > 0, we remove small sprinkles up to
the maximum area of max_sprinkle_area in low_res_masks.
"""
super().__init__()
self.model = sam_model
self._transforms = SAM2Transforms(
resolution=self.model.image_size,
mask_threshold=mask_threshold,
max_hole_area=max_hole_area,
max_sprinkle_area=max_sprinkle_area,
)
# Predictor state
self._is_image_set = False
self._features = None
self._orig_hw = None
# Whether the predictor is set for single image or a batch of images
self._is_batch = False
# Predictor config
self.mask_threshold = mask_threshold
# Spatial dim for backbone feature maps
self._bb_feat_sizes = [
(256, 256),
(128, 128),
(64, 64),
]
@classmethod
def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2ImagePredictor":
"""
Load a pretrained model from the Hugging Face hub.
Arguments:
model_id (str): The Hugging Face repository ID.
**kwargs: Additional arguments to pass to the model constructor.
Returns:
(SAM2ImagePredictor): The loaded model.
"""
from sam2.build_sam import build_sam2_hf
sam_model = build_sam2_hf(model_id, **kwargs)
return cls(sam_model, **kwargs)
@torch.no_grad()
def set_image(
self,
image: Union[np.ndarray, Image],
) -> None:
"""
Calculates the image embeddings for the provided image, allowing
masks to be predicted with the 'predict' method.
Arguments:
image (np.ndarray or PIL Image): The input image to embed in RGB format. The image should be in HWC format if np.ndarray, or WHC format if PIL Image
with pixel values in [0, 255].
image_format (str): The color format of the image, in ['RGB', 'BGR'].
"""
self.reset_predictor()
# Transform the image to the form expected by the model
if isinstance(image, np.ndarray):
logging.info("For numpy array image, we assume (HxWxC) format")
self._orig_hw = [image.shape[:2]]
elif isinstance(image, Image):
w, h = image.size
self._orig_hw = [(h, w)]
else:
raise NotImplementedError("Image format not supported")
input_image = self._transforms(image)
input_image = input_image[None, ...].to(self.device)
assert (
len(input_image.shape) == 4 and input_image.shape[1] == 3
), f"input_image must be of size 1x3xHxW, got {input_image.shape}"
logging.info("Computing image embeddings for the provided image...")
backbone_out = self.model.forward_image(input_image)
_, vision_feats, _, _ = self.model._prepare_backbone_features(backbone_out)
# Add no_mem_embed, which is added to the lowest rest feat. map during training on videos
if self.model.directly_add_no_mem_embed:
vision_feats[-1] = vision_feats[-1] + self.model.no_mem_embed
feats = [
feat.permute(1, 2, 0).view(1, -1, *feat_size)
for feat, feat_size in zip(vision_feats[::-1], self._bb_feat_sizes[::-1])
][::-1]
self._features = {"image_embed": feats[-1], "high_res_feats": feats[:-1]}
self._is_image_set = True
logging.info("Image embeddings computed.")
@torch.no_grad()
def set_image_batch(
self,
image_list: List[Union[np.ndarray]],
) -> None:
"""
Calculates the image embeddings for the provided image batch, allowing
masks to be predicted with the 'predict_batch' method.
Arguments:
image_list (List[np.ndarray]): The input images to embed in RGB format. The image should be in HWC format if np.ndarray
with pixel values in [0, 255].
"""
self.reset_predictor()
assert isinstance(image_list, list)
self._orig_hw = []
for image in image_list:
assert isinstance(
image, np.ndarray
), "Images are expected to be an np.ndarray in RGB format, and of shape HWC"
self._orig_hw.append(image.shape[:2])
# Transform the image to the form expected by the model
img_batch = self._transforms.forward_batch(image_list)
img_batch = img_batch.to(self.device)
batch_size = img_batch.shape[0]
assert (
len(img_batch.shape) == 4 and img_batch.shape[1] == 3
), f"img_batch must be of size Bx3xHxW, got {img_batch.shape}"
logging.info("Computing image embeddings for the provided images...")
backbone_out = self.model.forward_image(img_batch)
_, vision_feats, _, _ = self.model._prepare_backbone_features(backbone_out)
# Add no_mem_embed, which is added to the lowest rest feat. map during training on videos
if self.model.directly_add_no_mem_embed:
vision_feats[-1] = vision_feats[-1] + self.model.no_mem_embed
feats = [
feat.permute(1, 2, 0).view(batch_size, -1, *feat_size)
for feat, feat_size in zip(vision_feats[::-1], self._bb_feat_sizes[::-1])
][::-1]
self._features = {"image_embed": feats[-1], "high_res_feats": feats[:-1]}
self._is_image_set = True
self._is_batch = True
logging.info("Image embeddings computed.")
def predict_batch(
self,
point_coords_batch: List[np.ndarray] = None,
point_labels_batch: List[np.ndarray] = None,
box_batch: List[np.ndarray] = None,
mask_input_batch: List[np.ndarray] = None,
multimask_output: bool = True,
return_logits: bool = False,
normalize_coords=True,
) -> Tuple[List[np.ndarray], List[np.ndarray], List[np.ndarray]]:
"""This function is very similar to predict(...), however it is used for batched mode, when the model is expected to generate predictions on multiple images.
It returns a tuple of lists of masks, ious, and low_res_masks_logits.
"""
assert self._is_batch, "This function should only be used when in batched mode"
if not self._is_image_set:
raise RuntimeError(
"An image must be set with .set_image_batch(...) before mask prediction."
)
num_images = len(self._features["image_embed"])
all_masks = []
all_ious = []
all_low_res_masks = []
for img_idx in range(num_images):
# Transform input prompts
point_coords = (
point_coords_batch[img_idx] if point_coords_batch is not None else None
)
point_labels = (
point_labels_batch[img_idx] if point_labels_batch is not None else None
)
box = box_batch[img_idx] if box_batch is not None else None
mask_input = (
mask_input_batch[img_idx] if mask_input_batch is not None else None
)
mask_input, unnorm_coords, labels, unnorm_box = self._prep_prompts(
point_coords,
point_labels,
box,
mask_input,
normalize_coords,
img_idx=img_idx,
)
masks, iou_predictions, low_res_masks = self._predict(
unnorm_coords,
labels,
unnorm_box,
mask_input,
multimask_output,
return_logits=return_logits,
img_idx=img_idx,
)
masks_np = masks.squeeze(0).float().detach().cpu().numpy()
iou_predictions_np = (
iou_predictions.squeeze(0).float().detach().cpu().numpy()
)
low_res_masks_np = low_res_masks.squeeze(0).float().detach().cpu().numpy()
all_masks.append(masks_np)
all_ious.append(iou_predictions_np)
all_low_res_masks.append(low_res_masks_np)
return all_masks, all_ious, all_low_res_masks
def predict(
self,
point_coords: Optional[np.ndarray] = None,
point_labels: Optional[np.ndarray] = None,
box: Optional[np.ndarray] = None,
mask_input: Optional[np.ndarray] = None,
multimask_output: bool = True,
return_logits: bool = False,
normalize_coords=True,
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Predict masks for the given input prompts, using the currently set image.
Arguments:
point_coords (np.ndarray or None): A Nx2 array of point prompts to the
model. Each point is in (X,Y) in pixels.
point_labels (np.ndarray or None): A length N array of labels for the
point prompts. 1 indicates a foreground point and 0 indicates a
background point.
box (np.ndarray or None): A length 4 array given a box prompt to the
model, in XYXY format.
mask_input (np.ndarray): A low resolution mask input to the model, typically
coming from a previous prediction iteration. Has form 1xHxW, where
for SAM, H=W=256.
multimask_output (bool): If true, the model will return three masks.
For ambiguous input prompts (such as a single click), this will often
produce better masks than a single prediction. If only a single
mask is needed, the model's predicted quality score can be used
to select the best mask. For non-ambiguous prompts, such as multiple
input prompts, multimask_output=False can give better results.
return_logits (bool): If true, returns un-thresholded masks logits
instead of a binary mask.
normalize_coords (bool): If true, the point coordinates will be normalized to the range [0,1] and point_coords is expected to be wrt. image dimensions.
Returns:
(np.ndarray): The output masks in CxHxW format, where C is the
number of masks, and (H, W) is the original image size.
(np.ndarray): An array of length C containing the model's
predictions for the quality of each mask.
(np.ndarray): An array of shape CxHxW, where C is the number
of masks and H=W=256. These low resolution logits can be passed to
a subsequent iteration as mask input.
"""
if not self._is_image_set:
raise RuntimeError(
"An image must be set with .set_image(...) before mask prediction."
)
# Transform input prompts
mask_input, unnorm_coords, labels, unnorm_box = self._prep_prompts(
point_coords, point_labels, box, mask_input, normalize_coords
)
masks, iou_predictions, low_res_masks = self._predict(
unnorm_coords,
labels,
unnorm_box,
mask_input,
multimask_output,
return_logits=return_logits,
)
masks_np = masks.squeeze(0).float().detach().cpu().numpy()
iou_predictions_np = iou_predictions.squeeze(0).float().detach().cpu().numpy()
low_res_masks_np = low_res_masks.squeeze(0).float().detach().cpu().numpy()
return masks_np, iou_predictions_np, low_res_masks_np
def _prep_prompts(
self, point_coords, point_labels, box, mask_logits, normalize_coords, img_idx=-1
):
unnorm_coords, labels, unnorm_box, mask_input = None, None, None, None
if point_coords is not None:
assert (
point_labels is not None
), "point_labels must be supplied if point_coords is supplied."
point_coords = torch.as_tensor(
point_coords, dtype=torch.float, device=self.device
)
unnorm_coords = self._transforms.transform_coords(
point_coords, normalize=normalize_coords, orig_hw=self._orig_hw[img_idx]
)
labels = torch.as_tensor(point_labels, dtype=torch.int, device=self.device)
if len(unnorm_coords.shape) == 2:
unnorm_coords, labels = unnorm_coords[None, ...], labels[None, ...]
if box is not None:
box = torch.as_tensor(box, dtype=torch.float, device=self.device)
unnorm_box = self._transforms.transf
gitextract_u3gvlex3/ ├── .gitignore ├── LICENSE ├── README.md ├── auto-seg/ │ ├── auto-mask-align.py │ ├── sam2/ │ │ ├── __init__.py │ │ ├── automatic_mask_generator.py │ │ ├── build_sam.py │ │ ├── csrc/ │ │ │ └── connected_components.cu │ │ ├── modeling/ │ │ │ ├── __init__.py │ │ │ ├── backbones/ │ │ │ │ ├── __init__.py │ │ │ │ ├── hieradet.py │ │ │ │ ├── image_encoder.py │ │ │ │ └── utils.py │ │ │ ├── memory_attention.py │ │ │ ├── memory_encoder.py │ │ │ ├── position_encoding.py │ │ │ ├── sam/ │ │ │ │ ├── __init__.py │ │ │ │ ├── mask_decoder.py │ │ │ │ ├── prompt_encoder.py │ │ │ │ └── transformer.py │ │ │ ├── sam2_base.py │ │ │ └── sam2_utils.py │ │ ├── sam2_image_predictor.py │ │ ├── sam2_video_predictor.py │ │ └── utils/ │ │ ├── __init__.py │ │ ├── amg.py │ │ ├── misc.py │ │ └── transforms.py │ ├── sam2_configs/ │ │ ├── __init__.py │ │ ├── sam2_hiera_b+.yaml │ │ ├── sam2_hiera_l.yaml │ │ ├── sam2_hiera_s.yaml │ │ └── sam2_hiera_t.yaml │ ├── sam2_hiera_l.yaml │ └── submodules/ │ ├── segment-anything-1/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── scripts/ │ │ │ ├── amg.py │ │ │ └── export_onnx_model.py │ │ ├── segment_anything/ │ │ │ ├── __init__.py │ │ │ ├── automatic_mask_generator.py │ │ │ ├── build_sam.py │ │ │ ├── modeling/ │ │ │ │ ├── __init__.py │ │ │ │ ├── common.py │ │ │ │ ├── image_encoder.py │ │ │ │ ├── mask_decoder.py │ │ │ │ ├── prompt_encoder.py │ │ │ │ ├── sam.py │ │ │ │ └── transformer.py │ │ │ ├── predictor.py │ │ │ └── utils/ │ │ │ ├── __init__.py │ │ │ ├── amg.py │ │ │ ├── onnx.py │ │ │ └── transforms.py │ │ ├── setup.cfg │ │ └── setup.py │ └── segment-anything-2/ │ ├── .clang-format │ ├── .gitignore │ ├── .watchmanconfig │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── INSTALL.md │ ├── LICENSE │ ├── LICENSE_cctorch │ ├── MANIFEST.in │ ├── README.md │ ├── backend.Dockerfile │ ├── checkpoints/ │ │ └── download_ckpts.sh │ ├── demo/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── backend/ │ │ │ └── server/ │ │ │ ├── app.py │ │ │ ├── app_conf.py │ │ │ └── inference/ │ │ │ ├── data_types.py │ │ │ ├── multipart.py │ │ │ └── predictor.py │ │ └── frontend/ │ │ ├── .babelrc │ │ ├── .dockerignore │ │ ├── .eslintignore │ │ ├── .eslintrc.cjs │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── .prettierrc.json │ │ ├── .watchmanconfig │ │ ├── frontend.Dockerfile │ │ ├── index.html │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── schema.graphql │ │ ├── schemas/ │ │ │ ├── inference-api-schema.graphql │ │ │ ├── merge-schemas.ts │ │ │ └── video-api-schema.graphql │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── assets/ │ │ │ │ └── scss/ │ │ │ │ └── App.scss │ │ │ ├── common/ │ │ │ │ ├── codecs/ │ │ │ │ │ ├── VideoDecoder.ts │ │ │ │ │ ├── VideoEncoder.ts │ │ │ │ │ └── WebCodecUtils.ts │ │ │ │ ├── components/ │ │ │ │ │ ├── MobileFirstClickBanner.tsx │ │ │ │ │ ├── Tooltip.tsx │ │ │ │ │ ├── annotations/ │ │ │ │ │ │ ├── AddObjectButton.tsx │ │ │ │ │ │ ├── ClearAllPointsInVideoButton.tsx │ │ │ │ │ │ ├── CloseSessionButton.tsx │ │ │ │ │ │ ├── FirstClickView.tsx │ │ │ │ │ │ ├── LimitNotice.tsx │ │ │ │ │ │ ├── MobileObjectsList.tsx │ │ │ │ │ │ ├── MobileObjectsToolbar.tsx │ │ │ │ │ │ ├── MobileObjectsToolbarHeader.tsx │ │ │ │ │ │ ├── ObjectActions.tsx │ │ │ │ │ │ ├── ObjectPlaceholder.tsx │ │ │ │ │ │ ├── ObjectThumbnail.tsx │ │ │ │ │ │ ├── ObjectUtils.ts │ │ │ │ │ │ ├── ObjectsToolbar.tsx │ │ │ │ │ │ ├── ObjectsToolbarBottomActions.tsx │ │ │ │ │ │ ├── ObjectsToolbarHeader.tsx │ │ │ │ │ │ ├── PointsToggle.tsx │ │ │ │ │ │ ├── PrimaryCTAButton.tsx │ │ │ │ │ │ ├── ToolbarObject.tsx │ │ │ │ │ │ ├── ToolbarObjectContainer.tsx │ │ │ │ │ │ ├── TrackletSwimlane.tsx │ │ │ │ │ │ ├── TrackletsAnnotation.tsx │ │ │ │ │ │ └── useTracklets.ts │ │ │ │ │ ├── button/ │ │ │ │ │ │ ├── GradientBorder.tsx │ │ │ │ │ │ ├── PlaybackButton.tsx │ │ │ │ │ │ ├── PrimaryCTAButton.tsx │ │ │ │ │ │ ├── ResponsiveButton.tsx │ │ │ │ │ │ └── TrackAndPlayButton.tsx │ │ │ │ │ ├── code/ │ │ │ │ │ │ └── InitializeLocalMonaco.ts │ │ │ │ │ ├── effects/ │ │ │ │ │ │ ├── BackgroundEffects.tsx │ │ │ │ │ │ ├── EffectVariantBadge.tsx │ │ │ │ │ │ ├── EffectsCarousel.tsx │ │ │ │ │ │ ├── EffectsCarouselShadow.tsx │ │ │ │ │ │ ├── EffectsToolbar.tsx │ │ │ │ │ │ ├── EffectsToolbarBottomActions.tsx │ │ │ │ │ │ ├── EffectsToolbarHeader.tsx │ │ │ │ │ │ ├── EffectsUtils.ts │ │ │ │ │ │ ├── HighlightEffects.tsx │ │ │ │ │ │ ├── MobileEffectsToolbar.tsx │ │ │ │ │ │ └── MoreFunEffects.tsx │ │ │ │ │ ├── gallery/ │ │ │ │ │ │ ├── ChangeVideoModal.tsx │ │ │ │ │ │ ├── DefaultVideoGalleryModalTrigger.tsx │ │ │ │ │ │ ├── DemoVideoGallery.tsx │ │ │ │ │ │ ├── DemoVideoGalleryModal.tsx │ │ │ │ │ │ ├── VideoGalleryUploadPhoto.tsx │ │ │ │ │ │ ├── VideoPhoto.tsx │ │ │ │ │ │ ├── __generated__/ │ │ │ │ │ │ │ ├── DemoVideoGalleryModalQuery.graphql.ts │ │ │ │ │ │ │ ├── DemoVideoGalleryQuery.graphql.ts │ │ │ │ │ │ │ └── useUploadVideoMutation.graphql.ts │ │ │ │ │ │ └── useUploadVideo.ts │ │ │ │ │ ├── icons/ │ │ │ │ │ │ └── GitHubIcon.tsx │ │ │ │ │ ├── options/ │ │ │ │ │ │ ├── DownloadOption.tsx │ │ │ │ │ │ ├── GalleryOption.tsx │ │ │ │ │ │ ├── MoreOptionsToolbar.tsx │ │ │ │ │ │ ├── MoreOptionsToolbarBottomActions.tsx │ │ │ │ │ │ ├── OptionButton.tsx │ │ │ │ │ │ ├── ShareSection.tsx │ │ │ │ │ │ ├── ShareUtils.ts │ │ │ │ │ │ ├── TryAnotherVideoSection.tsx │ │ │ │ │ │ ├── UploadOption.tsx │ │ │ │ │ │ ├── __generated__/ │ │ │ │ │ │ │ └── GetLinkOptionShareVideoMutation.graphql.ts │ │ │ │ │ │ └── useDownloadVideo.ts │ │ │ │ │ ├── session/ │ │ │ │ │ │ ├── RestartSessionButton.tsx │ │ │ │ │ │ ├── __generated__/ │ │ │ │ │ │ │ └── useCloseSessionBeforeUnloadMutation.graphql.ts │ │ │ │ │ │ ├── useCloseSessionBeforeUnload.ts │ │ │ │ │ │ └── useRestartSession.ts │ │ │ │ │ ├── snackbar/ │ │ │ │ │ │ ├── DemoMessagesSnackbarUtils.ts │ │ │ │ │ │ ├── MessagesSnackbar.tsx │ │ │ │ │ │ ├── snackbarAtoms.ts │ │ │ │ │ │ ├── useDemoMessagesSnackbar.ts │ │ │ │ │ │ ├── useExpireMessage.ts │ │ │ │ │ │ └── useMessagesSnackbar.ts │ │ │ │ │ ├── toolbar/ │ │ │ │ │ │ ├── DesktopToolbar.tsx │ │ │ │ │ │ ├── MobileToolbar.tsx │ │ │ │ │ │ ├── Toolbar.tsx │ │ │ │ │ │ ├── ToolbarActionIcon.tsx │ │ │ │ │ │ ├── ToolbarBottomActionsWrapper.tsx │ │ │ │ │ │ ├── ToolbarConfig.tsx │ │ │ │ │ │ ├── ToolbarHeaderWrapper.tsx │ │ │ │ │ │ ├── ToolbarProgressChip.tsx │ │ │ │ │ │ ├── ToolbarSection.tsx │ │ │ │ │ │ ├── useListenToStreamingState.ts │ │ │ │ │ │ └── useToolbarTabs.ts │ │ │ │ │ ├── useFunctionThrottle.tsx │ │ │ │ │ └── video/ │ │ │ │ │ ├── ChangeVideoModal.tsx │ │ │ │ │ ├── EventEmitter.ts │ │ │ │ │ ├── Video.tsx │ │ │ │ │ ├── VideoFilmstripWithPlayback.tsx │ │ │ │ │ ├── VideoLoadingOverlay.tsx │ │ │ │ │ ├── VideoWorker.ts │ │ │ │ │ ├── VideoWorkerBridge.ts │ │ │ │ │ ├── VideoWorkerContext.ts │ │ │ │ │ ├── VideoWorkerTypes.ts │ │ │ │ │ ├── editor/ │ │ │ │ │ │ ├── DemoVideoEditor.tsx │ │ │ │ │ │ ├── ImageUtils.ts │ │ │ │ │ │ ├── VideoEditor.tsx │ │ │ │ │ │ ├── VideoEditorUtils.ts │ │ │ │ │ │ ├── atoms.ts │ │ │ │ │ │ ├── useResetEditor.ts │ │ │ │ │ │ ├── useVideo.ts │ │ │ │ │ │ └── useVideoEffect.ts │ │ │ │ │ ├── effects/ │ │ │ │ │ │ ├── ArrowGLEffect.ts │ │ │ │ │ │ ├── BackgroundBlurEffect.ts │ │ │ │ │ │ ├── BackgroundTextEffect.ts │ │ │ │ │ │ ├── BaseGLEffect.ts │ │ │ │ │ │ ├── BurstGLEffect.ts │ │ │ │ │ │ ├── CutoutGLEffect.ts │ │ │ │ │ │ ├── DesaturateEffect.ts │ │ │ │ │ │ ├── Effect.ts │ │ │ │ │ │ ├── EffectUtils.ts │ │ │ │ │ │ ├── Effects.ts │ │ │ │ │ │ ├── EraseBackgroundEffect.ts │ │ │ │ │ │ ├── EraseForegroundEffect.ts │ │ │ │ │ │ ├── EraseForegroundGLEffect.ts │ │ │ │ │ │ ├── GradientEffect.ts │ │ │ │ │ │ ├── NoisyMaskEffect.ts │ │ │ │ │ │ ├── OriginalEffect.ts │ │ │ │ │ │ ├── OverlayEffect.ts │ │ │ │ │ │ ├── PixelateEffect.ts │ │ │ │ │ │ ├── PixelateMaskGLEffect.ts │ │ │ │ │ │ ├── ReplaceGLEffect.ts │ │ │ │ │ │ ├── ScopeGLEffect.ts │ │ │ │ │ │ ├── SobelEffect.ts │ │ │ │ │ │ ├── VibrantMaskEffect.ts │ │ │ │ │ │ └── shaders/ │ │ │ │ │ │ ├── Arrow.frag │ │ │ │ │ │ ├── BackgroundBlur.frag │ │ │ │ │ │ ├── Burst.frag │ │ │ │ │ │ ├── Cutout.frag │ │ │ │ │ │ ├── DefaultVert.vert │ │ │ │ │ │ ├── EraseForeground.frag │ │ │ │ │ │ ├── Gradient.frag │ │ │ │ │ │ ├── NoisyMask.frag │ │ │ │ │ │ ├── Overlay.frag │ │ │ │ │ │ ├── Overlay.vert │ │ │ │ │ │ ├── Pixelate.frag │ │ │ │ │ │ ├── PixelateMask.frag │ │ │ │ │ │ ├── Replace.frag │ │ │ │ │ │ ├── Scope.frag │ │ │ │ │ │ ├── Sobel.frag │ │ │ │ │ │ └── VibrantMask.frag │ │ │ │ │ ├── filmstrip/ │ │ │ │ │ │ ├── FilmstripUtil.tsx │ │ │ │ │ │ ├── SelectedFrameHelper.ts │ │ │ │ │ │ ├── VideoFilmstrip.tsx │ │ │ │ │ │ ├── atoms.ts │ │ │ │ │ │ ├── useDisableScrolling.ts │ │ │ │ │ │ └── useSelectedFrameHelper.ts │ │ │ │ │ ├── layers/ │ │ │ │ │ │ ├── InteractionLayer.tsx │ │ │ │ │ │ └── PointsLayer.tsx │ │ │ │ │ ├── useInputVideo.ts │ │ │ │ │ └── useVideoWorker.ts │ │ │ │ ├── error/ │ │ │ │ │ ├── ErrorFallback.tsx │ │ │ │ │ ├── ErrorReport.tsx │ │ │ │ │ ├── ErrorSerializationUtils.ts │ │ │ │ │ ├── ErrorUtils.ts │ │ │ │ │ ├── errorReportAtom.ts │ │ │ │ │ └── useReportError.tsx │ │ │ │ ├── loading/ │ │ │ │ │ ├── LoadingMessage.tsx │ │ │ │ │ ├── LoadingStateScreen.tsx │ │ │ │ │ ├── StaticVideoPlayer.tsx │ │ │ │ │ └── UploadLoadingScreen.tsx │ │ │ │ ├── logger/ │ │ │ │ │ ├── DemoLogger.ts │ │ │ │ │ ├── LogEnvironment.ts │ │ │ │ │ └── Logger.ts │ │ │ │ ├── screen/ │ │ │ │ │ └── useScreenSize.tsx │ │ │ │ ├── tracker/ │ │ │ │ │ ├── SAM2Model.ts │ │ │ │ │ ├── Tracker.ts │ │ │ │ │ ├── TrackerTypes.ts │ │ │ │ │ ├── Trackers.ts │ │ │ │ │ └── __generated__/ │ │ │ │ │ ├── SAM2ModelAddNewPointsMutation.graphql.ts │ │ │ │ │ ├── SAM2ModelCancelPropagateInVideoMutation.graphql.ts │ │ │ │ │ ├── SAM2ModelClearPointsInFrameMutation.graphql.ts │ │ │ │ │ ├── SAM2ModelClearPointsInVideoMutation.graphql.ts │ │ │ │ │ ├── SAM2ModelCloseSessionMutation.graphql.ts │ │ │ │ │ ├── SAM2ModelRemoveObjectMutation.graphql.ts │ │ │ │ │ └── SAM2ModelStartSessionMutation.graphql.ts │ │ │ │ └── utils/ │ │ │ │ ├── FileUtils.ts │ │ │ │ ├── ImageUtils.ts │ │ │ │ ├── MaskUtils.ts │ │ │ │ ├── MultipartStream.ts │ │ │ │ ├── ShaderUtils.ts │ │ │ │ ├── emptyFunction.ts │ │ │ │ └── uuid.ts │ │ │ ├── debug/ │ │ │ │ └── stats/ │ │ │ │ ├── Stats.ts │ │ │ │ └── StatsView.tsx │ │ │ ├── demo/ │ │ │ │ ├── DemoConfig.tsx │ │ │ │ ├── DemoErrorFallback.tsx │ │ │ │ ├── DemoSuspenseFallback.tsx │ │ │ │ ├── SAM2DemoApp.tsx │ │ │ │ └── atoms.ts │ │ │ ├── graphql/ │ │ │ │ ├── RelayEnvironment.ts │ │ │ │ ├── RelayEnvironmentProvider.tsx │ │ │ │ ├── errors/ │ │ │ │ │ ├── CreateFilmstripError.ts │ │ │ │ │ ├── DrawFrameError.ts │ │ │ │ │ └── WebGLContextError.ts │ │ │ │ └── fetchGraphQL.ts │ │ │ ├── jscocotools/ │ │ │ │ └── mask.ts │ │ │ ├── layouts/ │ │ │ │ ├── DemoPageLayout.tsx │ │ │ │ └── RootLayout.tsx │ │ │ ├── routes/ │ │ │ │ ├── DemoPage.tsx │ │ │ │ ├── DemoPageWrapper.tsx │ │ │ │ ├── PageNotFoundPage.tsx │ │ │ │ └── __generated__/ │ │ │ │ └── DemoPageQuery.graphql.ts │ │ │ ├── settings/ │ │ │ │ ├── ApprovableInput.tsx │ │ │ │ ├── SAM2Settings.tsx │ │ │ │ ├── SettingsContextProvider.tsx │ │ │ │ ├── SettingsModal.tsx │ │ │ │ ├── SettingsReducer.ts │ │ │ │ └── useSettingsContext.tsx │ │ │ ├── theme/ │ │ │ │ ├── colors.ts │ │ │ │ ├── gradientStyle.ts │ │ │ │ └── tokens.stylex.ts │ │ │ ├── types/ │ │ │ │ └── mp4box/ │ │ │ │ └── index.d.ts │ │ │ └── vite-env.d.ts │ │ ├── tailwind.config.js │ │ ├── tsconfig.json │ │ ├── tsconfig.node.json │ │ └── vite.config.ts │ ├── docker-compose.yaml │ ├── pyproject.toml │ ├── sam2/ │ │ ├── __init__.py │ │ ├── automatic_mask_generator.py │ │ ├── build_sam.py │ │ ├── configs/ │ │ │ ├── sam2/ │ │ │ │ ├── sam2_hiera_b+.yaml │ │ │ │ ├── sam2_hiera_l.yaml │ │ │ │ ├── sam2_hiera_s.yaml │ │ │ │ └── sam2_hiera_t.yaml │ │ │ ├── sam2.1/ │ │ │ │ ├── sam2.1_hiera_b+.yaml │ │ │ │ ├── sam2.1_hiera_l.yaml │ │ │ │ ├── sam2.1_hiera_s.yaml │ │ │ │ └── sam2.1_hiera_t.yaml │ │ │ └── sam2.1_training/ │ │ │ └── sam2.1_hiera_b+_MOSE_finetune.yaml │ │ ├── csrc/ │ │ │ └── connected_components.cu │ │ ├── modeling/ │ │ │ ├── __init__.py │ │ │ ├── backbones/ │ │ │ │ ├── __init__.py │ │ │ │ ├── hieradet.py │ │ │ │ ├── image_encoder.py │ │ │ │ └── utils.py │ │ │ ├── memory_attention.py │ │ │ ├── memory_encoder.py │ │ │ ├── position_encoding.py │ │ │ ├── sam/ │ │ │ │ ├── __init__.py │ │ │ │ ├── mask_decoder.py │ │ │ │ ├── prompt_encoder.py │ │ │ │ └── transformer.py │ │ │ ├── sam2_base.py │ │ │ └── sam2_utils.py │ │ ├── sam2_image_predictor.py │ │ ├── sam2_video_predictor.py │ │ ├── sam2_video_predictor_legacy.py │ │ └── utils/ │ │ ├── __init__.py │ │ ├── amg.py │ │ ├── misc.py │ │ └── transforms.py │ ├── sav_dataset/ │ │ ├── LICENSE │ │ ├── LICENSE_DAVIS │ │ ├── LICENSE_VOS_BENCHMARK │ │ ├── README.md │ │ ├── example/ │ │ │ ├── sav_000001_auto.json │ │ │ └── sav_000001_manual.json │ │ ├── requirements.txt │ │ ├── sav_evaluator.py │ │ ├── sav_visualization_example.ipynb │ │ └── utils/ │ │ └── sav_utils.py │ ├── setup.py │ ├── tools/ │ │ ├── README.md │ │ └── vos_inference.py │ └── training/ │ ├── README.md │ ├── __init__.py │ ├── assets/ │ │ ├── MOSE_sample_train_list.txt │ │ └── MOSE_sample_val_list.txt │ ├── dataset/ │ │ ├── __init__.py │ │ ├── sam2_datasets.py │ │ ├── transforms.py │ │ ├── utils.py │ │ ├── vos_dataset.py │ │ ├── vos_raw_dataset.py │ │ ├── vos_sampler.py │ │ └── vos_segment_loader.py │ ├── loss_fns.py │ ├── model/ │ │ └── __init__.py │ ├── optimizer.py │ ├── scripts/ │ │ └── sav_frame_extraction_submitit.py │ ├── train.py │ ├── trainer.py │ └── utils/ │ ├── __init__.py │ ├── checkpoint_utils.py │ ├── data_utils.py │ ├── distributed.py │ ├── logger.py │ └── train_utils.py ├── cogvideox_interpolation/ │ ├── datasets.py │ ├── losses.py │ ├── lpips.py │ ├── pipeline.py │ └── utils/ │ ├── colormaps.py │ ├── colors.py │ ├── config_utils.py │ └── misc.py ├── configs/ │ ├── field_construction.yaml │ ├── test_config.py │ ├── unet_config_c16.py │ └── unet_config_c32.py ├── entry_point.py ├── field_construction/ │ ├── auto_encoder.py │ ├── extract_with_openseg.py │ ├── gaussian_field.py │ ├── gaussian_renderer/ │ │ ├── __init__.py │ │ └── network_gui.py │ ├── lpipsPyTorch/ │ │ ├── __init__.py │ │ └── modules/ │ │ ├── lpips.py │ │ ├── networks.py │ │ └── utils.py │ ├── pipeline.py │ ├── pose_estimator/ │ │ ├── __init__.py │ │ └── utils.py │ ├── preprocessor.py │ ├── scene/ │ │ ├── __init__.py │ │ ├── app_model.py │ │ ├── cameras.py │ │ ├── colmap_loader.py │ │ ├── dataset_readers.py │ │ ├── gaussian_model.py │ │ └── per_point_adam.py │ ├── submodules/ │ │ ├── diff-langsurf-rasterizer/ │ │ │ ├── CMakeLists.txt │ │ │ ├── LICENSE.md │ │ │ ├── README.md │ │ │ ├── build/ │ │ │ │ └── temp.linux-x86_64-cpython-310/ │ │ │ │ ├── .ninja_deps │ │ │ │ ├── .ninja_log │ │ │ │ ├── build.ninja │ │ │ │ ├── cuda_rasterizer/ │ │ │ │ │ ├── backward.o │ │ │ │ │ ├── forward.o │ │ │ │ │ └── rasterizer_impl.o │ │ │ │ ├── ext.o │ │ │ │ └── rasterize_points.o │ │ │ ├── cuda_rasterizer/ │ │ │ │ ├── auxiliary.h │ │ │ │ ├── backward.cu │ │ │ │ ├── backward.h │ │ │ │ ├── config.h │ │ │ │ ├── forward.cu │ │ │ │ ├── forward.h │ │ │ │ ├── rasterizer.h │ │ │ │ ├── rasterizer_impl.cu │ │ │ │ └── rasterizer_impl.h │ │ │ ├── diff_LangSurf_rasterization/ │ │ │ │ └── __init__.py │ │ │ ├── diff_LangSurf_rasterization.egg-info/ │ │ │ │ ├── PKG-INFO │ │ │ │ ├── SOURCES.txt │ │ │ │ ├── dependency_links.txt │ │ │ │ └── top_level.txt │ │ │ ├── ext.cpp │ │ │ ├── rasterize_points.cu │ │ │ ├── rasterize_points.h │ │ │ ├── setup.py │ │ │ └── third_party/ │ │ │ ├── glm/ │ │ │ │ ├── .appveyor.yml │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── cmake/ │ │ │ │ │ └── cmake_uninstall.cmake.in │ │ │ │ ├── copying.txt │ │ │ │ ├── doc/ │ │ │ │ │ ├── api/ │ │ │ │ │ │ ├── a00001_source.html │ │ │ │ │ │ ├── a00002_source.html │ │ │ │ │ │ ├── a00003_source.html │ │ │ │ │ │ ├── a00004_source.html │ │ │ │ │ │ ├── a00005_source.html │ │ │ │ │ │ ├── a00006_source.html │ │ │ │ │ │ ├── a00007.html │ │ │ │ │ │ ├── a00007_source.html │ │ │ │ │ │ ├── a00008.html │ │ │ │ │ │ ├── a00008_source.html │ │ │ │ │ │ ├── a00009.html │ │ │ │ │ │ ├── a00009_source.html │ │ │ │ │ │ ├── a00010.html │ │ │ │ │ │ ├── a00010_source.html │ │ │ │ │ │ ├── a00011.html │ │ │ │ │ │ ├── a00011_source.html │ │ │ │ │ │ ├── a00012.html │ │ │ │ │ │ ├── a00012_source.html │ │ │ │ │ │ ├── a00013.html │ │ │ │ │ │ ├── a00013_source.html │ │ │ │ │ │ ├── a00014.html │ │ │ │ │ │ ├── a00014_source.html │ │ │ │ │ │ ├── a00015.html │ │ │ │ │ │ ├── a00015_source.html │ │ │ │ │ │ ├── a00016.html │ │ │ │ │ │ ├── a00016_source.html │ │ │ │ │ │ ├── a00017.html │ │ │ │ │ │ ├── a00017_source.html │ │ │ │ │ │ ├── a00018.html │ │ │ │ │ │ ├── a00018_source.html │ │ │ │ │ │ ├── a00019_source.html │ │ │ │ │ │ ├── a00020_source.html │ │ │ │ │ │ ├── a00021.html │ │ │ │ │ │ ├── a00021_source.html │ │ │ │ │ │ ├── a00022.html │ │ │ │ │ │ ├── a00022_source.html │ │ │ │ │ │ ├── a00023.html │ │ │ │ │ │ ├── a00023_source.html │ │ │ │ │ │ ├── a00024.html │ │ │ │ │ │ ├── a00024_source.html │ │ │ │ │ │ ├── a00025.html │ │ │ │ │ │ ├── a00025_source.html │ │ │ │ │ │ ├── a00026.html │ │ │ │ │ │ ├── a00026_source.html │ │ │ │ │ │ ├── a00027.html │ │ │ │ │ │ ├── a00027_source.html │ │ │ │ │ │ ├── a00028.html │ │ │ │ │ │ ├── a00028_source.html │ │ │ │ │ │ ├── a00029.html │ │ │ │ │ │ ├── a00029_source.html │ │ │ │ │ │ ├── a00030.html │ │ │ │ │ │ ├── a00030_source.html │ │ │ │ │ │ ├── a00031.html │ │ │ │ │ │ ├── a00031_source.html │ │ │ │ │ │ ├── a00032.html │ │ │ │ │ │ ├── a00032_source.html │ │ │ │ │ │ ├── a00033.html │ │ │ │ │ │ ├── a00033_source.html │ │ │ │ │ │ ├── a00034.html │ │ │ │ │ │ ├── a00034_source.html │ │ │ │ │ │ ├── a00035_source.html │ │ │ │ │ │ ├── a00036.html │ │ │ │ │ │ ├── a00036_source.html │ │ │ │ │ │ ├── a00037.html │ │ │ │ │ │ ├── a00037_source.html │ │ │ │ │ │ ├── a00038.html │ │ │ │ │ │ ├── a00038_source.html │ │ │ │ │ │ ├── a00039.html │ │ │ │ │ │ ├── a00039_source.html │ │ │ │ │ │ ├── a00040.html │ │ │ │ │ │ ├── a00040_source.html │ │ │ │ │ │ ├── a00041.html │ │ │ │ │ │ ├── a00041_source.html │ │ │ │ │ │ ├── a00042.html │ │ │ │ │ │ ├── a00042_source.html │ │ │ │ │ │ ├── a00043.html │ │ │ │ │ │ ├── a00043_source.html │ │ │ │ │ │ ├── a00044.html │ │ │ │ │ │ ├── a00044_source.html │ │ │ │ │ │ ├── a00045.html │ │ │ │ │ │ ├── a00045_source.html │ │ │ │ │ │ ├── a00046.html │ │ │ │ │ │ ├── a00046_source.html │ │ │ │ │ │ ├── a00047_source.html │ │ │ │ │ │ ├── a00048.html │ │ │ │ │ │ ├── a00048_source.html │ │ │ │ │ │ ├── a00049.html │ │ │ │ │ │ ├── a00049_source.html │ │ │ │ │ │ ├── a00050.html │ │ │ │ │ │ ├── a00050_source.html │ │ │ │ │ │ ├── a00051.html │ │ │ │ │ │ ├── a00051_source.html │ │ │ │ │ │ ├── a00052.html │ │ │ │ │ │ ├── a00052_source.html │ │ │ │ │ │ ├── a00053.html │ │ │ │ │ │ ├── a00053_source.html │ │ │ │ │ │ ├── a00054.html │ │ │ │ │ │ ├── a00054_source.html │ │ │ │ │ │ ├── a00055.html │ │ │ │ │ │ ├── a00055_source.html │ │ │ │ │ │ ├── a00056.html │ │ │ │ │ │ ├── a00056_source.html │ │ │ │ │ │ ├── a00057.html │ │ │ │ │ │ ├── a00057_source.html │ │ │ │ │ │ ├── a00058.html │ │ │ │ │ │ ├── a00058_source.html │ │ │ │ │ │ ├── a00059.html │ │ │ │ │ │ ├── a00059_source.html │ │ │ │ │ │ ├── a00060.html │ │ │ │ │ │ ├── a00060_source.html │ │ │ │ │ │ ├── a00061.html │ │ │ │ │ │ ├── a00061_source.html │ │ │ │ │ │ ├── a00062.html │ │ │ │ │ │ ├── a00062_source.html │ │ │ │ │ │ ├── a00063.html │ │ │ │ │ │ ├── a00063_source.html │ │ │ │ │ │ ├── a00064.html │ │ │ │ │ │ ├── a00064_source.html │ │ │ │ │ │ ├── a00065.html │ │ │ │ │ │ ├── a00065_source.html │ │ │ │ │ │ ├── a00066.html │ │ │ │ │ │ ├── a00066_source.html │ │ │ │ │ │ ├── a00067.html │ │ │ │ │ │ ├── a00067_source.html │ │ │ │ │ │ ├── a00068.html │ │ │ │ │ │ ├── a00068_source.html │ │ │ │ │ │ ├── a00069.html │ │ │ │ │ │ ├── a00069_source.html │ │ │ │ │ │ ├── a00070.html │ │ │ │ │ │ ├── a00070_source.html │ │ │ │ │ │ ├── a00071.html │ │ │ │ │ │ ├── a00071_source.html │ │ │ │ │ │ ├── a00072.html │ │ │ │ │ │ ├── a00072_source.html │ │ │ │ │ │ ├── a00073.html │ │ │ │ │ │ ├── a00073_source.html │ │ │ │ │ │ ├── a00074.html │ │ │ │ │ │ ├── a00074_source.html │ │ │ │ │ │ ├── a00075.html │ │ │ │ │ │ ├── a00075_source.html │ │ │ │ │ │ ├── a00076.html │ │ │ │ │ │ ├── a00076_source.html │ │ │ │ │ │ ├── a00077.html │ │ │ │ │ │ ├── a00077_source.html │ │ │ │ │ │ ├── a00078.html │ │ │ │ │ │ ├── a00078_source.html │ │ │ │ │ │ ├── a00079.html │ │ │ │ │ │ ├── a00079_source.html │ │ │ │ │ │ ├── a00080.html │ │ │ │ │ │ ├── a00080_source.html │ │ │ │ │ │ ├── a00081.html │ │ │ │ │ │ ├── a00081_source.html │ │ │ │ │ │ ├── a00082.html │ │ │ │ │ │ ├── a00082_source.html │ │ │ │ │ │ ├── a00083.html │ │ │ │ │ │ ├── a00083_source.html │ │ │ │ │ │ ├── a00084.html │ │ │ │ │ │ ├── a00084_source.html │ │ │ │ │ │ ├── a00085.html │ │ │ │ │ │ ├── a00085_source.html │ │ │ │ │ │ ├── a00086.html │ │ │ │ │ │ ├── a00086_source.html │ │ │ │ │ │ ├── a00087.html │ │ │ │ │ │ ├── a00087_source.html │ │ │ │ │ │ ├── a00088.html │ │ │ │ │ │ ├── a00088_source.html │ │ │ │ │ │ ├── a00089.html │ │ │ │ │ │ ├── a00089_source.html │ │ │ │ │ │ ├── a00090.html │ │ │ │ │ │ ├── a00090_source.html │ │ │ │ │ │ ├── a00091.html │ │ │ │ │ │ ├── a00091_source.html │ │ │ │ │ │ ├── a00092.html │ │ │ │ │ │ ├── a00092_source.html │ │ │ │ │ │ ├── a00093.html │ │ │ │ │ │ ├── a00093_source.html │ │ │ │ │ │ ├── a00094.html │ │ │ │ │ │ ├── a00094_source.html │ │ │ │ │ │ ├── a00095_source.html │ │ │ │ │ │ ├── a00096.html │ │ │ │ │ │ ├── a00096_source.html │ │ │ │ │ │ ├── a00097.html │ │ │ │ │ │ ├── a00097_source.html │ │ │ │ │ │ ├── a00098.html │ │ │ │ │ │ ├── a00098_source.html │ │ │ │ │ │ ├── a00099.html │ │ │ │ │ │ ├── a00099_source.html │ │ │ │ │ │ ├── a00100.html │ │ │ │ │ │ ├── a00100_source.html │ │ │ │ │ │ ├── a00101.html │ │ │ │ │ │ ├── a00101_source.html │ │ │ │ │ │ ├── a00102.html │ │ │ │ │ │ ├── a00102_source.html │ │ │ │ │ │ ├── a00103.html │ │ │ │ │ │ ├── a00103_source.html │ │ │ │ │ │ ├── a00104.html │ │ │ │ │ │ ├── a00104_source.html │ │ │ │ │ │ ├── a00105.html │ │ │ │ │ │ ├── a00105_source.html │ │ │ │ │ │ ├── a00106.html │ │ │ │ │ │ ├── a00106_source.html │ │ │ │ │ │ ├── a00107.html │ │ │ │ │ │ ├── a00107_source.html │ │ │ │ │ │ ├── a00108.html │ │ │ │ │ │ ├── a00108_source.html │ │ │ │ │ │ ├── a00109.html │ │ │ │ │ │ ├── a00109_source.html │ │ │ │ │ │ ├── a00110.html │ │ │ │ │ │ ├── a00110_source.html │ │ │ │ │ │ ├── a00111.html │ │ │ │ │ │ ├── a00111_source.html │ │ │ │ │ │ ├── a00112.html │ │ │ │ │ │ ├── a00112_source.html │ │ │ │ │ │ ├── a00113.html │ │ │ │ │ │ ├── a00113_source.html │ │ │ │ │ │ ├── a00114.html │ │ │ │ │ │ ├── a00114_source.html │ │ │ │ │ │ ├── a00115.html │ │ │ │ │ │ ├── a00115_source.html │ │ │ │ │ │ ├── a00116.html │ │ │ │ │ │ ├── a00116_source.html │ │ │ │ │ │ ├── a00117.html │ │ │ │ │ │ ├── a00117_source.html │ │ │ │ │ │ ├── a00118.html │ │ │ │ │ │ ├── a00118_source.html │ │ │ │ │ │ ├── a00119.html │ │ │ │ │ │ ├── a00119_source.html │ │ │ │ │ │ ├── a00120.html │ │ │ │ │ │ ├── a00120_source.html │ │ │ │ │ │ ├── a00121.html │ │ │ │ │ │ ├── a00121_source.html │ │ │ │ │ │ ├── a00122.html │ │ │ │ │ │ ├── a00122_source.html │ │ │ │ │ │ ├── a00123.html │ │ │ │ │ │ ├── a00123_source.html │ │ │ │ │ │ ├── a00124_source.html │ │ │ │ │ │ ├── a00125.html │ │ │ │ │ │ ├── a00125_source.html │ │ │ │ │ │ ├── a00126.html │ │ │ │ │ │ ├── a00126_source.html │ │ │ │ │ │ ├── a00127.html │ │ │ │ │ │ ├── a00127_source.html │ │ │ │ │ │ ├── a00128.html │ │ │ │ │ │ ├── a00128_source.html │ │ │ │ │ │ ├── a00129.html │ │ │ │ │ │ ├── a00129_source.html │ │ │ │ │ │ ├── a00130.html │ │ │ │ │ │ ├── a00130_source.html │ │ │ │ │ │ ├── a00131.html │ │ │ │ │ │ ├── a00131_source.html │ │ │ │ │ │ ├── a00132.html │ │ │ │ │ │ ├── a00132_source.html │ │ │ │ │ │ ├── a00133.html │ │ │ │ │ │ ├── a00133_source.html │ │ │ │ │ │ ├── a00134.html │ │ │ │ │ │ ├── a00134_source.html │ │ │ │ │ │ ├── a00135.html │ │ │ │ │ │ ├── a00135_source.html │ │ │ │ │ │ ├── a00136.html │ │ │ │ │ │ ├── a00136_source.html │ │ │ │ │ │ ├── a00137.html │ │ │ │ │ │ ├── a00137_source.html │ │ │ │ │ │ ├── a00138.html │ │ │ │ │ │ ├── a00138_source.html │ │ │ │ │ │ ├── a00139.html │ │ │ │ │ │ ├── a00139_source.html │ │ │ │ │ │ ├── a00140.html │ │ │ │ │ │ ├── a00140_source.html │ │ │ │ │ │ ├── a00141.html │ │ │ │ │ │ ├── a00141_source.html │ │ │ │ │ │ ├── a00142.html │ │ │ │ │ │ ├── a00142_source.html │ │ │ │ │ │ ├── a00143.html │ │ │ │ │ │ ├── a00143_source.html │ │ │ │ │ │ ├── a00144.html │ │ │ │ │ │ ├── a00144_source.html │ │ │ │ │ │ ├── a00145.html │ │ │ │ │ │ ├── a00145_source.html │ │ │ │ │ │ ├── a00146.html │ │ │ │ │ │ ├── a00146_source.html │ │ │ │ │ │ ├── a00147.html │ │ │ │ │ │ ├── a00147_source.html │ │ │ │ │ │ ├── a00148.html │ │ │ │ │ │ ├── a00148_source.html │ │ │ │ │ │ ├── a00149.html │ │ │ │ │ │ ├── a00149_source.html │ │ │ │ │ │ ├── a00150.html │ │ │ │ │ │ ├── a00150_source.html │ │ │ │ │ │ ├── a00151.html │ │ │ │ │ │ ├── a00151_source.html │ │ │ │ │ │ ├── a00152.html │ │ │ │ │ │ ├── a00152_source.html │ │ │ │ │ │ ├── a00153_source.html │ │ │ │ │ │ ├── a00154.html │ │ │ │ │ │ ├── a00154_source.html │ │ │ │ │ │ ├── a00155.html │ │ │ │ │ │ ├── a00155_source.html │ │ │ │ │ │ ├── a00156.html │ │ │ │ │ │ ├── a00156_source.html │ │ │ │ │ │ ├── a00157.html │ │ │ │ │ │ ├── a00157_source.html │ │ │ │ │ │ ├── a00158.html │ │ │ │ │ │ ├── a00158_source.html │ │ │ │ │ │ ├── a00159.html │ │ │ │ │ │ ├── a00159_source.html │ │ │ │ │ │ ├── a00160.html │ │ │ │ │ │ ├── a00160_source.html │ │ │ │ │ │ ├── a00161.html │ │ │ │ │ │ ├── a00161_source.html │ │ │ │ │ │ ├── a00162.html │ │ │ │ │ │ ├── a00162_source.html │ │ │ │ │ │ ├── a00163_source.html │ │ │ │ │ │ ├── a00164_source.html │ │ │ │ │ │ ├── a00165.html │ │ │ │ │ │ ├── a00165_source.html │ │ │ │ │ │ ├── a00166.html │ │ │ │ │ │ ├── a00166_source.html │ │ │ │ │ │ ├── a00167.html │ │ │ │ │ │ ├── a00167_source.html │ │ │ │ │ │ ├── a00168.html │ │ │ │ │ │ ├── a00168_source.html │ │ │ │ │ │ ├── a00169.html │ │ │ │ │ │ ├── a00169_source.html │ │ │ │ │ │ ├── a00170.html │ │ │ │ │ │ ├── a00170_source.html │ │ │ │ │ │ ├── a00171.html │ │ │ │ │ │ ├── a00171_source.html │ │ │ │ │ │ ├── a00172.html │ │ │ │ │ │ ├── a00172_source.html │ │ │ │ │ │ ├── a00173.html │ │ │ │ │ │ ├── a00173_source.html │ │ │ │ │ │ ├── a00174.html │ │ │ │ │ │ ├── a00174_source.html │ │ │ │ │ │ ├── a00175.html │ │ │ │ │ │ ├── a00175_source.html │ │ │ │ │ │ ├── a00176.html │ │ │ │ │ │ ├── a00176_source.html │ │ │ │ │ │ ├── a00177.html │ │ │ │ │ │ ├── a00177_source.html │ │ │ │ │ │ ├── a00178.html │ │ │ │ │ │ ├── a00178_source.html │ │ │ │ │ │ ├── a00179.html │ │ │ │ │ │ ├── a00179_source.html │ │ │ │ │ │ ├── a00180.html │ │ │ │ │ │ ├── a00180_source.html │ │ │ │ │ │ ├── a00181.html │ │ │ │ │ │ ├── a00181_source.html │ │ │ │ │ │ ├── a00182.html │ │ │ │ │ │ ├── a00182_source.html │ │ │ │ │ │ ├── a00183.html │ │ │ │ │ │ ├── a00183_source.html │ │ │ │ │ │ ├── a00184.html │ │ │ │ │ │ ├── a00184_source.html │ │ │ │ │ │ ├── a00185.html │ │ │ │ │ │ ├── a00185_source.html │ │ │ │ │ │ ├── a00186.html │ │ │ │ │ │ ├── a00186_source.html │ │ │ │ │ │ ├── a00187.html │ │ │ │ │ │ ├── a00187_source.html │ │ │ │ │ │ ├── a00188.html │ │ │ │ │ │ ├── a00188_source.html │ │ │ │ │ │ ├── a00189.html │ │ │ │ │ │ ├── a00189_source.html │ │ │ │ │ │ ├── a00190.html │ │ │ │ │ │ ├── a00190_source.html │ │ │ │ │ │ ├── a00191.html │ │ │ │ │ │ ├── a00191_source.html │ │ │ │ │ │ ├── a00192.html │ │ │ │ │ │ ├── a00192_source.html │ │ │ │ │ │ ├── a00193.html │ │ │ │ │ │ ├── a00193_source.html │ │ │ │ │ │ ├── a00194.html │ │ │ │ │ │ ├── a00194_source.html │ │ │ │ │ │ ├── a00195.html │ │ │ │ │ │ ├── a00195_source.html │ │ │ │ │ │ ├── a00196.html │ │ │ │ │ │ ├── a00196_source.html │ │ │ │ │ │ ├── a00197.html │ │ │ │ │ │ ├── a00197_source.html │ │ │ │ │ │ ├── a00198.html │ │ │ │ │ │ ├── a00198_source.html │ │ │ │ │ │ ├── a00199.html │ │ │ │ │ │ ├── a00199_source.html │ │ │ │ │ │ ├── a00200.html │ │ │ │ │ │ ├── a00200_source.html │ │ │ │ │ │ ├── a00201.html │ │ │ │ │ │ ├── a00201_source.html │ │ │ │ │ │ ├── a00202.html │ │ │ │ │ │ ├── a00202_source.html │ │ │ │ │ │ ├── a00203.html │ │ │ │ │ │ ├── a00203_source.html │ │ │ │ │ │ ├── a00204.html │ │ │ │ │ │ ├── a00204_source.html │ │ │ │ │ │ ├── a00205.html │ │ │ │ │ │ ├── a00205_source.html │ │ │ │ │ │ ├── a00206.html │ │ │ │ │ │ ├── a00206_source.html │ │ │ │ │ │ ├── a00207.html │ │ │ │ │ │ ├── a00207_source.html │ │ │ │ │ │ ├── a00208.html │ │ │ │ │ │ ├── a00208_source.html │ │ │ │ │ │ ├── a00209.html │ │ │ │ │ │ ├── a00209_source.html │ │ │ │ │ │ ├── a00210.html │ │ │ │ │ │ ├── a00210_source.html │ │ │ │ │ │ ├── a00211.html │ │ │ │ │ │ ├── a00211_source.html │ │ │ │ │ │ ├── a00212.html │ │ │ │ │ │ ├── a00212_source.html │ │ │ │ │ │ ├── a00213.html │ │ │ │ │ │ ├── a00213_source.html │ │ │ │ │ │ ├── a00214.html │ │ │ │ │ │ ├── a00214_source.html │ │ │ │ │ │ ├── a00215.html │ │ │ │ │ │ ├── a00215_source.html │ │ │ │ │ │ ├── a00216.html │ │ │ │ │ │ ├── a00216_source.html │ │ │ │ │ │ ├── a00217.html │ │ │ │ │ │ ├── a00217_source.html │ │ │ │ │ │ ├── a00218.html │ │ │ │ │ │ ├── a00218_source.html │ │ │ │ │ │ ├── a00219.html │ │ │ │ │ │ ├── a00219_source.html │ │ │ │ │ │ ├── a00220.html │ │ │ │ │ │ ├── a00220_source.html │ │ │ │ │ │ ├── a00221.html │ │ │ │ │ │ ├── a00221_source.html │ │ │ │ │ │ ├── a00222.html │ │ │ │ │ │ ├── a00222_source.html │ │ │ │ │ │ ├── a00223.html │ │ │ │ │ │ ├── a00223_source.html │ │ │ │ │ │ ├── a00224.html │ │ │ │ │ │ ├── a00224_source.html │ │ │ │ │ │ ├── a00225.html │ │ │ │ │ │ ├── a00225_source.html │ │ │ │ │ │ ├── a00226.html │ │ │ │ │ │ ├── a00226_source.html │ │ │ │ │ │ ├── a00227.html │ │ │ │ │ │ ├── a00227_source.html │ │ │ │ │ │ ├── a00228.html │ │ │ │ │ │ ├── a00228_source.html │ │ │ │ │ │ ├── a00229.html │ │ │ │ │ │ ├── a00229_source.html │ │ │ │ │ │ ├── a00230.html │ │ │ │ │ │ ├── a00230_source.html │ │ │ │ │ │ ├── a00231.html │ │ │ │ │ │ ├── a00231_source.html │ │ │ │ │ │ ├── a00232.html │ │ │ │ │ │ ├── a00232_source.html │ │ │ │ │ │ ├── a00233.html │ │ │ │ │ │ ├── a00233_source.html │ │ │ │ │ │ ├── a00234.html │ │ │ │ │ │ ├── a00234_source.html │ │ │ │ │ │ ├── a00235.html │ │ │ │ │ │ ├── a00235_source.html │ │ │ │ │ │ ├── a00241.html │ │ │ │ │ │ ├── a00242.html │ │ │ │ │ │ ├── a00243.html │ │ │ │ │ │ ├── a00244.html │ │ │ │ │ │ ├── a00245.html │ │ │ │ │ │ ├── a00246.html │ │ │ │ │ │ ├── a00247.html │ │ │ │ │ │ ├── a00248.html │ │ │ │ │ │ ├── a00249.html │ │ │ │ │ │ ├── a00250.html │ │ │ │ │ │ ├── a00251.html │ │ │ │ │ │ ├── a00252.html │ │ │ │ │ │ ├── a00253.html │ │ │ │ │ │ ├── a00254.html │ │ │ │ │ │ ├── a00255.html │ │ │ │ │ │ ├── a00256.html │ │ │ │ │ │ ├── a00257.html │ │ │ │ │ │ ├── a00258.html │ │ │ │ │ │ ├── a00259.html │ │ │ │ │ │ ├── a00260.html │ │ │ │ │ │ ├── a00261.html │ │ │ │ │ │ ├── a00262.html │ │ │ │ │ │ ├── a00263.html │ │ │ │ │ │ ├── a00264.html │ │ │ │ │ │ ├── a00265.html │ │ │ │ │ │ ├── a00266.html │ │ │ │ │ │ ├── a00267.html │ │ │ │ │ │ ├── a00268.html │ │ │ │ │ │ ├── a00269.html │ │ │ │ │ │ ├── a00270.html │ │ │ │ │ │ ├── a00271.html │ │ │ │ │ │ ├── a00272.html │ │ │ │ │ │ ├── a00273.html │ │ │ │ │ │ ├── a00274.html │ │ │ │ │ │ ├── a00275.html │ │ │ │ │ │ ├── a00276.html │ │ │ │ │ │ ├── a00277.html │ │ │ │ │ │ ├── a00278.html │ │ │ │ │ │ ├── a00279.html │ │ │ │ │ │ ├── a00280.html │ │ │ │ │ │ ├── a00281.html │ │ │ │ │ │ ├── a00282.html │ │ │ │ │ │ ├── a00283.html │ │ │ │ │ │ ├── a00284.html │ │ │ │ │ │ ├── a00285.html │ │ │ │ │ │ ├── a00286.html │ │ │ │ │ │ ├── a00287.html │ │ │ │ │ │ ├── a00288.html │ │ │ │ │ │ ├── a00289.html │ │ │ │ │ │ ├── a00290.html │ │ │ │ │ │ ├── a00291.html │ │ │ │ │ │ ├── a00292.html │ │ │ │ │ │ ├── a00293.html │ │ │ │ │ │ ├── a00294.html │ │ │ │ │ │ ├── a00295.html │ │ │ │ │ │ ├── a00296.html │ │ │ │ │ │ ├── a00297.html │ │ │ │ │ │ ├── a00298.html │ │ │ │ │ │ ├── a00299.html │ │ │ │ │ │ ├── a00300.html │ │ │ │ │ │ ├── a00301.html │ │ │ │ │ │ ├── a00302.html │ │ │ │ │ │ ├── a00303.html │ │ │ │ │ │ ├── a00304.html │ │ │ │ │ │ ├── a00305.html │ │ │ │ │ │ ├── a00306.html │ │ │ │ │ │ ├── a00307.html │ │ │ │ │ │ ├── a00308.html │ │ │ │ │ │ ├── a00309.html │ │ │ │ │ │ ├── a00310.html │ │ │ │ │ │ ├── a00311.html │ │ │ │ │ │ ├── a00312.html │ │ │ │ │ │ ├── a00313.html │ │ │ │ │ │ ├── a00314.html │ │ │ │ │ │ ├── a00315.html │ │ │ │ │ │ ├── a00316.html │ │ │ │ │ │ ├── a00317.html │ │ │ │ │ │ ├── a00318.html │ │ │ │ │ │ ├── a00319.html │ │ │ │ │ │ ├── a00320.html │ │ │ │ │ │ ├── a00321.html │ │ │ │ │ │ ├── a00322.html │ │ │ │ │ │ ├── a00323.html │ │ │ │ │ │ ├── a00324.html │ │ │ │ │ │ ├── a00325.html │ │ │ │ │ │ ├── a00326.html │ │ │ │ │ │ ├── a00327.html │ │ │ │ │ │ ├── a00328.html │ │ │ │ │ │ ├── a00329.html │ │ │ │ │ │ ├── a00330.html │ │ │ │ │ │ ├── a00331.html │ │ │ │ │ │ ├── a00332.html │ │ │ │ │ │ ├── a00333.html │ │ │ │ │ │ ├── a00334.html │ │ │ │ │ │ ├── a00335.html │ │ │ │ │ │ ├── a00336.html │ │ │ │ │ │ ├── a00337.html │ │ │ │ │ │ ├── a00338.html │ │ │ │ │ │ ├── a00339.html │ │ │ │ │ │ ├── a00340.html │ │ │ │ │ │ ├── a00341.html │ │ │ │ │ │ ├── a00342.html │ │ │ │ │ │ ├── a00343.html │ │ │ │ │ │ ├── a00344.html │ │ │ │ │ │ ├── a00345.html │ │ │ │ │ │ ├── a00346.html │ │ │ │ │ │ ├── a00347.html │ │ │ │ │ │ ├── a00348.html │ │ │ │ │ │ ├── a00349.html │ │ │ │ │ │ ├── a00350.html │ │ │ │ │ │ ├── a00351.html │ │ │ │ │ │ ├── a00352.html │ │ │ │ │ │ ├── a00353.html │ │ │ │ │ │ ├── a00354.html │ │ │ │ │ │ ├── a00355.html │ │ │ │ │ │ ├── a00356.html │ │ │ │ │ │ ├── a00357.html │ │ │ │ │ │ ├── a00358.html │ │ │ │ │ │ ├── a00359.html │ │ │ │ │ │ ├── a00360.html │ │ │ │ │ │ ├── a00361.html │ │ │ │ │ │ ├── a00362.html │ │ │ │ │ │ ├── a00363.html │ │ │ │ │ │ ├── a00364.html │ │ │ │ │ │ ├── a00365.html │ │ │ │ │ │ ├── a00366.html │ │ │ │ │ │ ├── a00367.html │ │ │ │ │ │ ├── a00368.html │ │ │ │ │ │ ├── a00369.html │ │ │ │ │ │ ├── a00370.html │ │ │ │ │ │ ├── a00371.html │ │ │ │ │ │ ├── a00372.html │ │ │ │ │ │ ├── a00373.html │ │ │ │ │ │ ├── a00374.html │ │ │ │ │ │ ├── dir_033f5edb0915b828d2c46ed4804e5503.html │ │ │ │ │ │ ├── dir_3a581ba30d25676e4b797b1f96d53b45.html │ │ │ │ │ │ ├── dir_44e5e654415abd9ca6fdeaddaff8565e.html │ │ │ │ │ │ ├── dir_4c6bd29c73fa4e5a2509e1c15f846751.html │ │ │ │ │ │ ├── dir_5189610d3ba09ec39b766fb99b34cd93.html │ │ │ │ │ │ ├── dir_6b66465792d005310484819a0eb0b0d3.html │ │ │ │ │ │ ├── dir_9e5fe034a00e89334fd5186c3e7db156.html │ │ │ │ │ │ ├── dir_a8bee7be44182a33f3820393ae0b105d.html │ │ │ │ │ │ ├── dir_cef2d71d502cb69a9252bca2297d9549.html │ │ │ │ │ │ ├── dir_d9496f0844b48bc7e53b5af8c99b9ab2.html │ │ │ │ │ │ ├── dir_f35778ec600a1b9bbc4524e62e226aa2.html │ │ │ │ │ │ ├── doxygen.css │ │ │ │ │ │ ├── dynsections.js │ │ │ │ │ │ ├── files.html │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ ├── jquery.js │ │ │ │ │ │ ├── modules.html │ │ │ │ │ │ ├── search/ │ │ │ │ │ │ │ ├── all_0.html │ │ │ │ │ │ │ ├── all_0.js │ │ │ │ │ │ │ ├── all_1.html │ │ │ │ │ │ │ ├── all_1.js │ │ │ │ │ │ │ ├── all_10.html │ │ │ │ │ │ │ ├── all_10.js │ │ │ │ │ │ │ ├── all_11.html │ │ │ │ │ │ │ ├── all_11.js │ │ │ │ │ │ │ ├── all_12.html │ │ │ │ │ │ │ ├── all_12.js │ │ │ │ │ │ │ ├── all_13.html │ │ │ │ │ │ │ ├── all_13.js │ │ │ │ │ │ │ ├── all_14.html │ │ │ │ │ │ │ ├── all_14.js │ │ │ │ │ │ │ ├── all_15.html │ │ │ │ │ │ │ ├── all_15.js │ │ │ │ │ │ │ ├── all_16.html │ │ │ │ │ │ │ ├── all_16.js │ │ │ │ │ │ │ ├── all_2.html │ │ │ │ │ │ │ ├── all_2.js │ │ │ │ │ │ │ ├── all_3.html │ │ │ │ │ │ │ ├── all_3.js │ │ │ │ │ │ │ ├── all_4.html │ │ │ │ │ │ │ ├── all_4.js │ │ │ │ │ │ │ ├── all_5.html │ │ │ │ │ │ │ ├── all_5.js │ │ │ │ │ │ │ ├── all_6.html │ │ │ │ │ │ │ ├── all_6.js │ │ │ │ │ │ │ ├── all_7.html │ │ │ │ │ │ │ ├── all_7.js │ │ │ │ │ │ │ ├── all_8.html │ │ │ │ │ │ │ ├── all_8.js │ │ │ │ │ │ │ ├── all_9.html │ │ │ │ │ │ │ ├── all_9.js │ │ │ │ │ │ │ ├── all_a.html │ │ │ │ │ │ │ ├── all_a.js │ │ │ │ │ │ │ ├── all_b.html │ │ │ │ │ │ │ ├── all_b.js │ │ │ │ │ │ │ ├── all_c.html │ │ │ │ │ │ │ ├── all_c.js │ │ │ │ │ │ │ ├── all_d.html │ │ │ │ │ │ │ ├── all_d.js │ │ │ │ │ │ │ ├── all_e.html │ │ │ │ │ │ │ ├── all_e.js │ │ │ │ │ │ │ ├── all_f.html │ │ │ │ │ │ │ ├── all_f.js │ │ │ │ │ │ │ ├── files_0.html │ │ │ │ │ │ │ ├── files_0.js │ │ │ │ │ │ │ ├── files_1.html │ │ │ │ │ │ │ ├── files_1.js │ │ │ │ │ │ │ ├── files_10.html │ │ │ │ │ │ │ ├── files_10.js │ │ │ │ │ │ │ ├── files_11.html │ │ │ │ │ │ │ ├── files_11.js │ │ │ │ │ │ │ ├── files_12.html │ │ │ │ │ │ │ ├── files_12.js │ │ │ │ │ │ │ ├── files_13.html │ │ │ │ │ │ │ ├── files_13.js │ │ │ │ │ │ │ ├── files_14.html │ │ │ │ │ │ │ ├── files_14.js │ │ │ │ │ │ │ ├── files_2.html │ │ │ │ │ │ │ ├── files_2.js │ │ │ │ │ │ │ ├── files_3.html │ │ │ │ │ │ │ ├── files_3.js │ │ │ │ │ │ │ ├── files_4.html │ │ │ │ │ │ │ ├── files_4.js │ │ │ │ │ │ │ ├── files_5.html │ │ │ │ │ │ │ ├── files_5.js │ │ │ │ │ │ │ ├── files_6.html │ │ │ │ │ │ │ ├── files_6.js │ │ │ │ │ │ │ ├── files_7.html │ │ │ │ │ │ │ ├── files_7.js │ │ │ │ │ │ │ ├── files_8.html │ │ │ │ │ │ │ ├── files_8.js │ │ │ │ │ │ │ ├── files_9.html │ │ │ │ │ │ │ ├── files_9.js │ │ │ │ │ │ │ ├── files_a.html │ │ │ │ │ │ │ ├── files_a.js │ │ │ │ │ │ │ ├── files_b.html │ │ │ │ │ │ │ ├── files_b.js │ │ │ │ │ │ │ ├── files_c.html │ │ │ │ │ │ │ ├── files_c.js │ │ │ │ │ │ │ ├── files_d.html │ │ │ │ │ │ │ ├── files_d.js │ │ │ │ │ │ │ ├── files_e.html │ │ │ │ │ │ │ ├── files_e.js │ │ │ │ │ │ │ ├── files_f.html │ │ │ │ │ │ │ ├── files_f.js │ │ │ │ │ │ │ ├── functions_0.html │ │ │ │ │ │ │ ├── functions_0.js │ │ │ │ │ │ │ ├── functions_1.html │ │ │ │ │ │ │ ├── functions_1.js │ │ │ │ │ │ │ ├── functions_10.html │ │ │ │ │ │ │ ├── functions_10.js │ │ │ │ │ │ │ ├── functions_11.html │ │ │ │ │ │ │ ├── functions_11.js │ │ │ │ │ │ │ ├── functions_12.html │ │ │ │ │ │ │ ├── functions_12.js │ │ │ │ │ │ │ ├── functions_13.html │ │ │ │ │ │ │ ├── functions_13.js │ │ │ │ │ │ │ ├── functions_14.html │ │ │ │ │ │ │ ├── functions_14.js │ │ │ │ │ │ │ ├── functions_15.html │ │ │ │ │ │ │ ├── functions_15.js │ │ │ │ │ │ │ ├── functions_16.html │ │ │ │ │ │ │ ├── functions_16.js │ │ │ │ │ │ │ ├── functions_2.html │ │ │ │ │ │ │ ├── functions_2.js │ │ │ │ │ │ │ ├── functions_3.html │ │ │ │ │ │ │ ├── functions_3.js │ │ │ │ │ │ │ ├── functions_4.html │ │ │ │ │ │ │ ├── functions_4.js │ │ │ │ │ │ │ ├── functions_5.html │ │ │ │ │ │ │ ├── functions_5.js │ │ │ │ │ │ │ ├── functions_6.html │ │ │ │ │ │ │ ├── functions_6.js │ │ │ │ │ │ │ ├── functions_7.html │ │ │ │ │ │ │ ├── functions_7.js │ │ │ │ │ │ │ ├── functions_8.html │ │ │ │ │ │ │ ├── functions_8.js │ │ │ │ │ │ │ ├── functions_9.html │ │ │ │ │ │ │ ├── functions_9.js │ │ │ │ │ │ │ ├── functions_a.html │ │ │ │ │ │ │ ├── functions_a.js │ │ │ │ │ │ │ ├── functions_b.html │ │ │ │ │ │ │ ├── functions_b.js │ │ │ │ │ │ │ ├── functions_c.html │ │ │ │ │ │ │ ├── functions_c.js │ │ │ │ │ │ │ ├── functions_d.html │ │ │ │ │ │ │ ├── functions_d.js │ │ │ │ │ │ │ ├── functions_e.html │ │ │ │ │ │ │ ├── functions_e.js │ │ │ │ │ │ │ ├── functions_f.html │ │ │ │ │ │ │ ├── functions_f.js │ │ │ │ │ │ │ ├── groups_0.html │ │ │ │ │ │ │ ├── groups_0.js │ │ │ │ │ │ │ ├── groups_1.html │ │ │ │ │ │ │ ├── groups_1.js │ │ │ │ │ │ │ ├── groups_2.html │ │ │ │ │ │ │ ├── groups_2.js │ │ │ │ │ │ │ ├── groups_3.html │ │ │ │ │ │ │ ├── groups_3.js │ │ │ │ │ │ │ ├── groups_4.html │ │ │ │ │ │ │ ├── groups_4.js │ │ │ │ │ │ │ ├── groups_5.html │ │ │ │ │ │ │ ├── groups_5.js │ │ │ │ │ │ │ ├── groups_6.html │ │ │ │ │ │ │ ├── groups_6.js │ │ │ │ │ │ │ ├── groups_7.html │ │ │ │ │ │ │ ├── groups_7.js │ │ │ │ │ │ │ ├── groups_8.html │ │ │ │ │ │ │ ├── groups_8.js │ │ │ │ │ │ │ ├── groups_9.html │ │ │ │ │ │ │ ├── groups_9.js │ │ │ │ │ │ │ ├── nomatches.html │ │ │ │ │ │ │ ├── pages_0.html │ │ │ │ │ │ │ ├── pages_0.js │ │ │ │ │ │ │ ├── search.css │ │ │ │ │ │ │ ├── search.js │ │ │ │ │ │ │ ├── searchdata.js │ │ │ │ │ │ │ ├── typedefs_0.html │ │ │ │ │ │ │ ├── typedefs_0.js │ │ │ │ │ │ │ ├── typedefs_1.html │ │ │ │ │ │ │ ├── typedefs_1.js │ │ │ │ │ │ │ ├── typedefs_2.html │ │ │ │ │ │ │ ├── typedefs_2.js │ │ │ │ │ │ │ ├── typedefs_3.html │ │ │ │ │ │ │ ├── typedefs_3.js │ │ │ │ │ │ │ ├── typedefs_4.html │ │ │ │ │ │ │ ├── typedefs_4.js │ │ │ │ │ │ │ ├── typedefs_5.html │ │ │ │ │ │ │ ├── typedefs_5.js │ │ │ │ │ │ │ ├── typedefs_6.html │ │ │ │ │ │ │ ├── typedefs_6.js │ │ │ │ │ │ │ ├── typedefs_7.html │ │ │ │ │ │ │ ├── typedefs_7.js │ │ │ │ │ │ │ ├── typedefs_8.html │ │ │ │ │ │ │ ├── typedefs_8.js │ │ │ │ │ │ │ ├── typedefs_9.html │ │ │ │ │ │ │ ├── typedefs_9.js │ │ │ │ │ │ │ ├── typedefs_a.html │ │ │ │ │ │ │ ├── typedefs_a.js │ │ │ │ │ │ │ ├── typedefs_b.html │ │ │ │ │ │ │ ├── typedefs_b.js │ │ │ │ │ │ │ ├── typedefs_c.html │ │ │ │ │ │ │ ├── typedefs_c.js │ │ │ │ │ │ │ ├── typedefs_d.html │ │ │ │ │ │ │ └── typedefs_d.js │ │ │ │ │ │ └── tabs.css │ │ │ │ │ ├── man.doxy │ │ │ │ │ └── theme/ │ │ │ │ │ └── doxygen.css │ │ │ │ ├── glm/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── common.hpp │ │ │ │ │ ├── detail/ │ │ │ │ │ │ ├── _features.hpp │ │ │ │ │ │ ├── _fixes.hpp │ │ │ │ │ │ ├── _noise.hpp │ │ │ │ │ │ ├── _swizzle.hpp │ │ │ │ │ │ ├── _swizzle_func.hpp │ │ │ │ │ │ ├── _vectorize.hpp │ │ │ │ │ │ ├── compute_common.hpp │ │ │ │ │ │ ├── compute_vector_relational.hpp │ │ │ │ │ │ ├── func_common.inl │ │ │ │ │ │ ├── func_common_simd.inl │ │ │ │ │ │ ├── func_exponential.inl │ │ │ │ │ │ ├── func_exponential_simd.inl │ │ │ │ │ │ ├── func_geometric.inl │ │ │ │ │ │ ├── func_geometric_simd.inl │ │ │ │ │ │ ├── func_integer.inl │ │ │ │ │ │ ├── func_integer_simd.inl │ │ │ │ │ │ ├── func_matrix.inl │ │ │ │ │ │ ├── func_matrix_simd.inl │ │ │ │ │ │ ├── func_packing.inl │ │ │ │ │ │ ├── func_packing_simd.inl │ │ │ │ │ │ ├── func_trigonometric.inl │ │ │ │ │ │ ├── func_trigonometric_simd.inl │ │ │ │ │ │ ├── func_vector_relational.inl │ │ │ │ │ │ ├── func_vector_relational_simd.inl │ │ │ │ │ │ ├── glm.cpp │ │ │ │ │ │ ├── qualifier.hpp │ │ │ │ │ │ ├── setup.hpp │ │ │ │ │ │ ├── type_float.hpp │ │ │ │ │ │ ├── type_half.hpp │ │ │ │ │ │ ├── type_half.inl │ │ │ │ │ │ ├── type_mat2x2.hpp │ │ │ │ │ │ ├── type_mat2x2.inl │ │ │ │ │ │ ├── type_mat2x3.hpp │ │ │ │ │ │ ├── type_mat2x3.inl │ │ │ │ │ │ ├── type_mat2x4.hpp │ │ │ │ │ │ ├── type_mat2x4.inl │ │ │ │ │ │ ├── type_mat3x2.hpp │ │ │ │ │ │ ├── type_mat3x2.inl │ │ │ │ │ │ ├── type_mat3x3.hpp │ │ │ │ │ │ ├── type_mat3x3.inl │ │ │ │ │ │ ├── type_mat3x4.hpp │ │ │ │ │ │ ├── type_mat3x4.inl │ │ │ │ │ │ ├── type_mat4x2.hpp │ │ │ │ │ │ ├── type_mat4x2.inl │ │ │ │ │ │ ├── type_mat4x3.hpp │ │ │ │ │ │ ├── type_mat4x3.inl │ │ │ │ │ │ ├── type_mat4x4.hpp │ │ │ │ │ │ ├── type_mat4x4.inl │ │ │ │ │ │ ├── type_mat4x4_simd.inl │ │ │ │ │ │ ├── type_quat.hpp │ │ │ │ │ │ ├── type_quat.inl │ │ │ │ │ │ ├── type_quat_simd.inl │ │ │ │ │ │ ├── type_vec1.hpp │ │ │ │ │ │ ├── type_vec1.inl │ │ │ │ │ │ ├── type_vec2.hpp │ │ │ │ │ │ ├── type_vec2.inl │ │ │ │ │ │ ├── type_vec3.hpp │ │ │ │ │ │ ├── type_vec3.inl │ │ │ │ │ │ ├── type_vec4.hpp │ │ │ │ │ │ ├── type_vec4.inl │ │ │ │ │ │ └── type_vec4_simd.inl │ │ │ │ │ ├── exponential.hpp │ │ │ │ │ ├── ext/ │ │ │ │ │ │ ├── _matrix_vectorize.hpp │ │ │ │ │ │ ├── matrix_clip_space.hpp │ │ │ │ │ │ ├── matrix_clip_space.inl │ │ │ │ │ │ ├── matrix_common.hpp │ │ │ │ │ │ ├── matrix_common.inl │ │ │ │ │ │ ├── matrix_double2x2.hpp │ │ │ │ │ │ ├── matrix_double2x2_precision.hpp │ │ │ │ │ │ ├── matrix_double2x3.hpp │ │ │ │ │ │ ├── matrix_double2x3_precision.hpp │ │ │ │ │ │ ├── matrix_double2x4.hpp │ │ │ │ │ │ ├── matrix_double2x4_precision.hpp │ │ │ │ │ │ ├── matrix_double3x2.hpp │ │ │ │ │ │ ├── matrix_double3x2_precision.hpp │ │ │ │ │ │ ├── matrix_double3x3.hpp │ │ │ │ │ │ ├── matrix_double3x3_precision.hpp │ │ │ │ │ │ ├── matrix_double3x4.hpp │ │ │ │ │ │ ├── matrix_double3x4_precision.hpp │ │ │ │ │ │ ├── matrix_double4x2.hpp │ │ │ │ │ │ ├── matrix_double4x2_precision.hpp │ │ │ │ │ │ ├── matrix_double4x3.hpp │ │ │ │ │ │ ├── matrix_double4x3_precision.hpp │ │ │ │ │ │ ├── matrix_double4x4.hpp │ │ │ │ │ │ ├── matrix_double4x4_precision.hpp │ │ │ │ │ │ ├── matrix_float2x2.hpp │ │ │ │ │ │ ├── matrix_float2x2_precision.hpp │ │ │ │ │ │ ├── matrix_float2x3.hpp │ │ │ │ │ │ ├── matrix_float2x3_precision.hpp │ │ │ │ │ │ ├── matrix_float2x4.hpp │ │ │ │ │ │ ├── matrix_float2x4_precision.hpp │ │ │ │ │ │ ├── matrix_float3x2.hpp │ │ │ │ │ │ ├── matrix_float3x2_precision.hpp │ │ │ │ │ │ ├── matrix_float3x3.hpp │ │ │ │ │ │ ├── matrix_float3x3_precision.hpp │ │ │ │ │ │ ├── matrix_float3x4.hpp │ │ │ │ │ │ ├── matrix_float3x4_precision.hpp │ │ │ │ │ │ ├── matrix_float4x2.hpp │ │ │ │ │ │ ├── matrix_float4x2_precision.hpp │ │ │ │ │ │ ├── matrix_float4x3.hpp │ │ │ │ │ │ ├── matrix_float4x3_precision.hpp │ │ │ │ │ │ ├── matrix_float4x4.hpp │ │ │ │ │ │ ├── matrix_float4x4_precision.hpp │ │ │ │ │ │ ├── matrix_int2x2.hpp │ │ │ │ │ │ ├── matrix_int2x2_sized.hpp │ │ │ │ │ │ ├── matrix_int2x3.hpp │ │ │ │ │ │ ├── matrix_int2x3_sized.hpp │ │ │ │ │ │ ├── matrix_int2x4.hpp │ │ │ │ │ │ ├── matrix_int2x4_sized.hpp │ │ │ │ │ │ ├── matrix_int3x2.hpp │ │ │ │ │ │ ├── matrix_int3x2_sized.hpp │ │ │ │ │ │ ├── matrix_int3x3.hpp │ │ │ │ │ │ ├── matrix_int3x3_sized.hpp │ │ │ │ │ │ ├── matrix_int3x4.hpp │ │ │ │ │ │ ├── matrix_int3x4_sized.hpp │ │ │ │ │ │ ├── matrix_int4x2.hpp │ │ │ │ │ │ ├── matrix_int4x2_sized.hpp │ │ │ │ │ │ ├── matrix_int4x3.hpp │ │ │ │ │ │ ├── matrix_int4x3_sized.hpp │ │ │ │ │ │ ├── matrix_int4x4.hpp │ │ │ │ │ │ ├── matrix_int4x4_sized.hpp │ │ │ │ │ │ ├── matrix_integer.hpp │ │ │ │ │ │ ├── matrix_integer.inl │ │ │ │ │ │ ├── matrix_projection.hpp │ │ │ │ │ │ ├── matrix_projection.inl │ │ │ │ │ │ ├── matrix_relational.hpp │ │ │ │ │ │ ├── matrix_relational.inl │ │ │ │ │ │ ├── matrix_transform.hpp │ │ │ │ │ │ ├── matrix_transform.inl │ │ │ │ │ │ ├── matrix_uint2x2.hpp │ │ │ │ │ │ ├── matrix_uint2x2_sized.hpp │ │ │ │ │ │ ├── matrix_uint2x3.hpp │ │ │ │ │ │ ├── matrix_uint2x3_sized.hpp │ │ │ │ │ │ ├── matrix_uint2x4.hpp │ │ │ │ │ │ ├── matrix_uint2x4_sized.hpp │ │ │ │ │ │ ├── matrix_uint3x2.hpp │ │ │ │ │ │ ├── matrix_uint3x2_sized.hpp │ │ │ │ │ │ ├── matrix_uint3x3.hpp │ │ │ │ │ │ ├── matrix_uint3x3_sized.hpp │ │ │ │ │ │ ├── matrix_uint3x4.hpp │ │ │ │ │ │ ├── matrix_uint3x4_sized.hpp │ │ │ │ │ │ ├── matrix_uint4x2.hpp │ │ │ │ │ │ ├── matrix_uint4x2_sized.hpp │ │ │ │ │ │ ├── matrix_uint4x3.hpp │ │ │ │ │ │ ├── matrix_uint4x3_sized.hpp │ │ │ │ │ │ ├── matrix_uint4x4.hpp │ │ │ │ │ │ ├── matrix_uint4x4_sized.hpp │ │ │ │ │ │ ├── quaternion_common.hpp │ │ │ │ │ │ ├── quaternion_common.inl │ │ │ │ │ │ ├── quaternion_common_simd.inl │ │ │ │ │ │ ├── quaternion_double.hpp │ │ │ │ │ │ ├── quaternion_double_precision.hpp │ │ │ │ │ │ ├── quaternion_exponential.hpp │ │ │ │ │ │ ├── quaternion_exponential.inl │ │ │ │ │ │ ├── quaternion_float.hpp │ │ │ │ │ │ ├── quaternion_float_precision.hpp │ │ │ │ │ │ ├── quaternion_geometric.hpp │ │ │ │ │ │ ├── quaternion_geometric.inl │ │ │ │ │ │ ├── quaternion_relational.hpp │ │ │ │ │ │ ├── quaternion_relational.inl │ │ │ │ │ │ ├── quaternion_transform.hpp │ │ │ │ │ │ ├── quaternion_transform.inl │ │ │ │ │ │ ├── quaternion_trigonometric.hpp │ │ │ │ │ │ ├── quaternion_trigonometric.inl │ │ │ │ │ │ ├── scalar_common.hpp │ │ │ │ │ │ ├── scalar_common.inl │ │ │ │ │ │ ├── scalar_constants.hpp │ │ │ │ │ │ ├── scalar_constants.inl │ │ │ │ │ │ ├── scalar_int_sized.hpp │ │ │ │ │ │ ├── scalar_integer.hpp │ │ │ │ │ │ ├── scalar_integer.inl │ │ │ │ │ │ ├── scalar_packing.hpp │ │ │ │ │ │ ├── scalar_packing.inl │ │ │ │ │ │ ├── scalar_reciprocal.hpp │ │ │ │ │ │ ├── scalar_reciprocal.inl │ │ │ │ │ │ ├── scalar_relational.hpp │ │ │ │ │ │ ├── scalar_relational.inl │ │ │ │ │ │ ├── scalar_uint_sized.hpp │ │ │ │ │ │ ├── scalar_ulp.hpp │ │ │ │ │ │ ├── scalar_ulp.inl │ │ │ │ │ │ ├── vector_bool1.hpp │ │ │ │ │ │ ├── vector_bool1_precision.hpp │ │ │ │ │ │ ├── vector_bool2.hpp │ │ │ │ │ │ ├── vector_bool2_precision.hpp │ │ │ │ │ │ ├── vector_bool3.hpp │ │ │ │ │ │ ├── vector_bool3_precision.hpp │ │ │ │ │ │ ├── vector_bool4.hpp │ │ │ │ │ │ ├── vector_bool4_precision.hpp │ │ │ │ │ │ ├── vector_common.hpp │ │ │ │ │ │ ├── vector_common.inl │ │ │ │ │ │ ├── vector_double1.hpp │ │ │ │ │ │ ├── vector_double1_precision.hpp │ │ │ │ │ │ ├── vector_double2.hpp │ │ │ │ │ │ ├── vector_double2_precision.hpp │ │ │ │ │ │ ├── vector_double3.hpp │ │ │ │ │ │ ├── vector_double3_precision.hpp │ │ │ │ │ │ ├── vector_double4.hpp │ │ │ │ │ │ ├── vector_double4_precision.hpp │ │ │ │ │ │ ├── vector_float1.hpp │ │ │ │ │ │ ├── vector_float1_precision.hpp │ │ │ │ │ │ ├── vector_float2.hpp │ │ │ │ │ │ ├── vector_float2_precision.hpp │ │ │ │ │ │ ├── vector_float3.hpp │ │ │ │ │ │ ├── vector_float3_precision.hpp │ │ │ │ │ │ ├── vector_float4.hpp │ │ │ │ │ │ ├── vector_float4_precision.hpp │ │ │ │ │ │ ├── vector_int1.hpp │ │ │ │ │ │ ├── vector_int1_sized.hpp │ │ │ │ │ │ ├── vector_int2.hpp │ │ │ │ │ │ ├── vector_int2_sized.hpp │ │ │ │ │ │ ├── vector_int3.hpp │ │ │ │ │ │ ├── vector_int3_sized.hpp │ │ │ │ │ │ ├── vector_int4.hpp │ │ │ │ │ │ ├── vector_int4_sized.hpp │ │ │ │ │ │ ├── vector_integer.hpp │ │ │ │ │ │ ├── vector_integer.inl │ │ │ │ │ │ ├── vector_packing.hpp │ │ │ │ │ │ ├── vector_packing.inl │ │ │ │ │ │ ├── vector_reciprocal.hpp │ │ │ │ │ │ ├── vector_reciprocal.inl │ │ │ │ │ │ ├── vector_relational.hpp │ │ │ │ │ │ ├── vector_relational.inl │ │ │ │ │ │ ├── vector_uint1.hpp │ │ │ │ │ │ ├── vector_uint1_sized.hpp │ │ │ │ │ │ ├── vector_uint2.hpp │ │ │ │ │ │ ├── vector_uint2_sized.hpp │ │ │ │ │ │ ├── vector_uint3.hpp │ │ │ │ │ │ ├── vector_uint3_sized.hpp │ │ │ │ │ │ ├── vector_uint4.hpp │ │ │ │ │ │ ├── vector_uint4_sized.hpp │ │ │ │ │ │ ├── vector_ulp.hpp │ │ │ │ │ │ └── vector_ulp.inl │ │ │ │ │ ├── ext.hpp │ │ │ │ │ ├── fwd.hpp │ │ │ │ │ ├── geometric.hpp │ │ │ │ │ ├── glm.hpp │ │ │ │ │ ├── gtc/ │ │ │ │ │ │ ├── bitfield.hpp │ │ │ │ │ │ ├── bitfield.inl │ │ │ │ │ │ ├── color_space.hpp │ │ │ │ │ │ ├── color_space.inl │ │ │ │ │ │ ├── constants.hpp │ │ │ │ │ │ ├── constants.inl │ │ │ │ │ │ ├── epsilon.hpp │ │ │ │ │ │ ├── epsilon.inl │ │ │ │ │ │ ├── integer.hpp │ │ │ │ │ │ ├── integer.inl │ │ │ │ │ │ ├── matrix_access.hpp │ │ │ │ │ │ ├── matrix_access.inl │ │ │ │ │ │ ├── matrix_integer.hpp │ │ │ │ │ │ ├── matrix_inverse.hpp │ │ │ │ │ │ ├── matrix_inverse.inl │ │ │ │ │ │ ├── matrix_transform.hpp │ │ │ │ │ │ ├── matrix_transform.inl │ │ │ │ │ │ ├── noise.hpp │ │ │ │ │ │ ├── noise.inl │ │ │ │ │ │ ├── packing.hpp │ │ │ │ │ │ ├── packing.inl │ │ │ │ │ │ ├── quaternion.hpp │ │ │ │ │ │ ├── quaternion.inl │ │ │ │ │ │ ├── quaternion_simd.inl │ │ │ │ │ │ ├── random.hpp │ │ │ │ │ │ ├── random.inl │ │ │ │ │ │ ├── reciprocal.hpp │ │ │ │ │ │ ├── round.hpp │ │ │ │ │ │ ├── round.inl │ │ │ │ │ │ ├── type_aligned.hpp │ │ │ │ │ │ ├── type_precision.hpp │ │ │ │ │ │ ├── type_precision.inl │ │ │ │ │ │ ├── type_ptr.hpp │ │ │ │ │ │ ├── type_ptr.inl │ │ │ │ │ │ ├── ulp.hpp │ │ │ │ │ │ ├── ulp.inl │ │ │ │ │ │ └── vec1.hpp │ │ │ │ │ ├── gtx/ │ │ │ │ │ │ ├── associated_min_max.hpp │ │ │ │ │ │ ├── associated_min_max.inl │ │ │ │ │ │ ├── bit.hpp │ │ │ │ │ │ ├── bit.inl │ │ │ │ │ │ ├── closest_point.hpp │ │ │ │ │ │ ├── closest_point.inl │ │ │ │ │ │ ├── color_encoding.hpp │ │ │ │ │ │ ├── color_encoding.inl │ │ │ │ │ │ ├── color_space.hpp │ │ │ │ │ │ ├── color_space.inl │ │ │ │ │ │ ├── color_space_YCoCg.hpp │ │ │ │ │ │ ├── color_space_YCoCg.inl │ │ │ │ │ │ ├── common.hpp │ │ │ │ │ │ ├── common.inl │ │ │ │ │ │ ├── compatibility.hpp │ │ │ │ │ │ ├── compatibility.inl │ │ │ │ │ │ ├── component_wise.hpp │ │ │ │ │ │ ├── component_wise.inl │ │ │ │ │ │ ├── dual_quaternion.hpp │ │ │ │ │ │ ├── dual_quaternion.inl │ │ │ │ │ │ ├── easing.hpp │ │ │ │ │ │ ├── easing.inl │ │ │ │ │ │ ├── euler_angles.hpp │ │ │ │ │ │ ├── euler_angles.inl │ │ │ │ │ │ ├── extend.hpp │ │ │ │ │ │ ├── extend.inl │ │ │ │ │ │ ├── extended_min_max.hpp │ │ │ │ │ │ ├── extended_min_max.inl │ │ │ │ │ │ ├── exterior_product.hpp │ │ │ │ │ │ ├── exterior_product.inl │ │ │ │ │ │ ├── fast_exponential.hpp │ │ │ │ │ │ ├── fast_exponential.inl │ │ │ │ │ │ ├── fast_square_root.hpp │ │ │ │ │ │ ├── fast_square_root.inl │ │ │ │ │ │ ├── fast_trigonometry.hpp │ │ │ │ │ │ ├── fast_trigonometry.inl │ │ │ │ │ │ ├── float_notmalize.inl │ │ │ │ │ │ ├── functions.hpp │ │ │ │ │ │ ├── functions.inl │ │ │ │ │ │ ├── gradient_paint.hpp │ │ │ │ │ │ ├── gradient_paint.inl │ │ │ │ │ │ ├── handed_coordinate_space.hpp │ │ │ │ │ │ ├── handed_coordinate_space.inl │ │ │ │ │ │ ├── hash.hpp │ │ │ │ │ │ ├── hash.inl │ │ │ │ │ │ ├── integer.hpp │ │ │ │ │ │ ├── integer.inl │ │ │ │ │ │ ├── intersect.hpp │ │ │ │ │ │ ├── intersect.inl │ │ │ │ │ │ ├── io.hpp │ │ │ │ │ │ ├── io.inl │ │ │ │ │ │ ├── log_base.hpp │ │ │ │ │ │ ├── log_base.inl │ │ │ │ │ │ ├── matrix_cross_product.hpp │ │ │ │ │ │ ├── matrix_cross_product.inl │ │ │ │ │ │ ├── matrix_decompose.hpp │ │ │ │ │ │ ├── matrix_decompose.inl │ │ │ │ │ │ ├── matrix_factorisation.hpp │ │ │ │ │ │ ├── matrix_factorisation.inl │ │ │ │ │ │ ├── matrix_interpolation.hpp │ │ │ │ │ │ ├── matrix_interpolation.inl │ │ │ │ │ │ ├── matrix_major_storage.hpp │ │ │ │ │ │ ├── matrix_major_storage.inl │ │ │ │ │ │ ├── matrix_operation.hpp │ │ │ │ │ │ ├── matrix_operation.inl │ │ │ │ │ │ ├── matrix_query.hpp │ │ │ │ │ │ ├── matrix_query.inl │ │ │ │ │ │ ├── matrix_transform_2d.hpp │ │ │ │ │ │ ├── matrix_transform_2d.inl │ │ │ │ │ │ ├── mixed_product.hpp │ │ │ │ │ │ ├── mixed_product.inl │ │ │ │ │ │ ├── norm.hpp │ │ │ │ │ │ ├── norm.inl │ │ │ │ │ │ ├── normal.hpp │ │ │ │ │ │ ├── normal.inl │ │ │ │ │ │ ├── normalize_dot.hpp │ │ │ │ │ │ ├── normalize_dot.inl │ │ │ │ │ │ ├── number_precision.hpp │ │ │ │ │ │ ├── number_precision.inl │ │ │ │ │ │ ├── optimum_pow.hpp │ │ │ │ │ │ ├── optimum_pow.inl │ │ │ │ │ │ ├── orthonormalize.hpp │ │ │ │ │ │ ├── orthonormalize.inl │ │ │ │ │ │ ├── pca.hpp │ │ │ │ │ │ ├── pca.inl │ │ │ │ │ │ ├── perpendicular.hpp │ │ │ │ │ │ ├── perpendicular.inl │ │ │ │ │ │ ├── polar_coordinates.hpp │ │ │ │ │ │ ├── polar_coordinates.inl │ │ │ │ │ │ ├── projection.hpp │ │ │ │ │ │ ├── projection.inl │ │ │ │ │ │ ├── quaternion.hpp │ │ │ │ │ │ ├── quaternion.inl │ │ │ │ │ │ ├── range.hpp │ │ │ │ │ │ ├── raw_data.hpp │ │ │ │ │ │ ├── raw_data.inl │ │ │ │ │ │ ├── rotate_normalized_axis.hpp │ │ │ │ │ │ ├── rotate_normalized_axis.inl │ │ │ │ │ │ ├── rotate_vector.hpp │ │ │ │ │ │ ├── rotate_vector.inl │ │ │ │ │ │ ├── scalar_multiplication.hpp │ │ │ │ │ │ ├── scalar_relational.hpp │ │ │ │ │ │ ├── scalar_relational.inl │ │ │ │ │ │ ├── spline.hpp │ │ │ │ │ │ ├── spline.inl │ │ │ │ │ │ ├── std_based_type.hpp │ │ │ │ │ │ ├── std_based_type.inl │ │ │ │ │ │ ├── string_cast.hpp │ │ │ │ │ │ ├── string_cast.inl │ │ │ │ │ │ ├── texture.hpp │ │ │ │ │ │ ├── texture.inl │ │ │ │ │ │ ├── transform.hpp │ │ │ │ │ │ ├── transform.inl │ │ │ │ │ │ ├── transform2.hpp │ │ │ │ │ │ ├── transform2.inl │ │ │ │ │ │ ├── type_aligned.hpp │ │ │ │ │ │ ├── type_aligned.inl │ │ │ │ │ │ ├── type_trait.hpp │ │ │ │ │ │ ├── type_trait.inl │ │ │ │ │ │ ├── vec_swizzle.hpp │ │ │ │ │ │ ├── vector_angle.hpp │ │ │ │ │ │ ├── vector_angle.inl │ │ │ │ │ │ ├── vector_query.hpp │ │ │ │ │ │ ├── vector_query.inl │ │ │ │ │ │ ├── wrap.hpp │ │ │ │ │ │ └── wrap.inl │ │ │ │ │ ├── integer.hpp │ │ │ │ │ ├── mat2x2.hpp │ │ │ │ │ ├── mat2x3.hpp │ │ │ │ │ ├── mat2x4.hpp │ │ │ │ │ ├── mat3x2.hpp │ │ │ │ │ ├── mat3x3.hpp │ │ │ │ │ ├── mat3x4.hpp │ │ │ │ │ ├── mat4x2.hpp │ │ │ │ │ ├── mat4x3.hpp │ │ │ │ │ ├── mat4x4.hpp │ │ │ │ │ ├── matrix.hpp │ │ │ │ │ ├── packing.hpp │ │ │ │ │ ├── simd/ │ │ │ │ │ │ ├── common.h │ │ │ │ │ │ ├── exponential.h │ │ │ │ │ │ ├── geometric.h │ │ │ │ │ │ ├── integer.h │ │ │ │ │ │ ├── matrix.h │ │ │ │ │ │ ├── neon.h │ │ │ │ │ │ ├── packing.h │ │ │ │ │ │ ├── platform.h │ │ │ │ │ │ ├── trigonometric.h │ │ │ │ │ │ └── vector_relational.h │ │ │ │ │ ├── trigonometric.hpp │ │ │ │ │ ├── vec2.hpp │ │ │ │ │ ├── vec3.hpp │ │ │ │ │ ├── vec4.hpp │ │ │ │ │ └── vector_relational.hpp │ │ │ │ ├── manual.md │ │ │ │ ├── readme.md │ │ │ │ ├── test/ │ │ │ │ │ ├── bug/ │ │ │ │ │ │ └── bug_ms_vec_static.cpp │ │ │ │ │ ├── cmake/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ └── test_find_glm.cpp │ │ │ │ │ ├── core/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── core_cpp_constexpr.cpp │ │ │ │ │ │ ├── core_cpp_defaulted_ctor.cpp │ │ │ │ │ │ ├── core_force_aligned_gentypes.cpp │ │ │ │ │ │ ├── core_force_arch_unknown.cpp │ │ │ │ │ │ ├── core_force_compiler_unknown.cpp │ │ │ │ │ │ ├── core_force_ctor_init.cpp │ │ │ │ │ │ ├── core_force_cxx03.cpp │ │ │ │ │ │ ├── core_force_cxx98.cpp │ │ │ │ │ │ ├── core_force_cxx_unknown.cpp │ │ │ │ │ │ ├── core_force_depth_zero_to_one.cpp │ │ │ │ │ │ ├── core_force_explicit_ctor.cpp │ │ │ │ │ │ ├── core_force_inline.cpp │ │ │ │ │ │ ├── core_force_left_handed.cpp │ │ │ │ │ │ ├── core_force_platform_unknown.cpp │ │ │ │ │ │ ├── core_force_pure.cpp │ │ │ │ │ │ ├── core_force_quat_xyzw.cpp │ │ │ │ │ │ ├── core_force_size_t_length.cpp │ │ │ │ │ │ ├── core_force_unrestricted_gentype.cpp │ │ │ │ │ │ ├── core_force_xyzw_only.cpp │ │ │ │ │ │ ├── core_func_common.cpp │ │ │ │ │ │ ├── core_func_exponential.cpp │ │ │ │ │ │ ├── core_func_geometric.cpp │ │ │ │ │ │ ├── core_func_integer.cpp │ │ │ │ │ │ ├── core_func_integer_bit_count.cpp │ │ │ │ │ │ ├── core_func_integer_find_lsb.cpp │ │ │ │ │ │ ├── core_func_integer_find_msb.cpp │ │ │ │ │ │ ├── core_func_matrix.cpp │ │ │ │ │ │ ├── core_func_noise.cpp │ │ │ │ │ │ ├── core_func_packing.cpp │ │ │ │ │ │ ├── core_func_swizzle.cpp │ │ │ │ │ │ ├── core_func_trigonometric.cpp │ │ │ │ │ │ ├── core_func_vector_relational.cpp │ │ │ │ │ │ ├── core_setup_force_cxx98.cpp │ │ │ │ │ │ ├── core_setup_force_size_t_length.cpp │ │ │ │ │ │ ├── core_setup_message.cpp │ │ │ │ │ │ ├── core_setup_platform_unknown.cpp │ │ │ │ │ │ ├── core_setup_precision.cpp │ │ │ │ │ │ ├── core_type_aligned.cpp │ │ │ │ │ │ ├── core_type_cast.cpp │ │ │ │ │ │ ├── core_type_ctor.cpp │ │ │ │ │ │ ├── core_type_int.cpp │ │ │ │ │ │ ├── core_type_length.cpp │ │ │ │ │ │ ├── core_type_mat2x2.cpp │ │ │ │ │ │ ├── core_type_mat2x3.cpp │ │ │ │ │ │ ├── core_type_mat2x4.cpp │ │ │ │ │ │ ├── core_type_mat3x2.cpp │ │ │ │ │ │ ├── core_type_mat3x3.cpp │ │ │ │ │ │ ├── core_type_mat3x4.cpp │ │ │ │ │ │ ├── core_type_mat4x2.cpp │ │ │ │ │ │ ├── core_type_mat4x3.cpp │ │ │ │ │ │ ├── core_type_mat4x4.cpp │ │ │ │ │ │ ├── core_type_vec1.cpp │ │ │ │ │ │ ├── core_type_vec2.cpp │ │ │ │ │ │ ├── core_type_vec3.cpp │ │ │ │ │ │ └── core_type_vec4.cpp │ │ │ │ │ ├── ext/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── ext_matrix_clip_space.cpp │ │ │ │ │ │ ├── ext_matrix_common.cpp │ │ │ │ │ │ ├── ext_matrix_int2x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int2x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int2x4_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int3x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int3x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int3x4_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int4x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int4x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_int4x4_sized.cpp │ │ │ │ │ │ ├── ext_matrix_integer.cpp │ │ │ │ │ │ ├── ext_matrix_projection.cpp │ │ │ │ │ │ ├── ext_matrix_relational.cpp │ │ │ │ │ │ ├── ext_matrix_transform.cpp │ │ │ │ │ │ ├── ext_matrix_uint2x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint2x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint2x4_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint3x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint3x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint3x4_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint4x2_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint4x3_sized.cpp │ │ │ │ │ │ ├── ext_matrix_uint4x4_sized.cpp │ │ │ │ │ │ ├── ext_quaternion_common.cpp │ │ │ │ │ │ ├── ext_quaternion_exponential.cpp │ │ │ │ │ │ ├── ext_quaternion_geometric.cpp │ │ │ │ │ │ ├── ext_quaternion_relational.cpp │ │ │ │ │ │ ├── ext_quaternion_transform.cpp │ │ │ │ │ │ ├── ext_quaternion_trigonometric.cpp │ │ │ │ │ │ ├── ext_quaternion_type.cpp │ │ │ │ │ │ ├── ext_scalar_common.cpp │ │ │ │ │ │ ├── ext_scalar_constants.cpp │ │ │ │ │ │ ├── ext_scalar_int_sized.cpp │ │ │ │ │ │ ├── ext_scalar_integer.cpp │ │ │ │ │ │ ├── ext_scalar_packing.cpp │ │ │ │ │ │ ├── ext_scalar_reciprocal.cpp │ │ │ │ │ │ ├── ext_scalar_relational.cpp │ │ │ │ │ │ ├── ext_scalar_uint_sized.cpp │ │ │ │ │ │ ├── ext_scalar_ulp.cpp │ │ │ │ │ │ ├── ext_vec1.cpp │ │ │ │ │ │ ├── ext_vector_bool1.cpp │ │ │ │ │ │ ├── ext_vector_common.cpp │ │ │ │ │ │ ├── ext_vector_iec559.cpp │ │ │ │ │ │ ├── ext_vector_int1_sized.cpp │ │ │ │ │ │ ├── ext_vector_int2_sized.cpp │ │ │ │ │ │ ├── ext_vector_int3_sized.cpp │ │ │ │ │ │ ├── ext_vector_int4_sized.cpp │ │ │ │ │ │ ├── ext_vector_integer.cpp │ │ │ │ │ │ ├── ext_vector_integer_sized.cpp │ │ │ │ │ │ ├── ext_vector_packing.cpp │ │ │ │ │ │ ├── ext_vector_reciprocal.cpp │ │ │ │ │ │ ├── ext_vector_relational.cpp │ │ │ │ │ │ ├── ext_vector_uint1_sized.cpp │ │ │ │ │ │ ├── ext_vector_uint2_sized.cpp │ │ │ │ │ │ ├── ext_vector_uint3_sized.cpp │ │ │ │ │ │ ├── ext_vector_uint4_sized.cpp │ │ │ │ │ │ └── ext_vector_ulp.cpp │ │ │ │ │ ├── gtc/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── gtc_bitfield.cpp │ │ │ │ │ │ ├── gtc_color_space.cpp │ │ │ │ │ │ ├── gtc_constants.cpp │ │ │ │ │ │ ├── gtc_epsilon.cpp │ │ │ │ │ │ ├── gtc_integer.cpp │ │ │ │ │ │ ├── gtc_matrix_access.cpp │ │ │ │ │ │ ├── gtc_matrix_inverse.cpp │ │ │ │ │ │ ├── gtc_matrix_transform.cpp │ │ │ │ │ │ ├── gtc_noise.cpp │ │ │ │ │ │ ├── gtc_packing.cpp │ │ │ │ │ │ ├── gtc_quaternion.cpp │ │ │ │ │ │ ├── gtc_random.cpp │ │ │ │ │ │ ├── gtc_reciprocal.cpp │ │ │ │ │ │ ├── gtc_round.cpp │ │ │ │ │ │ ├── gtc_type_aligned.cpp │ │ │ │ │ │ ├── gtc_type_precision.cpp │ │ │ │ │ │ ├── gtc_type_ptr.cpp │ │ │ │ │ │ ├── gtc_ulp.cpp │ │ │ │ │ │ └── gtc_user_defined_types.cpp │ │ │ │ │ ├── gtx/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── gtx.cpp │ │ │ │ │ │ ├── gtx_associated_min_max.cpp │ │ │ │ │ │ ├── gtx_closest_point.cpp │ │ │ │ │ │ ├── gtx_color_encoding.cpp │ │ │ │ │ │ ├── gtx_color_space.cpp │ │ │ │ │ │ ├── gtx_color_space_YCoCg.cpp │ │ │ │ │ │ ├── gtx_common.cpp │ │ │ │ │ │ ├── gtx_compatibility.cpp │ │ │ │ │ │ ├── gtx_component_wise.cpp │ │ │ │ │ │ ├── gtx_dual_quaternion.cpp │ │ │ │ │ │ ├── gtx_easing.cpp │ │ │ │ │ │ ├── gtx_euler_angle.cpp │ │ │ │ │ │ ├── gtx_extend.cpp │ │ │ │ │ │ ├── gtx_extended_min_max.cpp │ │ │ │ │ │ ├── gtx_extented_min_max.cpp │ │ │ │ │ │ ├── gtx_exterior_product.cpp │ │ │ │ │ │ ├── gtx_fast_exponential.cpp │ │ │ │ │ │ ├── gtx_fast_square_root.cpp │ │ │ │ │ │ ├── gtx_fast_trigonometry.cpp │ │ │ │ │ │ ├── gtx_functions.cpp │ │ │ │ │ │ ├── gtx_gradient_paint.cpp │ │ │ │ │ │ ├── gtx_handed_coordinate_space.cpp │ │ │ │ │ │ ├── gtx_hash.cpp │ │ │ │ │ │ ├── gtx_int_10_10_10_2.cpp │ │ │ │ │ │ ├── gtx_integer.cpp │ │ │ │ │ │ ├── gtx_intersect.cpp │ │ │ │ │ │ ├── gtx_io.cpp │ │ │ │ │ │ ├── gtx_load.cpp │ │ │ │ │ │ ├── gtx_log_base.cpp │ │ │ │ │ │ ├── gtx_matrix_cross_product.cpp │ │ │ │ │ │ ├── gtx_matrix_decompose.cpp │ │ │ │ │ │ ├── gtx_matrix_factorisation.cpp │ │ │ │ │ │ ├── gtx_matrix_interpolation.cpp │ │ │ │ │ │ ├── gtx_matrix_major_storage.cpp │ │ │ │ │ │ ├── gtx_matrix_operation.cpp │ │ │ │ │ │ ├── gtx_matrix_query.cpp │ │ │ │ │ │ ├── gtx_matrix_transform_2d.cpp │ │ │ │ │ │ ├── gtx_mixed_product.cpp │ │ │ │ │ │ ├── gtx_norm.cpp │ │ │ │ │ │ ├── gtx_normal.cpp │ │ │ │ │ │ ├── gtx_normalize_dot.cpp │ │ │ │ │ │ ├── gtx_number_precision.cpp │ │ │ │ │ │ ├── gtx_optimum_pow.cpp │ │ │ │ │ │ ├── gtx_orthonormalize.cpp │ │ │ │ │ │ ├── gtx_pca.cpp │ │ │ │ │ │ ├── gtx_perpendicular.cpp │ │ │ │ │ │ ├── gtx_polar_coordinates.cpp │ │ │ │ │ │ ├── gtx_projection.cpp │ │ │ │ │ │ ├── gtx_quaternion.cpp │ │ │ │ │ │ ├── gtx_random.cpp │ │ │ │ │ │ ├── gtx_range.cpp │ │ │ │ │ │ ├── gtx_rotate_normalized_axis.cpp │ │ │ │ │ │ ├── gtx_rotate_vector.cpp │ │ │ │ │ │ ├── gtx_scalar_multiplication.cpp │ │ │ │ │ │ ├── gtx_scalar_relational.cpp │ │ │ │ │ │ ├── gtx_simd_mat4.cpp │ │ │ │ │ │ ├── gtx_simd_vec4.cpp │ │ │ │ │ │ ├── gtx_spline.cpp │ │ │ │ │ │ ├── gtx_string_cast.cpp │ │ │ │ │ │ ├── gtx_texture.cpp │ │ │ │ │ │ ├── gtx_type_aligned.cpp │ │ │ │ │ │ ├── gtx_type_trait.cpp │ │ │ │ │ │ ├── gtx_vec_swizzle.cpp │ │ │ │ │ │ ├── gtx_vector_angle.cpp │ │ │ │ │ │ ├── gtx_vector_query.cpp │ │ │ │ │ │ └── gtx_wrap.cpp │ │ │ │ │ └── perf/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── perf_matrix_div.cpp │ │ │ │ │ ├── perf_matrix_inverse.cpp │ │ │ │ │ ├── perf_matrix_mul.cpp │ │ │ │ │ ├── perf_matrix_mul_vector.cpp │ │ │ │ │ ├── perf_matrix_transpose.cpp │ │ │ │ │ └── perf_vector_mul_matrix.cpp │ │ │ │ └── util/ │ │ │ │ ├── autoexp.txt │ │ │ │ └── glm.natvis │ │ │ └── stbi_image_write.h │ │ └── simple-knn/ │ │ ├── build/ │ │ │ ├── temp.linux-x86_64-cpython-310/ │ │ │ │ ├── .ninja_deps │ │ │ │ ├── .ninja_log │ │ │ │ ├── build.ninja │ │ │ │ ├── ext.o │ │ │ │ ├── simple_knn.o │ │ │ │ └── spatial.o │ │ │ └── temp.linux-x86_64-cpython-38/ │ │ │ ├── ext.o │ │ │ ├── simple_knn.o │ │ │ └── spatial.o │ │ ├── ext.cpp │ │ ├── setup.py │ │ ├── simple_knn/ │ │ │ └── .gitkeep │ │ ├── simple_knn.cu │ │ ├── simple_knn.egg-info/ │ │ │ ├── PKG-INFO │ │ │ ├── SOURCES.txt │ │ │ ├── dependency_links.txt │ │ │ └── top_level.txt │ │ ├── simple_knn.h │ │ ├── spatial.cu │ │ └── spatial.h │ ├── utils/ │ │ ├── camera_utils.py │ │ ├── edit_utils.py │ │ ├── fusion_util.py │ │ ├── general_utils.py │ │ ├── graphics_utils.py │ │ ├── image_utils.py │ │ ├── loss_utils.py │ │ ├── pose_utils.py │ │ ├── sh_utils.py │ │ ├── step_track.py │ │ └── system_utils.py │ └── video_preprocessor/ │ └── __init__.py ├── get_normal.py ├── quick_start.sh ├── requirements.txt ├── train_all.sh ├── utils/ │ ├── align_traj.py │ ├── camera_utils.py │ ├── general_utils.py │ ├── graphics_utils.py │ ├── image_utils.py │ ├── interp_utils.py │ ├── loss_utils.py │ ├── pose_utils.py │ ├── sfm_utils.py │ ├── sh_utils.py │ ├── stepfun.py │ ├── system_utils.py │ └── utils_poses/ │ ├── ATE/ │ │ ├── align_trajectory.py │ │ ├── align_utils.py │ │ ├── compute_trajectory_errors.py │ │ ├── results_writer.py │ │ ├── trajectory_utils.py │ │ └── transformations.py │ ├── align_traj.py │ ├── comp_ate.py │ ├── lie_group_helper.py │ ├── relative_pose.py │ ├── vis_cam_traj.py │ └── vis_pose_utils.py ├── vggt/ │ ├── heads/ │ │ ├── camera_head.py │ │ ├── dpt_head.py │ │ ├── head_act.py │ │ ├── track_head.py │ │ ├── track_modules/ │ │ │ ├── __init__.py │ │ │ ├── base_track_predictor.py │ │ │ ├── blocks.py │ │ │ ├── modules.py │ │ │ └── utils.py │ │ └── utils.py │ ├── layers/ │ │ ├── __init__.py │ │ ├── attention.py │ │ ├── block.py │ │ ├── drop_path.py │ │ ├── layer_scale.py │ │ ├── mlp.py │ │ ├── patch_embed.py │ │ ├── rope.py │ │ ├── swiglu_ffn.py │ │ └── vision_transformer.py │ ├── models/ │ │ ├── aggregator.py │ │ └── vggt.py │ └── utils/ │ ├── geometry.py │ ├── load_fn.py │ ├── pose_enc.py │ ├── rotation.py │ └── visual_track.py └── video_inference.py
Showing preview only (504K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5282 symbols across 846 files)
FILE: auto-seg/auto-mask-align.py
function show_anns (line 27) | def show_anns(anns, borders=True):
function mask_nms (line 50) | def mask_nms(masks, scores, iou_thr=0.7, score_thr=0.1, inner_thr=0.2, *...
function filter (line 132) | def filter(keep: torch.Tensor, masks_result) -> None:
function masks_update (line 140) | def masks_update(*args, **kwargs):
function show_mask (line 168) | def show_mask(mask, ax, obj_id=None, random_color=False):
function save_mask (line 179) | def save_mask(mask,frame_idx,save_dir):
function save_masks (line 187) | def save_masks(mask_list,frame_idx,save_dir):
function save_masks_npy (line 210) | def save_masks_npy(mask_list,frame_idx,save_dir):
function show_points (line 213) | def show_points(coords, labels, ax, marker_size=200):
function make_enlarge_bbox (line 219) | def make_enlarge_bbox(origin_bbox, max_width,max_height,ratio):
function sample_points (line 227) | def sample_points(masks, enlarge_bbox,positive_num=1,negtive_num=40):
function sample_points_from_mask (line 246) | def sample_points_from_mask(mask):
function search_new_obj (line 260) | def search_new_obj(masks_from_prev, mask_list,other_masks_list=None,mask...
function get_bbox_from_mask (line 291) | def get_bbox_from_mask(mask):
function cal_no_mask_area_ratio (line 306) | def cal_no_mask_area_ratio(out_mask_list):
class Prompts (line 315) | class Prompts:
method __init__ (line 316) | def __init__(self,bs:int):
method add (line 323) | def add(self,obj_id,frame_id,mask):
method get_obj_num (line 337) | def get_obj_num(self):
method __len__ (line 340) | def __len__(self):
method __iter__ (line 346) | def __iter__(self):
method __next__ (line 352) | def __next__(self):
function get_video_segments (line 377) | def get_video_segments(prompts_loader,predictor,inference_state,final_ou...
function generate_random_colors (line 591) | def generate_random_colors(num_colors):
FILE: auto-seg/sam2/automatic_mask_generator.py
class SAM2AutomaticMaskGenerator (line 36) | class SAM2AutomaticMaskGenerator:
method __init__ (line 37) | def __init__(
method from_pretrained (line 153) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2AutomaticMas...
method generate (line 170) | def generate(self, image: np.ndarray) -> List[Dict[str, Any]]:
method _generate_masks (line 224) | def _generate_masks(self, image: np.ndarray) -> MaskData:
method _process_crop (line 251) | def _process_crop(
method _process_batch (line 294) | def _process_batch(
method postprocess_small_regions (line 387) | def postprocess_small_regions(
method refine_with_m2m (line 437) | def refine_with_m2m(self, points, point_labels, low_res_masks, points_...
FILE: auto-seg/sam2/build_sam.py
function build_sam2 (line 15) | def build_sam2(
function build_sam2_video_predictor (line 44) | def build_sam2_video_predictor(
function build_sam2_hf (line 81) | def build_sam2_hf(model_id, **kwargs):
function build_sam2_video_predictor_hf (line 99) | def build_sam2_video_predictor_hf(model_id, **kwargs):
function _load_checkpoint (line 119) | def _load_checkpoint(model, ckpt_path):
FILE: auto-seg/sam2/modeling/backbones/hieradet.py
function do_pool (line 23) | def do_pool(x: torch.Tensor, pool: nn.Module, norm: nn.Module = None) ->...
class MultiScaleAttention (line 37) | class MultiScaleAttention(nn.Module):
method __init__ (line 38) | def __init__(
method forward (line 54) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class MultiScaleBlock (line 82) | class MultiScaleBlock(nn.Module):
method __init__ (line 83) | def __init__(
method forward (line 132) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class Hiera (line 167) | class Hiera(nn.Module):
method __init__ (line 172) | def __init__(
method _get_pos_embed (line 265) | def _get_pos_embed(self, hw: Tuple[int, int]) -> torch.Tensor:
method forward (line 275) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
FILE: auto-seg/sam2/modeling/backbones/image_encoder.py
class ImageEncoder (line 14) | class ImageEncoder(nn.Module):
method __init__ (line 15) | def __init__(
method forward (line 29) | def forward(self, sample: torch.Tensor):
class FpnNeck (line 45) | class FpnNeck(nn.Module):
method __init__ (line 52) | def __init__(
method forward (line 101) | def forward(self, xs: List[torch.Tensor]):
FILE: auto-seg/sam2/modeling/backbones/utils.py
function window_partition (line 16) | def window_partition(x, window_size):
function window_unpartition (line 41) | def window_unpartition(windows, window_size, pad_hw, hw):
class PatchEmbed (line 65) | class PatchEmbed(nn.Module):
method __init__ (line 70) | def __init__(
method forward (line 91) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/sam2/modeling/memory_attention.py
class MemoryAttentionLayer (line 17) | class MemoryAttentionLayer(nn.Module):
method __init__ (line 19) | def __init__(
method _forward_sa (line 58) | def _forward_sa(self, tgt, query_pos):
method _forward_ca (line 66) | def _forward_ca(self, tgt, memory, query_pos, pos, num_k_exclude_rope=0):
method forward (line 83) | def forward(
class MemoryAttention (line 102) | class MemoryAttention(nn.Module):
method __init__ (line 103) | def __init__(
method forward (line 119) | def forward(
FILE: auto-seg/sam2/modeling/memory_encoder.py
class MaskDownSampler (line 17) | class MaskDownSampler(nn.Module):
method __init__ (line 26) | def __init__(
method forward (line 57) | def forward(self, x):
class CXBlock (line 62) | class CXBlock(nn.Module):
method __init__ (line 74) | def __init__(
method forward (line 104) | def forward(self, x):
class Fuser (line 120) | class Fuser(nn.Module):
method __init__ (line 121) | def __init__(self, layer, num_layers, dim=None, input_projection=False):
method forward (line 130) | def forward(self, x):
class MemoryEncoder (line 138) | class MemoryEncoder(nn.Module):
method __init__ (line 139) | def __init__(
method forward (line 158) | def forward(
FILE: auto-seg/sam2/modeling/position_encoding.py
class PositionEmbeddingSine (line 16) | class PositionEmbeddingSine(nn.Module):
method __init__ (line 22) | def __init__(
method _encode_xy (line 42) | def _encode_xy(self, x, y):
method encode_boxes (line 62) | def encode_boxes(self, x, y, w, h):
method encode_points (line 70) | def encode_points(self, x, y, labels):
method forward (line 79) | def forward(self, x: torch.Tensor):
class PositionEmbeddingRandom (line 115) | class PositionEmbeddingRandom(nn.Module):
method __init__ (line 120) | def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = N...
method _pe_encoding (line 129) | def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:
method forward (line 138) | def forward(self, size: Tuple[int, int]) -> torch.Tensor:
method forward_with_coords (line 151) | def forward_with_coords(
function init_t_xy (line 167) | def init_t_xy(end_x: int, end_y: int):
function compute_axial_cis (line 174) | def compute_axial_cis(dim: int, end_x: int, end_y: int, theta: float = 1...
function reshape_for_broadcast (line 186) | def reshape_for_broadcast(freqs_cis: torch.Tensor, x: torch.Tensor):
function apply_rotary_enc (line 194) | def apply_rotary_enc(
FILE: auto-seg/sam2/modeling/sam/mask_decoder.py
class MaskDecoder (line 15) | class MaskDecoder(nn.Module):
method __init__ (line 16) | def __init__(
method forward (line 110) | def forward(
method predict_masks (line 168) | def predict_masks(
method _get_stability_scores (line 247) | def _get_stability_scores(self, mask_logits):
method _dynamic_multimask_via_stability (line 259) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc...
FILE: auto-seg/sam2/modeling/sam/prompt_encoder.py
class PromptEncoder (line 17) | class PromptEncoder(nn.Module):
method __init__ (line 18) | def __init__(
method get_dense_pe (line 68) | def get_dense_pe(self) -> torch.Tensor:
method _embed_points (line 79) | def _embed_points(
method _embed_boxes (line 103) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor:
method _embed_masks (line 114) | def _embed_masks(self, masks: torch.Tensor) -> torch.Tensor:
method _get_batch_size (line 119) | def _get_batch_size(
method _get_device (line 137) | def _get_device(self) -> torch.device:
method forward (line 140) | def forward(
FILE: auto-seg/sam2/modeling/sam/transformer.py
function sdp_kernel_context (line 28) | def sdp_kernel_context(dropout_p):
class TwoWayTransformer (line 44) | class TwoWayTransformer(nn.Module):
method __init__ (line 45) | def __init__(
method forward (line 90) | def forward(
class TwoWayAttentionBlock (line 137) | class TwoWayAttentionBlock(nn.Module):
method __init__ (line 138) | def __init__(
method forward (line 181) | def forward(
class Attention (line 215) | class Attention(nn.Module):
method __init__ (line 221) | def __init__(
method _separate_heads (line 245) | def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor:
method _recombine_heads (line 250) | def _recombine_heads(self, x: Tensor) -> Tensor:
method forward (line 255) | def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
class RoPEAttention (line 289) | class RoPEAttention(Attention):
method __init__ (line 292) | def __init__(
method forward (line 311) | def forward(
FILE: auto-seg/sam2/modeling/sam2_base.py
class SAM2Base (line 22) | class SAM2Base(torch.nn.Module):
method __init__ (line 23) | def __init__(
method device (line 192) | def device(self):
method forward (line 195) | def forward(self, *args, **kwargs):
method _build_sam_heads (line 201) | def _build_sam_heads(self):
method _forward_sam_heads (line 251) | def _forward_sam_heads(
method _use_mask_as_output (line 411) | def _use_mask_as_output(self, backbone_features, high_res_features, ma...
method forward_image (line 463) | def forward_image(self, img_batch: torch.Tensor):
method _prepare_backbone_features (line 477) | def _prepare_backbone_features(self, backbone_out):
method _prepare_memory_conditioned_features (line 493) | def _prepare_memory_conditioned_features(
method _encode_new_memory (line 664) | def _encode_new_memory(
method track_step (line 704) | def track_step(
method _use_multimask (line 801) | def _use_multimask(self, is_init_cond_frame, point_inputs):
method _apply_non_overlapping_constraints (line 811) | def _apply_non_overlapping_constraints(self, pred_masks):
FILE: auto-seg/sam2/modeling/sam2_utils.py
function select_closest_cond_frames (line 15) | def select_closest_cond_frames(frame_idx, cond_frame_outputs, max_cond_f...
function get_1d_sine_pe (line 60) | def get_1d_sine_pe(pos_inds, dim, temperature=10000):
function get_activation_fn (line 73) | def get_activation_fn(activation):
function get_clones (line 84) | def get_clones(module, N):
class DropPath (line 88) | class DropPath(nn.Module):
method __init__ (line 90) | def __init__(self, drop_prob=0.0, scale_by_keep=True):
method forward (line 95) | def forward(self, x):
class MLP (line 108) | class MLP(nn.Module):
method __init__ (line 109) | def __init__(
method forward (line 127) | def forward(self, x):
class LayerNorm2d (line 137) | class LayerNorm2d(nn.Module):
method __init__ (line 138) | def __init__(self, num_channels: int, eps: float = 1e-6) -> None:
method forward (line 144) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/sam2/sam2_image_predictor.py
class SAM2ImagePredictor (line 20) | class SAM2ImagePredictor:
method __init__ (line 21) | def __init__(
method from_pretrained (line 69) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2ImagePredict...
method set_image (line 86) | def set_image(
method set_image_batch (line 132) | def set_image_batch(
method predict_batch (line 175) | def predict_batch(
method predict (line 237) | def predict(
method _prep_prompts (line 305) | def _prep_prompts(
method _predict (line 337) | def _predict(
method get_image_embedding (line 440) | def get_image_embedding(self) -> torch.Tensor:
method device (line 456) | def device(self) -> torch.device:
method reset_predictor (line 459) | def reset_predictor(self) -> None:
FILE: auto-seg/sam2/sam2_video_predictor.py
class SAM2VideoPredictor (line 18) | class SAM2VideoPredictor(SAM2Base):
method __init__ (line 21) | def __init__(
method init_state (line 40) | def init_state(
method from_pretrained (line 110) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2VideoPredict...
method _obj_id_to_idx (line 126) | def _obj_id_to_idx(self, inference_state, obj_id):
method _obj_idx_to_id (line 160) | def _obj_idx_to_id(self, inference_state, obj_idx):
method _get_obj_num (line 164) | def _get_obj_num(self, inference_state):
method add_new_points_or_box (line 169) | def add_new_points_or_box(
method add_new_points (line 312) | def add_new_points(self, *args, **kwargs):
method add_new_mask (line 317) | def add_new_mask(
method _get_orig_video_res_output (line 400) | def _get_orig_video_res_output(self, inference_state, any_res_masks):
method _consolidate_temp_output_across_obj (line 422) | def _consolidate_temp_output_across_obj(
method _get_empty_mask_ptr (line 540) | def _get_empty_mask_ptr(self, inference_state, frame_idx):
method propagate_in_video_preflight (line 577) | def propagate_in_video_preflight(self, inference_state):
method propagate_in_video (line 647) | def propagate_in_video(
method _add_output_per_object (line 731) | def _add_output_per_object(
method reset_state (line 760) | def reset_state(self, inference_state):
method _reset_tracking_results (line 772) | def _reset_tracking_results(self, inference_state):
method _get_image_feature (line 791) | def _get_image_feature(self, inference_state, frame_idx, batch_size):
method _run_single_frame_inference (line 824) | def _run_single_frame_inference(
method _run_memory_encoder (line 890) | def _run_memory_encoder(
method _get_maskmem_pos_enc (line 919) | def _get_maskmem_pos_enc(self, inference_state, current_out):
method _clear_non_cond_mem_around_input (line 944) | def _clear_non_cond_mem_around_input(self, inference_state, frame_idx):
FILE: auto-seg/sam2/utils/amg.py
class MaskData (line 18) | class MaskData:
method __init__ (line 24) | def __init__(self, **kwargs) -> None:
method __setitem__ (line 31) | def __setitem__(self, key: str, item: Any) -> None:
method __delitem__ (line 37) | def __delitem__(self, key: str) -> None:
method __getitem__ (line 40) | def __getitem__(self, key: str) -> Any:
method items (line 43) | def items(self) -> ItemsView[str, Any]:
method filter (line 46) | def filter(self, keep: torch.Tensor) -> None:
method cat (line 61) | def cat(self, new_stats: "MaskData") -> None:
method to_numpy (line 74) | def to_numpy(self) -> None:
function is_box_near_crop_edge (line 80) | def is_box_near_crop_edge(
function box_xyxy_to_xywh (line 93) | def box_xyxy_to_xywh(box_xyxy: torch.Tensor) -> torch.Tensor:
function batch_iterator (line 100) | def batch_iterator(batch_size: int, *args) -> Generator[List[Any], None,...
function mask_to_rle_pytorch (line 109) | def mask_to_rle_pytorch(tensor: torch.Tensor) -> List[Dict[str, Any]]:
function rle_to_mask (line 140) | def rle_to_mask(rle: Dict[str, Any]) -> np.ndarray:
function area_from_rle (line 154) | def area_from_rle(rle: Dict[str, Any]) -> int:
function calculate_stability_score (line 158) | def calculate_stability_score(
function build_point_grid (line 181) | def build_point_grid(n_per_side: int) -> np.ndarray:
function build_all_layer_point_grids (line 191) | def build_all_layer_point_grids(
function generate_crop_boxes (line 202) | def generate_crop_boxes(
function uncrop_boxes_xyxy (line 239) | def uncrop_boxes_xyxy(boxes: torch.Tensor, crop_box: List[int]) -> torch...
function uncrop_points (line 248) | def uncrop_points(points: torch.Tensor, crop_box: List[int]) -> torch.Te...
function uncrop_masks (line 257) | def uncrop_masks(
function remove_small_regions (line 269) | def remove_small_regions(
function coco_encode_rle (line 296) | def coco_encode_rle(uncompressed_rle: Dict[str, Any]) -> Dict[str, Any]:
function batched_mask_to_box (line 305) | def batched_mask_to_box(masks: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/sam2/utils/misc.py
function get_sdpa_settings (line 17) | def get_sdpa_settings():
function get_connected_components (line 47) | def get_connected_components(mask):
function mask_to_box (line 66) | def mask_to_box(masks: torch.Tensor):
function _load_img_as_tensor (line 92) | def _load_img_as_tensor(img_path, image_size):
class AsyncVideoFrameLoader (line 104) | class AsyncVideoFrameLoader:
method __init__ (line 109) | def __init__(
method __getitem__ (line 147) | def __getitem__(self, index):
method __len__ (line 168) | def __len__(self):
function load_video_frames (line 172) | def load_video_frames(
function fill_holes_in_mask_scores (line 242) | def fill_holes_in_mask_scores(mask, max_area):
function concat_points (line 271) | def concat_points(old_point_inputs, new_points, new_labels):
FILE: auto-seg/sam2/utils/transforms.py
class SAM2Transforms (line 15) | class SAM2Transforms(nn.Module):
method __init__ (line 16) | def __init__(
method __call__ (line 37) | def __call__(self, x):
method forward_batch (line 41) | def forward_batch(self, img_list):
method transform_coords (line 46) | def transform_coords(
method transform_boxes (line 66) | def transform_boxes(
method postprocess_masks (line 76) | def postprocess_masks(self, masks: torch.Tensor, orig_hw) -> torch.Ten...
FILE: auto-seg/submodules/segment-anything-1/scripts/amg.py
function write_masks_to_folder (line 152) | def write_masks_to_folder(masks: List[Dict[str, Any]], path: str) -> None:
function get_amg_kwargs (line 177) | def get_amg_kwargs(args):
function main (line 195) | def main(args: argparse.Namespace) -> None:
FILE: auto-seg/submodules/segment-anything-1/scripts/export_onnx_model.py
function run_export (line 97) | def run_export(
function to_numpy (line 170) | def to_numpy(tensor):
FILE: auto-seg/submodules/segment-anything-1/segment_anything/automatic_mask_generator.py
class SamAutomaticMaskGenerator (line 35) | class SamAutomaticMaskGenerator:
method __init__ (line 36) | def __init__(
method generate (line 137) | def generate(self, image: np.ndarray) -> List[Dict[str, Any]]:
method generate_curr_anns (line 171) | def generate_curr_anns(
method _generate_masks (line 209) | def _generate_masks(self, image: np.ndarray) -> MaskData:
method _generate_masks_data (line 230) | def _generate_masks_data(
method _process_crop (line 253) | def _process_crop(
method _process_crop_data (line 287) | def _process_crop_data(
method _process_batch (line 308) | def _process_batch(
method _process_batch_data (line 364) | def _process_batch_data(
method postprocess_small_regions (line 402) | def postprocess_small_regions(
method generate_l (line 453) | def generate_l(self, image: np.ndarray) -> List[Dict[str, Any]]:
method _generate_masks_l (line 468) | def _generate_masks_l(self, image: np.ndarray) -> MaskData:
method _process_crop_l (line 493) | def _process_crop_l(
method _process_batch_l (line 521) | def _process_batch_l(
FILE: auto-seg/submodules/segment-anything-1/segment_anything/build_sam.py
function build_sam_vit_h (line 14) | def build_sam_vit_h(checkpoint=None):
function build_sam_vit_l (line 27) | def build_sam_vit_l(checkpoint=None):
function build_sam_vit_b (line 37) | def build_sam_vit_b(checkpoint=None):
function _build_sam (line 55) | def _build_sam(
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/common.py
class MLPBlock (line 13) | class MLPBlock(nn.Module):
method __init__ (line 14) | def __init__(
method forward (line 25) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class LayerNorm2d (line 31) | class LayerNorm2d(nn.Module):
method __init__ (line 32) | def __init__(self, num_channels: int, eps: float = 1e-6) -> None:
method forward (line 38) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/image_encoder.py
class ImageEncoderViT (line 17) | class ImageEncoderViT(nn.Module):
method __init__ (line 18) | def __init__(
method forward (line 106) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class Block (line 119) | class Block(nn.Module):
method __init__ (line 122) | def __init__(
method forward (line 166) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class Attention (line 185) | class Attention(nn.Module):
method __init__ (line 188) | def __init__(
method forward (line 224) | def forward(self, x: torch.Tensor) -> torch.Tensor:
function window_partition (line 243) | def window_partition(x: torch.Tensor, window_size: int) -> Tuple[torch.T...
function window_unpartition (line 267) | def window_unpartition(
function get_rel_pos (line 292) | def get_rel_pos(q_size: int, k_size: int, rel_pos: torch.Tensor) -> torc...
function add_decomposed_rel_pos (line 325) | def add_decomposed_rel_pos(
class PatchEmbed (line 364) | class PatchEmbed(nn.Module):
method __init__ (line 369) | def __init__(
method forward (line 391) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/mask_decoder.py
class MaskDecoder (line 16) | class MaskDecoder(nn.Module):
method __init__ (line 17) | def __init__(
method forward (line 71) | def forward(
method predict_masks (line 112) | def predict_masks(
class MLP (line 154) | class MLP(nn.Module):
method __init__ (line 155) | def __init__(
method forward (line 171) | def forward(self, x):
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/prompt_encoder.py
class PromptEncoder (line 16) | class PromptEncoder(nn.Module):
method __init__ (line 17) | def __init__(
method get_dense_pe (line 62) | def get_dense_pe(self) -> torch.Tensor:
method _embed_points (line 73) | def _embed_points(
method _embed_boxes (line 93) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor:
method _embed_masks (line 102) | def _embed_masks(self, masks: torch.Tensor) -> torch.Tensor:
method _get_batch_size (line 107) | def _get_batch_size(
method _get_device (line 125) | def _get_device(self) -> torch.device:
method forward (line 128) | def forward(
class PositionEmbeddingRandom (line 171) | class PositionEmbeddingRandom(nn.Module):
method __init__ (line 176) | def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = N...
method _pe_encoding (line 185) | def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:
method forward (line 194) | def forward(self, size: Tuple[int, int]) -> torch.Tensor:
method forward_with_coords (line 207) | def forward_with_coords(
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/sam.py
class Sam (line 18) | class Sam(nn.Module):
method __init__ (line 22) | def __init__(
method device (line 50) | def device(self) -> Any:
method forward (line 54) | def forward(
method postprocess_masks (line 133) | def postprocess_masks(
method preprocess (line 164) | def preprocess(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/modeling/transformer.py
class TwoWayTransformer (line 16) | class TwoWayTransformer(nn.Module):
method __init__ (line 17) | def __init__(
method forward (line 62) | def forward(
class TwoWayAttentionBlock (line 109) | class TwoWayAttentionBlock(nn.Module):
method __init__ (line 110) | def __init__(
method forward (line 151) | def forward(
class Attention (line 185) | class Attention(nn.Module):
method __init__ (line 191) | def __init__(
method _separate_heads (line 208) | def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor:
method _recombine_heads (line 213) | def _recombine_heads(self, x: Tensor) -> Tensor:
method forward (line 218) | def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/predictor.py
class SamPredictor (line 17) | class SamPredictor:
method __init__ (line 18) | def __init__(
method set_image (line 34) | def set_image(
method set_torch_image (line 63) | def set_torch_image(
method predict (line 92) | def predict(
method predict_torch (line 169) | def predict_torch(
method get_image_embedding (line 245) | def get_image_embedding(self) -> torch.Tensor:
method device (line 259) | def device(self) -> torch.device:
method reset_image (line 262) | def reset_image(self) -> None:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/utils/amg.py
class MaskData (line 16) | class MaskData:
method __init__ (line 22) | def __init__(self, **kwargs) -> None:
method __setitem__ (line 29) | def __setitem__(self, key: str, item: Any) -> None:
method __delitem__ (line 35) | def __delitem__(self, key: str) -> None:
method __getitem__ (line 38) | def __getitem__(self, key: str) -> Any:
method items (line 41) | def items(self) -> ItemsView[str, Any]:
method filter (line 44) | def filter(self, keep: torch.Tensor) -> None:
method cat (line 59) | def cat(self, new_stats: "MaskData") -> None:
method to_numpy (line 72) | def to_numpy(self) -> None:
function is_box_near_crop_edge (line 80) | def is_box_near_crop_edge(
function box_xyxy_to_xywh (line 93) | def box_xyxy_to_xywh(box_xyxy: torch.Tensor) -> torch.Tensor:
function batch_iterator (line 100) | def batch_iterator(batch_size: int, *args) -> Generator[List[Any], None,...
function mask_to_rle_pytorch (line 109) | def mask_to_rle_pytorch(tensor: torch.Tensor) -> List[Dict[str, Any]]:
function rle_to_mask (line 140) | def rle_to_mask(rle: Dict[str, Any]) -> np.ndarray:
function area_from_rle (line 154) | def area_from_rle(rle: Dict[str, Any]) -> int:
function calculate_stability_score (line 158) | def calculate_stability_score(
function build_point_grid (line 181) | def build_point_grid(n_per_side: int) -> np.ndarray:
function build_all_layer_point_grids (line 191) | def build_all_layer_point_grids(
function generate_crop_boxes (line 202) | def generate_crop_boxes(
function uncrop_boxes_xyxy (line 239) | def uncrop_boxes_xyxy(boxes: torch.Tensor, crop_box: List[int]) -> torch...
function uncrop_points (line 248) | def uncrop_points(points: torch.Tensor, crop_box: List[int]) -> torch.Te...
function uncrop_masks (line 257) | def uncrop_masks(
function remove_small_regions (line 269) | def remove_small_regions(
function coco_encode_rle (line 296) | def coco_encode_rle(uncompressed_rle: Dict[str, Any]) -> Dict[str, Any]:
function batched_mask_to_box (line 305) | def batched_mask_to_box(masks: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-1/segment_anything/utils/onnx.py
class SamOnnxModel (line 17) | class SamOnnxModel(nn.Module):
method __init__ (line 25) | def __init__(
method resize_longest_image_size (line 42) | def resize_longest_image_size(
method _embed_points (line 51) | def _embed_points(self, point_coords: torch.Tensor, point_labels: torc...
method _embed_masks (line 69) | def _embed_masks(self, input_mask: torch.Tensor, has_mask_input: torch...
method mask_postprocessing (line 76) | def mask_postprocessing(self, masks: torch.Tensor, orig_im_size: torch...
method select_masks (line 92) | def select_masks(
method forward (line 108) | def forward(
FILE: auto-seg/submodules/segment-anything-1/segment_anything/utils/transforms.py
class ResizeLongestSide (line 16) | class ResizeLongestSide:
method __init__ (line 23) | def __init__(self, target_length: int) -> None:
method apply_image (line 26) | def apply_image(self, image: np.ndarray) -> np.ndarray:
method apply_coords (line 33) | def apply_coords(self, coords: np.ndarray, original_size: Tuple[int, ....
method apply_boxes (line 47) | def apply_boxes(self, boxes: np.ndarray, original_size: Tuple[int, ......
method apply_image_torch (line 55) | def apply_image_torch(self, image: torch.Tensor) -> torch.Tensor:
method apply_coords_torch (line 67) | def apply_coords_torch(
method apply_boxes_torch (line 83) | def apply_boxes_torch(
method get_preprocess_shape (line 94) | def get_preprocess_shape(oldh: int, oldw: int, long_side_length: int) ...
FILE: auto-seg/submodules/segment-anything-2/demo/backend/server/app.py
function healthy (line 39) | def healthy() -> Response:
function send_gallery_video (line 44) | def send_gallery_video(path: str) -> Response:
function send_poster_image (line 55) | def send_poster_image(path: str) -> Response:
function send_uploaded_video (line 66) | def send_uploaded_video(path: str):
function propagate_in_video (line 78) | def propagate_in_video() -> Response:
function gen_track_with_mask_stream (line 90) | def gen_track_with_mask_stream(
class MyGraphQLView (line 116) | class MyGraphQLView(GraphQLView):
method get_context (line 117) | def get_context(self, request: Request, response: Response) -> Any:
FILE: auto-seg/submodules/segment-anything-2/demo/backend/server/inference/data_types.py
class Mask (line 15) | class Mask:
class BaseRequest (line 22) | class BaseRequest:
class StartSessionRequest (line 28) | class StartSessionRequest(BaseRequest):
class SaveSessionRequest (line 36) | class SaveSessionRequest(BaseRequest):
class LoadSessionRequest (line 43) | class LoadSessionRequest(BaseRequest):
class RenewSessionRequest (line 50) | class RenewSessionRequest(BaseRequest):
class CloseSessionRequest (line 57) | class CloseSessionRequest(BaseRequest):
class AddPointsRequest (line 64) | class AddPointsRequest(BaseRequest):
class AddMaskRequest (line 76) | class AddMaskRequest(BaseRequest):
class ClearPointsInFrameRequest (line 86) | class ClearPointsInFrameRequest(BaseRequest):
class ClearPointsInVideoRequest (line 95) | class ClearPointsInVideoRequest(BaseRequest):
class RemoveObjectRequest (line 102) | class RemoveObjectRequest(BaseRequest):
class PropagateInVideoRequest (line 110) | class PropagateInVideoRequest(BaseRequest):
class CancelPropagateInVideoRequest (line 118) | class CancelPropagateInVideoRequest(BaseRequest):
class StartSessionResponse (line 125) | class StartSessionResponse:
class SaveSessionResponse (line 131) | class SaveSessionResponse:
class LoadSessionResponse (line 137) | class LoadSessionResponse:
class RenewSessionResponse (line 143) | class RenewSessionResponse:
class CloseSessionResponse (line 149) | class CloseSessionResponse:
class ClearPointsInVideoResponse (line 155) | class ClearPointsInVideoResponse:
class PropagateDataValue (line 161) | class PropagateDataValue:
class PropagateDataResponse (line 168) | class PropagateDataResponse:
class RemoveObjectResponse (line 175) | class RemoveObjectResponse:
class CancelPorpagateResponse (line 181) | class CancelPorpagateResponse:
class InferenceSession (line 187) | class InferenceSession:
FILE: auto-seg/submodules/segment-anything-2/demo/backend/server/inference/multipart.py
class MultipartResponseBuilder (line 9) | class MultipartResponseBuilder:
method __init__ (line 12) | def __init__(self, boundary: str) -> None:
method build (line 16) | def build(
method get_message (line 33) | def get_message(self) -> bytes:
method __append_header (line 36) | def __append_header(self, key: str, value: str) -> "MultipartResponseB...
method __close_header (line 40) | def __close_header(self) -> "MultipartResponseBuilder":
method __append_body (line 44) | def __append_body(self, body: bytes) -> "MultipartResponseBuilder":
FILE: auto-seg/submodules/segment-anything-2/demo/backend/server/inference/predictor.py
class InferenceAPI (line 43) | class InferenceAPI:
method __init__ (line 45) | def __init__(self) -> None:
method autocast_context (line 94) | def autocast_context(self):
method start_session (line 100) | def start_session(self, request: StartSessionRequest) -> StartSessionR...
method close_session (line 116) | def close_session(self, request: CloseSessionRequest) -> CloseSessionR...
method add_points (line 120) | def add_points(
method add_mask (line 155) | def add_mask(self, request: AddMaskRequest) -> PropagateDataResponse:
method clear_points_in_frame (line 195) | def clear_points_in_frame(
method clear_points_in_video (line 227) | def clear_points_in_video(
method remove_object (line 241) | def remove_object(self, request: RemoveObjectRequest) -> RemoveObjectR...
method propagate_in_video (line 270) | def propagate_in_video(
method cancel_propagate_in_video (line 357) | def cancel_propagate_in_video(
method __get_rle_mask_list (line 364) | def __get_rle_mask_list(
method __get_mask_for_object (line 375) | def __get_mask_for_object(
method __get_session (line 391) | def __get_session(self, session_id: str):
method __get_session_stats (line 399) | def __get_session_stats(self):
method __clear_session_state (line 417) | def __clear_session_state(self, session_id: str) -> bool:
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/App.tsx
function App (line 20) | function App() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/VideoDecoder.ts
type ImageFrame (line 28) | type ImageFrame = {
type DecodedVideo (line 34) | type DecodedVideo = {
function decodeInternal (line 42) | function decodeInternal(
function decode (line 242) | function decode(
function decodeStream (line 264) | function decodeStream(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/VideoEncoder.ts
constant TIMESCALE (line 21) | const TIMESCALE = 90000;
constant SECONDS_PER_KEY_FRAME (line 22) | const SECONDS_PER_KEY_FRAME = 2;
function encode (line 24) | function encode(
function getScaledDuration (line 127) | function getScaledDuration(rawDuration: number) {
function roundToNearestEven (line 131) | function roundToNearestEven(dim: number) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/WebCodecUtils.ts
function cloneFrame (line 19) | async function cloneFrame(frame: VideoFrame): Promise<VideoFrame> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/MobileFirstClickBanner.tsx
function MobileFirstClickBanner (line 35) | function MobileFirstClickBanner() {
type MobileVideoGalleryModalTriggerProps (line 58) | type MobileVideoGalleryModalTriggerProps = {
function MobileVideoGalleryModalTrigger (line 62) | function MobileVideoGalleryModalTrigger({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/Tooltip.tsx
type Props (line 18) | type Props = PropsWithChildren<{
function Tooltip (line 28) | function Tooltip({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/AddObjectButton.tsx
function AddObjectButton (line 22) | function AddObjectButton() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ClearAllPointsInVideoButton.tsx
type Props (line 33) | type Props = {
function ClearAllPointsInVideoButton (line 37) | function ClearAllPointsInVideoButton({onRestart}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/CloseSessionButton.tsx
type Props (line 20) | type Props = {
function CloseSessionButton (line 24) | function CloseSessionButton({onSessionClose}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/FirstClickView.tsx
function FirstClickView (line 21) | function FirstClickView() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/LimitNotice.tsx
function LimitNotice (line 18) | function LimitNotice() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsList.tsx
type Props (line 39) | type Props = {
function MobileObjectsList (line 44) | function MobileObjectsList({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsToolbar.tsx
type Props (line 24) | type Props = {
function MobileObjectsToolbar (line 28) | function MobileObjectsToolbar({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsToolbarHeader.tsx
function MobileObjectsToolbarHeader (line 20) | function MobileObjectsToolbarHeader() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectActions.tsx
type Props (line 35) | type Props = {
function CustomButton (line 40) | function CustomButton({className, ...props}: ButtonProps) {
function ObjectActions (line 52) | function ObjectActions({objectId, active}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectPlaceholder.tsx
type Props (line 18) | type Props = {
function ObjectPlaceholder (line 23) | function ObjectPlaceholder({showPlus = true, onClick}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectThumbnail.tsx
type Props (line 16) | type Props = {
function ObjectThumbnail (line 22) | function ObjectThumbnail({thumbnail, color, onClick}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectUtils.ts
function getObjectLabel (line 18) | function getObjectLabel(tracklet: BaseTracklet) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbar.tsx
type Props (line 33) | type Props = {
function ObjectsToolbar (line 37) | function ObjectsToolbar({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbarBottomActions.tsx
type Props (line 27) | type Props = {
function ObjectsToolbarBottomActions (line 31) | function ObjectsToolbarBottomActions({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbarHeader.tsx
function ObjectsToolbarHeader (line 20) | function ObjectsToolbarHeader() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/PointsToggle.tsx
function PointsToggle (line 20) | function PointsToggle() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/PrimaryCTAButton.tsx
type Props (line 19) | type Props = {
function PrimaryCTAButton (line 24) | function PrimaryCTAButton({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ToolbarObject.tsx
type Props (line 26) | type Props = {
function ToolbarObject (line 35) | function ToolbarObject({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ToolbarObjectContainer.tsx
type ToolbarObjectContainerProps (line 66) | type ToolbarObjectContainerProps = PropsWithChildren<{
function ToolbarObjectContainer (line 77) | function ToolbarObjectContainer({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/TrackletSwimlane.tsx
type SwimlineSegment (line 75) | type SwimlineSegment = {
type Props (line 80) | type Props = {
function getSwimlaneSegments (line 85) | function getSwimlaneSegments(masks: DatalessMask[]): SwimlineSegment[] {
function TrackletSwimlane (line 109) | function TrackletSwimlane({tracklet, onSelectFrame}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/TrackletsAnnotation.tsx
function TrackletsAnnotation (line 34) | function TrackletsAnnotation() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/useTracklets.ts
function useTracklets (line 19) | function useTracklets() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/GradientBorder.tsx
type GradientTypes (line 20) | enum GradientTypes {
type Props (line 25) | type Props = {
function GradientBorder (line 52) | function GradientBorder({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/PlaybackButton.tsx
function PlaybackButton (line 24) | function PlaybackButton() {
function getButtonStyles (line 89) | function getButtonStyles(isDisabled: boolean): string {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/PrimaryCTAButton.tsx
type Props (line 19) | type Props = {
function PrimaryCTAButton (line 24) | function PrimaryCTAButton({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/ResponsiveButton.tsx
type Props (line 21) | type Props = ButtonProps & {startIcon: ReactNode};
function ResponsiveButton (line 23) | function ResponsiveButton(props: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/TrackAndPlayButton.tsx
function TrackAndPlayButton (line 30) | function TrackAndPlayButton() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/code/InitializeLocalMonaco.ts
method getWorker (line 24) | getWorker(_, label) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/BackgroundEffects.tsx
function BackgroundEffects (line 25) | function BackgroundEffects() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectVariantBadge.tsx
type Props (line 35) | type Props = {
function VariantBadge (line 39) | function VariantBadge({label}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsCarousel.tsx
type Props (line 24) | type Props = {
function EffectsCarousel (line 53) | function EffectsCarousel({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsCarouselShadow.tsx
type CarouselContainerShadowProps (line 28) | type CarouselContainerShadowProps = {
function CarouselContainerShadow (line 35) | function CarouselContainerShadow({isTop}: CarouselContainerShadowProps) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbar.tsx
type Props (line 23) | type Props = {
function EffectsToolbar (line 27) | function EffectsToolbar({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbarBottomActions.tsx
type Props (line 25) | type Props = {
function EffectsToolbarBottomActions (line 29) | function EffectsToolbarBottomActions({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbarHeader.tsx
function EffectsToolbarHeader (line 27) | function EffectsToolbarHeader() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsUtils.ts
type DemoEffect (line 34) | type DemoEffect = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/HighlightEffects.tsx
function HighlightEffects (line 27) | function HighlightEffects() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/MobileEffectsToolbar.tsx
type Props (line 37) | type Props = {
function MobileEffectsToolbar (line 41) | function MobileEffectsToolbar({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/MoreFunEffects.tsx
function MoreFunEffects (line 25) | function MoreFunEffects() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/ChangeVideoModal.tsx
type Props (line 25) | type Props = {
function ChangeVideoModal (line 31) | function ChangeVideoModal({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DefaultVideoGalleryModalTrigger.tsx
function DefaultVideoGalleryModalTrigger (line 20) | function DefaultVideoGalleryModalTrigger({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DemoVideoGallery.tsx
type Props (line 56) | type Props = {
type VideoPhotoData (line 64) | type VideoPhotoData = Photo &
function DemoVideoGallery (line 70) | function DemoVideoGallery({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DemoVideoGalleryModal.tsx
type VideoGalleryTriggerProps (line 65) | type VideoGalleryTriggerProps = {
type Props (line 69) | type Props = {
function DemoVideoGalleryModal (line 77) | function DemoVideoGalleryModal({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/VideoGalleryUploadPhoto.tsx
type Props (line 25) | type Props = {
function VideoGalleryUploadVideo (line 32) | function VideoGalleryUploadVideo({
type IconWrapperProps (line 88) | type IconWrapperProps = {
function IconWrapper (line 93) | function IconWrapper({icon, title}: IconWrapperProps) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/VideoPhoto.tsx
type Props (line 39) | type Props = {
function VideoPhoto (line 46) | function VideoPhoto({src, poster, style, onClick}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/DemoVideoGalleryModalQuery.graphql.ts
type DemoVideoGalleryModalQuery$variables (line 13) | type DemoVideoGalleryModalQuery$variables = Record<PropertyKey, never>;
type DemoVideoGalleryModalQuery$data (line 14) | type DemoVideoGalleryModalQuery$data = {
type DemoVideoGalleryModalQuery (line 17) | type DemoVideoGalleryModalQuery = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/DemoVideoGalleryQuery.graphql.ts
type DemoVideoGalleryQuery$variables (line 12) | type DemoVideoGalleryQuery$variables = Record<PropertyKey, never>;
type DemoVideoGalleryQuery$data (line 13) | type DemoVideoGalleryQuery$data = {
type DemoVideoGalleryQuery (line 28) | type DemoVideoGalleryQuery = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/useUploadVideoMutation.graphql.ts
type useUploadVideoMutation$variables (line 12) | type useUploadVideoMutation$variables = {
type useUploadVideoMutation$data (line 15) | type useUploadVideoMutation$data = {
type useUploadVideoMutation (line 26) | type useUploadVideoMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/useUploadVideo.ts
constant ACCEPT_VIDEOS (line 23) | const ACCEPT_VIDEOS = {
constant MAX_FILE_SIZE_IN_MB (line 29) | const MAX_FILE_SIZE_IN_MB = 70;
constant MAX_VIDEO_UPLOAD_SIZE (line 30) | const MAX_VIDEO_UPLOAD_SIZE = MAX_FILE_SIZE_IN_MB * 1024 ** 2;
type Props (line 32) | type Props = {
function useUploadVideo (line 38) | function useUploadVideo({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/icons/GitHubIcon.tsx
type Props (line 16) | type Props = {
function GitHubIcon (line 20) | function GitHubIcon({className}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/DownloadOption.tsx
function DownloadOption (line 20) | function DownloadOption() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/GalleryOption.tsx
type Props (line 22) | type Props = {
function GalleryOption (line 25) | function GalleryOption({onChangeVideo}: Props) {
function GalleryTrigger (line 35) | function GalleryTrigger({onClick}: VideoGalleryTriggerProps) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/MoreOptionsToolbar.tsx
type Props (line 24) | type Props = {
function MoreOptionsToolbar (line 28) | function MoreOptionsToolbar({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/MoreOptionsToolbarBottomActions.tsx
type Props (line 25) | type Props = {
function MoreOptionsToolbarBottomActions (line 29) | function MoreOptionsToolbarBottomActions({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/OptionButton.tsx
type Props (line 22) | type Props = {
function OptionButton (line 35) | function OptionButton({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/ShareSection.tsx
function ShareSection (line 18) | function ShareSection() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/ShareUtils.ts
function handleSaveVideo (line 16) | async function handleSaveVideo(
function getFileName (line 37) | function getFileName() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/TryAnotherVideoSection.tsx
type Props (line 22) | type Props = {
function TryAnotherVideoSection (line 26) | function TryAnotherVideoSection({onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/UploadOption.tsx
type Props (line 26) | type Props = {
function UploadOption (line 30) | function UploadOption({onUpload}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/__generated__/GetLinkOptionShareVideoMutation.graphql.ts
type GetLinkOptionShareVideoMutation$variables (line 12) | type GetLinkOptionShareVideoMutation$variables = {
type GetLinkOptionShareVideoMutation$data (line 15) | type GetLinkOptionShareVideoMutation$data = {
type GetLinkOptionShareVideoMutation (line 20) | type GetLinkOptionShareVideoMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/useDownloadVideo.ts
type DownloadingState (line 25) | type DownloadingState = 'default' | 'started' | 'encoding' | 'completed';
type State (line 27) | type State = {
function useDownloadVideo (line 33) | function useDownloadVideo(): State {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/RestartSessionButton.tsx
type Props (line 20) | type Props = {
function RestartSessionButton (line 24) | function RestartSessionButton({onRestartSession}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/__generated__/useCloseSessionBeforeUnloadMutation.graphql.ts
type CloseSessionInput (line 12) | type CloseSessionInput = {
type useCloseSessionBeforeUnloadMutation$variables (line 15) | type useCloseSessionBeforeUnloadMutation$variables = {
type useCloseSessionBeforeUnloadMutation$data (line 18) | type useCloseSessionBeforeUnloadMutation$data = {
type useCloseSessionBeforeUnloadMutation (line 23) | type useCloseSessionBeforeUnloadMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/useCloseSessionBeforeUnload.ts
function useCloseSessionBeforeUnload (line 32) | function useCloseSessionBeforeUnload() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/useRestartSession.ts
function useRestartSession (line 29) | function useRestartSession() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/DemoMessagesSnackbarUtils.ts
type MessageOptions (line 18) | type MessageOptions = EnqueueOption & {
type MessageEvent (line 22) | type MessageEvent = {
type MessagesEventMap (line 29) | interface MessagesEventMap {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/MessagesSnackbar.tsx
function MessagesSnackbar (line 67) | function MessagesSnackbar() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/snackbarAtoms.ts
type MessageType (line 18) | type MessageType = 'info' | 'loading' | 'warning';
type Message (line 20) | type Message = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useDemoMessagesSnackbar.ts
type State (line 22) | type State = {
function useDemoMessagesSnackbar (line 27) | function useDemoMessagesSnackbar(): State {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useExpireMessage.ts
function useExpireMessage (line 20) | function useExpireMessage() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useMessagesSnackbar.ts
type EnqueueOption (line 23) | type EnqueueOption = {
type State (line 31) | type State = {
function useMessagesSnackbar (line 36) | function useMessagesSnackbar(): State {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/DesktopToolbar.tsx
type Props (line 21) | type Props = {
function DesktopToolbar (line 26) | function DesktopToolbar({tabIndex, onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/MobileToolbar.tsx
type Props (line 20) | type Props = {
function MobileToolbar (line 25) | function MobileToolbar({tabIndex, onTabChange}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/Toolbar.tsx
function Toolbar (line 33) | function Toolbar() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarActionIcon.tsx
type Props (line 22) | type Props = {
function ToolbarActionIcon (line 37) | function ToolbarActionIcon({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarBottomActionsWrapper.tsx
function ToolbarBottomActionsWrapper (line 34) | function ToolbarBottomActionsWrapper({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarConfig.tsx
constant OBJECT_TOOLBAR_INDEX (line 16) | const OBJECT_TOOLBAR_INDEX = 0;
constant EFFECT_TOOLBAR_INDEX (line 17) | const EFFECT_TOOLBAR_INDEX = 1;
constant MORE_OPTIONS_TOOLBAR_INDEX (line 18) | const MORE_OPTIONS_TOOLBAR_INDEX = 2;
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarHeaderWrapper.tsx
type Props (line 19) | type Props = {
function ToolbarHeaderWrapper (line 27) | function ToolbarHeaderWrapper({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarProgressChip.tsx
constant TOTAL_DEMO_STEPS (line 23) | const TOTAL_DEMO_STEPS = 3;
function ToolbarProgressChip (line 25) | function ToolbarProgressChip() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarSection.tsx
type Props (line 18) | type Props = PropsWithChildren<{
function ToolbarSection (line 23) | function ToolbarSection({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/useListenToStreamingState.ts
function useListenToStreamingState (line 23) | function useListenToStreamingState(): {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/useToolbarTabs.ts
type State (line 19) | type State = [tabIndex: number, setTabIndex: (tabIndex: number) => void];
function useToolbarTabs (line 21) | function useToolbarTabs(): State {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/useFunctionThrottle.tsx
type ThrottleOptions (line 18) | type ThrottleOptions = {
type State (line 21) | type State = {
function useFunctionThrottle (line 27) | function useFunctionThrottle(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/ChangeVideoModal.tsx
type Props (line 25) | type Props = {
function ChangeVideoModal (line 31) | function ChangeVideoModal({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/EventEmitter.ts
type EventMap (line 16) | type EventMap<WorkerEventMap> = {
class EventEmitter (line 21) | class EventEmitter<WorkerEventMap> {
method trigger (line 24) | trigger<K extends keyof WorkerEventMap>(type: K, ev: WorkerEventMap[K]) {
method addEventListener (line 32) | addEventListener<K extends keyof WorkerEventMap>(
method removeEventListener (line 40) | removeEventListener<K extends keyof WorkerEventMap>(
method destroy (line 53) | destroy() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/Video.tsx
type Props (line 72) | type Props = {
type VideoRef (line 87) | type VideoRef = {
method getCanvas (line 164) | getCanvas() {
method width (line 167) | get width() {
method height (line 170) | get height() {
method frame (line 173) | get frame() {
method frame (line 176) | set frame(index: number) {
method numberOfFrames (line 179) | get numberOfFrames() {
method play (line 182) | play(): void {
method pause (line 185) | pause(): void {
method stop (line 188) | stop(): void {
method previousFrame (line 191) | previousFrame(): void {
method nextFrame (line 194) | nextFrame(): void {
method setEffect (line 197) | setEffect(
method encode (line 204) | encode(): void {
method streamMasks (line 207) | streamMasks(): void {
method abortStreamMasks (line 210) | abortStreamMasks(): Promise<void> {
method addEventListener (line 213) | addEventListener<K extends keyof VideoWorkerEventMap>(
method removeEventListener (line 219) | removeEventListener<K extends keyof VideoWorkerEventMap>(
method createFilmstrip (line 225) | createFilmstrip(width: number, height: number): Promise<ImageBitmap> {
method initializeTracker (line 229) | initializeTracker(name: keyof Trackers, options: TrackerOptions): void {
method startSession (line 232) | startSession(videoUrl: string): Promise<string | null> {
method closeSession (line 235) | closeSession(): void {
method logAnnotations (line 238) | logAnnotations(): void {
method createTracklet (line 241) | createTracklet(): Promise<BaseTracklet> {
method deleteTracklet (line 244) | deleteTracklet(trackletId: number): Promise<void> {
method updatePoints (line 247) | updatePoints(trackletId: number, points: SegmentationPoint[]): void {
method clearPointsInVideo (line 250) | clearPointsInVideo(): Promise<boolean> {
method getWorker_ONLY_USE_WITH_CAUTION (line 253) | getWorker_ONLY_USE_WITH_CAUTION() {
function onFocus (line 264) | function onFocus() {
function onVisibilityChange (line 272) | function onVisibilityChange() {
function onError (line 281) | function onError(event: ErrorEvent) {
function onPlay (line 287) | function onPlay() {
function onPause (line 291) | function onPause() {
function onStreamingDone (line 296) | function onStreamingDone(event: StreamingStateUpdateEvent) {
function onLoadStart (line 303) | function onLoadStart() {
function onDecodeStart (line 307) | function onDecodeStart() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoFilmstripWithPlayback.tsx
function VideoFilmstripWithPlayback (line 41) | function VideoFilmstripWithPlayback() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoLoadingOverlay.tsx
type Props (line 44) | type Props = {
function VideoLoadingOverlay (line 48) | function VideoLoadingOverlay({label}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerBridge.ts
type DecodeEvent (line 67) | type DecodeEvent = {
type LoadStartEvent (line 76) | type LoadStartEvent = unknown;
type EffectUpdateEvent (line 78) | type EffectUpdateEvent = {
type EncodingStateUpdateEvent (line 85) | type EncodingStateUpdateEvent = {
type EncodingCompletedEvent (line 89) | type EncodingCompletedEvent = {
type PlayEvent (line 93) | interface PlayEvent {}
type PauseEvent (line 95) | interface PauseEvent {}
type FilmstripEvent (line 97) | interface FilmstripEvent {
type FrameUpdateEvent (line 101) | interface FrameUpdateEvent {
type SessionStartedEvent (line 105) | interface SessionStartedEvent {
type SessionStartFailedEvent (line 109) | interface SessionStartFailedEvent {}
type TrackletCreatedEvent (line 111) | interface TrackletCreatedEvent {
type TrackletsEvent (line 117) | interface TrackletsEvent {
type TrackletDeletedEvent (line 123) | interface TrackletDeletedEvent {
type AddPointsEvent (line 127) | interface AddPointsEvent {
type ClearPointsInVideoEvent (line 131) | interface ClearPointsInVideoEvent {
type StreamingStartedEvent (line 135) | interface StreamingStartedEvent {}
type StreamingCompletedEvent (line 137) | interface StreamingCompletedEvent {}
type StreamingStateUpdateEvent (line 139) | interface StreamingStateUpdateEvent {
type RenderingErrorEvent (line 143) | interface RenderingErrorEvent {
type VideoWorkerEventMap (line 147) | interface VideoWorkerEventMap {
type Metadata (line 172) | type Metadata = {
class VideoWorkerBridge (line 179) | class VideoWorkerBridge extends EventEmitter<VideoWorkerEventMap> {
method create (line 180) | static create(workerFactory: () => Worker) {
method sessionId (line 191) | public get sessionId() {
method width (line 195) | public get width() {
method height (line 199) | public get height() {
method numberOfFrames (line 203) | public get numberOfFrames() {
method fps (line 207) | public get fps() {
method frame (line 211) | public get frame() {
method constructor (line 215) | constructor(worker: Worker) {
method setCanvas (line 244) | public setCanvas(canvas: HTMLCanvasElement): void {
method setSource (line 255) | public setSource(source: string): void {
method terminate (line 261) | public terminate(): void {
method play (line 266) | public play(): void {
method pause (line 270) | public pause(): void {
method stop (line 274) | public stop(): void {
method goToFrame (line 278) | public goToFrame(index: number): void {
method previousFrame (line 284) | public previousFrame(): void {
method nextFrame (line 289) | public nextFrame(): void {
method frame (line 294) | public set frame(index: number) {
method createFilmstrip (line 298) | createFilmstrip(width: number, height: number): Promise<ImageBitmap> {
method setEffect (line 318) | setEffect(name: keyof Effects, index: EffectIndex, options?: EffectOpt...
method encode (line 326) | encode(): void {
method initializeTracker (line 330) | initializeTracker(name: keyof Trackers, options: TrackerOptions): void {
method startSession (line 337) | startSession(videoUrl: string): Promise<string | null> {
method closeSession (line 361) | closeSession(): void {
method logAnnotations (line 365) | logAnnotations(): void {
method createTracklet (line 369) | createTracklet(): Promise<BaseTracklet> {
method deleteTracklet (line 384) | deleteTracklet(trackletId: number): Promise<void> {
method updatePoints (line 401) | updatePoints(
method clearPointsInFrame (line 423) | clearPointsInFrame(objectId: number) {
method clearPointsInVideo (line 430) | clearPointsInVideo(): Promise<boolean> {
method streamMasks (line 445) | streamMasks(): void {
method abortStreamMasks (line 451) | abortStreamMasks(): Promise<void> {
method getWorker_ONLY_USE_WITH_CAUTION (line 470) | getWorker_ONLY_USE_WITH_CAUTION(): Worker {
method sendRequest (line 481) | protected sendRequest<T extends VideoWorkerRequest | TrackerRequest>(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerContext.ts
function getEvenlySpacedItems (line 57) | function getEvenlySpacedItems(decodedVideo: DecodedVideo, x: number) {
type FrameInfo (line 71) | type FrameInfo = {
constant WATERMARK_BOX_HORIZONTAL_PADDING (line 76) | const WATERMARK_BOX_HORIZONTAL_PADDING = 10;
constant WATERMARK_BOX_VERTICAL_PADDING (line 77) | const WATERMARK_BOX_VERTICAL_PADDING = 10;
type VideoStats (line 79) | type VideoStats = {
class VideoWorkerContext (line 90) | class VideoWorkerContext {
method width (line 111) | public get width(): number {
method height (line 115) | public get height(): number {
method frameIndex (line 119) | public get frameIndex(): number {
method currentFrame (line 123) | public get currentFrame(): VideoFrame | null {
method constructor (line 127) | constructor() {
method initializeWebGLContext (line 138) | private initializeWebGLContext(width: number, height: number): void {
method setCanvas (line 199) | public setCanvas(canvas: OffscreenCanvas) {
method setSource (line 208) | public setSource(src: string) {
method goToFrame (line 218) | public goToFrame(index: number): void {
method play (line 225) | public play(): void {
method pause (line 269) | public pause(): void {
method stop (line 274) | public stop(): void {
method createFilmstrip (line 279) | public async createFilmstrip(width: number, height: number): Promise<v...
method setEffect (line 329) | public async setEffect(
method encode (line 384) | async encode() {
method _framesGenerator (line 420) | private async *_framesGenerator(
method enableStats (line 445) | public enableStats() {
method allowEffectAnimation (line 456) | public allowEffectAnimation(
method close (line 476) | public close(): void {
method updateTracklets (line 487) | public updateTracklets(
method clearTrackletMasks (line 498) | public clearTrackletMasks(tracklet: Tracklet): void {
method clearMasks (line 502) | public clearMasks(): void {
method sendResponse (line 508) | private sendResponse<T extends VideoWorkerResponse>(
method _decodeVideo (line 524) | private async _decodeVideo(src: string): Promise<void> {
method _drawFrame (line 605) | private _drawFrame(): void {
method _drawFrameImpl (line 611) | private async _drawFrameImpl(
method _drawWatermark (line 722) | private _drawWatermark(form: CanvasForm, frameBitmap: ImageBitmap): vo...
method updateFrameIndex (line 769) | private updateFrameIndex(index: number): void {
method _loadWatermarkFonts (line 776) | private _loadWatermarkFonts() {
method updatePlayback (line 794) | private updatePlayback(playing: boolean): void {
method _cancelRender (line 803) | private _cancelRender(): void {
method _sendRenderingError (line 814) | private _sendRenderingError(error: Error): void {
method _processEffects (line 820) | private _processEffects(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerTypes.ts
type Request (line 29) | type Request<A, P> = {
type SetCanvasRequest (line 35) | type SetCanvasRequest = Request<
type SetSourceRequest (line 41) | type SetSourceRequest = Request<
type PlayRequest (line 47) | type PlayRequest = Request<'play', unknown>;
type PauseRequest (line 48) | type PauseRequest = Request<'pause', unknown>;
type StopRequest (line 49) | type StopRequest = Request<'stop', unknown>;
type FrameUpdateRequest (line 50) | type FrameUpdateRequest = Request<
type FilmstripRequest (line 56) | type FilmstripRequest = Request<
type SetEffectRequest (line 63) | type SetEffectRequest = Request<
type EncodeVideoRequest (line 72) | type EncodeVideoRequest = Request<'encode', unknown>;
type EnableStatsRequest (line 74) | type EnableStatsRequest = Request<'enableStats', unknown>;
type VideoWorkerRequest (line 76) | type VideoWorkerRequest =
type VideoWorkerRequestMessageEvent (line 88) | type VideoWorkerRequestMessageEvent = MessageEvent<VideoWorkerRequest>;
type ErrorResponse (line 92) | type ErrorResponse = Request<
type DecodeResponse (line 99) | type DecodeResponse = Request<'decode', DecodeEvent>;
type EncodingStateUpdateResponse (line 101) | type EncodingStateUpdateResponse = Request<
type EncodingCompletedResponse (line 106) | type EncodingCompletedResponse = Request<
type FilmstripResponse (line 111) | type FilmstripResponse = Request<'filmstrip', FilmstripEvent>;
type PlayResponse (line 113) | type PlayResponse = Request<'play', unknown>;
type PauseResponse (line 115) | type PauseResponse = Request<'pause', unknown>;
type FrameUpdateResponse (line 117) | type FrameUpdateResponse = Request<'frameUpdate', FrameUpdateEvent>;
type RenderingErrorResponse (line 119) | type RenderingErrorResponse = Request<
type LoadStartResponse (line 126) | type LoadStartResponse = Request<'loadstart', LoadStartEvent>;
type EffectUpdateResponse (line 128) | type EffectUpdateResponse = Request<'effectUpdate', EffectUpdateEvent>;
type VideoWorkerResponse (line 130) | type VideoWorkerResponse =
type VideoWorkerResponseMessageEvent (line 143) | type VideoWorkerResponseMessageEvent = MessageEvent<VideoWorkerResponse>;
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/DemoVideoEditor.tsx
type Props (line 91) | type Props = {
function DemoVideoEditor (line 95) | function DemoVideoEditor({video: inputVideo}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/ImageUtils.ts
function convertVideoFrameToImageData (line 16) | function convertVideoFrameToImageData(
function findBoundingBox (line 34) | function findBoundingBox() {
function magnifyImageRegion (line 77) | function magnifyImageRegion(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/VideoEditor.tsx
constant MAX_VIDEO_WIDTH (line 23) | const MAX_VIDEO_WIDTH = 1280;
type InteractionLayerProps (line 68) | type InteractionLayerProps = {
type ControlsProps (line 73) | type ControlsProps = {
type Props (line 81) | type Props = PropsWithChildren<{
function VideoEditor (line 87) | function VideoEditor({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/VideoEditorUtils.ts
function getCanvas (line 24) | function getCanvas(
function drawFrame (line 38) | function drawFrame(
function getThumbnailImageDataOld (line 50) | function getThumbnailImageDataOld(
function getThumbnailImageData (line 102) | function getThumbnailImageData(
function generateThumbnail (line 129) | async function generateThumbnail(
function getDataURLFromImageData (line 156) | async function getDataURLFromImageData(
function hexToRgb (line 194) | function hexToRgb(hex: string): {
function getPointInImage (line 213) | function getPointInImage(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useResetEditor.ts
type State (line 32) | type State = {
function useResetEditor (line 38) | function useResetEditor(): State {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useVideo.ts
function useVideo (line 19) | function useVideo() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useVideoEffect.ts
function useVideoEffect (line 27) | function useVideoEffect() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/ArrowGLEffect.ts
class ArrowGLEffect (line 29) | class ArrowGLEffect extends BaseGLEffect {
method constructor (line 36) | constructor() {
method setupUniforms (line 42) | protected setupUniforms(
method apply (line 53) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BackgroundBlurEffect.ts
class BackgroundBlurEffect (line 27) | class BackgroundBlurEffect extends BaseGLEffect {
method constructor (line 30) | constructor() {
method setupUniforms (line 37) | protected setupUniforms(
method apply (line 50) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BackgroundTextEffect.ts
class BackgroundTextEffect (line 21) | class BackgroundTextEffect extends AbstractEffect {
method constructor (line 22) | constructor() {
method apply (line 26) | apply(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BaseGLEffect.ts
method setup (line 36) | async setup(init: EffectInit): Promise<void> {
method apply (line 78) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Trackle...
method cleanup (line 111) | async cleanup(): Promise<void> {
method setupBuffers (line 132) | protected setupBuffers(gl: WebGL2RenderingContext) {
method setupUniforms (line 154) | protected setupUniforms(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BurstGLEffect.ts
class BurstGLEffect (line 30) | class BurstGLEffect extends BaseGLEffect {
method constructor (line 38) | constructor() {
method setupUniforms (line 44) | protected setupUniforms(
method apply (line 58) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 157) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/CutoutGLEffect.ts
class CutoutGLEffect (line 29) | class CutoutGLEffect extends BaseGLEffect {
method constructor (line 37) | constructor() {
method setupUniforms (line 43) | protected setupUniforms(
method apply (line 57) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 132) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/DesaturateEffect.ts
class DesaturateEffect (line 20) | class DesaturateEffect extends AbstractEffect {
method constructor (line 21) | constructor() {
method apply (line 25) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/Effect.ts
type EffectLayers (line 21) | type EffectLayers = {
type EffectOptions (line 26) | type EffectOptions = {
type EffectInit (line 30) | type EffectInit = {
type EffectMask (line 37) | type EffectMask = {
type EffectActionPoint (line 42) | type EffectActionPoint = {
type EffectFrameContext (line 47) | type EffectFrameContext = {
type Effect (line 60) | interface Effect {
method constructor (line 78) | constructor(numVariants: number) {
method nextVariant (line 83) | nextVariant() {
method setup (line 88) | async setup(_init: EffectInit): Promise<void> {
method update (line 92) | async update(options: EffectOptions): Promise<void> {
method cleanup (line 96) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/EffectUtils.ts
type MaskCanvas (line 20) | type MaskCanvas = {
type DemoEffect (line 45) | type DemoEffect = {
function copyCanvasContent (line 91) | function copyCanvasContent(
function isInvalidMask (line 103) | function isInvalidMask(bound: number[][] | Group) {
type MaskRenderingData (line 112) | type MaskRenderingData = {
class EffectLayer (line 118) | class EffectLayer {
method constructor (line 124) | constructor(context: EffectFrameContext) {
method image (line 133) | image(source: CanvasImageSourceWebCodecs) {
method filter (line 137) | filter(filterString: string) {
method composite (line 141) | composite(blend: GlobalCompositeOperation) {
method fill (line 145) | fill(color: string) {
method clear (line 150) | clear() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/Effects.ts
type Effects (line 36) | type Effects = {
type EffectIndex (line 88) | enum EffectIndex {
type EffectComboItem (line 93) | type EffectComboItem = {name: keyof Effects; variant: number};
type EffectsCombo (line 95) | type EffectsCombo = [EffectComboItem, EffectComboItem];
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/EraseBackgroundEffect.ts
class EraseBackgroundEffect (line 20) | class EraseBackgroundEffect extends AbstractEffect {
method constructor (line 21) | constructor() {
method apply (line 25) | apply(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/EraseForegroundEffect.ts
class EraseForegroundEffect (line 21) | class EraseForegroundEffect extends AbstractEffect {
method constructor (line 22) | constructor() {
method apply (line 26) | apply(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/EraseForegroundGLEffect.ts
class EraseForegroundGLEffect (line 29) | class EraseForegroundGLEffect extends BaseGLEffect {
method constructor (line 35) | constructor() {
method setupUniforms (line 41) | protected setupUniforms(
method apply (line 55) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 116) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/GradientEffect.ts
class GradientEffect (line 28) | class GradientEffect extends BaseGLEffect {
method constructor (line 35) | constructor() {
method setupUniforms (line 42) | protected setupUniforms(
method apply (line 63) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/NoisyMaskEffect.ts
class NoisyMaskEffect (line 28) | class NoisyMaskEffect extends BaseGLEffect {
method constructor (line 33) | constructor() {
method setupUniforms (line 39) | protected setupUniforms(
method apply (line 56) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/OriginalEffect.ts
class OriginalEffect (line 20) | class OriginalEffect extends AbstractEffect {
method constructor (line 21) | constructor() {
method apply (line 25) | apply(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/OverlayEffect.ts
class OverlayEffect (line 33) | class OverlayEffect extends BaseGLEffect {
method constructor (line 43) | constructor() {
method setupUniforms (line 49) | protected setupUniforms(
method apply (line 63) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 174) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/PixelateEffect.ts
class PixelateEffect (line 27) | class PixelateEffect extends BaseGLEffect {
method constructor (line 30) | constructor() {
method setupUniforms (line 37) | protected setupUniforms(
method apply (line 47) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/PixelateMaskGLEffect.ts
class PixelateMaskGLEffect (line 29) | class PixelateMaskGLEffect extends BaseGLEffect {
method constructor (line 37) | constructor() {
method setupUniforms (line 43) | protected setupUniforms(
method apply (line 57) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 132) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/ReplaceGLEffect.ts
class ReplaceGLEffect (line 32) | class ReplaceGLEffect extends BaseGLEffect {
method constructor (line 43) | constructor() {
method setupUniforms (line 49) | protected async setupUniforms(
method apply (line 88) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 178) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/ScopeGLEffect.ts
class ScopeGLEffect (line 30) | class ScopeGLEffect extends BaseGLEffect {
method constructor (line 38) | constructor() {
method setupUniforms (line 44) | protected setupUniforms(
method apply (line 58) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 161) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/SobelEffect.ts
class SobelEffect (line 27) | class SobelEffect extends BaseGLEffect {
method constructor (line 28) | constructor() {
method setupUniforms (line 35) | protected setupUniforms(
method apply (line 43) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/VibrantMaskEffect.ts
class VibrantMaskEffect (line 33) | class VibrantMaskEffect extends BaseGLEffect {
method constructor (line 48) | constructor() {
method setupUniforms (line 54) | protected setupUniforms(
method apply (line 87) | apply(form: CanvasForm, context: EffectFrameContext, _tracklets: Track...
method cleanup (line 166) | async cleanup(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/filmstrip/FilmstripUtil.tsx
function getPointerPosition (line 20) | function getPointerPosition(
function drawFilmstrip (line 27) | function drawFilmstrip(
function getTimeFromFrame (line 48) | function getTimeFromFrame(frame: number, fps: number): string {
function drawMarker (line 54) | function drawMarker(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/filmstrip/SelectedFrameHelper.ts
class SelectedFrameHelper (line 16) | class SelectedFrameHelper {
method constructor (line 22) | constructor(totalFrames: number, totalWidth: number, index?: number) {
method reset (line 26) | reset(totalFrames: number, totalWidth: number, index?: number) {
method select (line 34) | select(index: number) {
method toPosition (line 38) | toPosition(index: number) {
method toIndex (line 42) | toIndex(position: number) {
method index (line 46) | get index(): number {
method position (line 50) | get position(): number {
method scan (line 54) | scan(state: boolean) {
method isScanning (line 58) | get isScanning(): boolean {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/filmstrip/VideoFilmstrip.tsx
constant PADDING_TOP (line 60) | const PADDING_TOP = 30;
constant PADDING_BOTTOM (line 61) | const PADDING_BOTTOM = 0;
function VideoFilmstrip (line 63) | function VideoFilmstrip() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/filmstrip/useDisableScrolling.ts
function preventDefault (line 18) | function preventDefault(event: TouchEvent) {
function useDisableScrolling (line 22) | function useDisableScrolling() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/filmstrip/useSelectedFrameHelper.ts
function useSelectedFrameHelper (line 19) | function useSelectedFrameHelper() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/layers/InteractionLayer.tsx
type Props (line 34) | type Props = {
function InteractionLayer (line 38) | function InteractionLayer({onPoint}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/layers/PointsLayer.tsx
type Props (line 31) | type Props = {
function PointsLayer (line 36) | function PointsLayer({points, onRemovePoint}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/useInputVideo.ts
function useInputVideo (line 19) | function useInputVideo() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/useVideoWorker.ts
type Options (line 19) | type Options = {
constant DEFAULT_OPTIONS (line 24) | const DEFAULT_OPTIONS: Options = {
type WorkerFactory (line 31) | type WorkerFactory = () => Worker;
type CreateWorkerBridgeFunction (line 33) | type CreateWorkerBridgeFunction = (
function useVideoWorker (line 37) | function useVideoWorker(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/error/ErrorFallback.tsx
function ErrorFallback (line 20) | function ErrorFallback({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/error/ErrorReport.tsx
type Props (line 25) | type Props = {
function ErrorReport (line 29) | function ErrorReport({onReport = emptyFunction}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/error/ErrorSerializationUtils.ts
function registerSerializableConstructors (line 21) | function registerSerializableConstructors() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/error/ErrorUtils.ts
type RenderingErrorType (line 21) | type RenderingErrorType =
function getRenderErrorType (line 27) | function getRenderErrorType(error?: ErrorObject): RenderingErrorType {
function getErrorTitle (line 55) | function getErrorTitle({message}: Error): string {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/error/useReportError.tsx
function useReportError (line 20) | function useReportError() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/loading/LoadingMessage.tsx
function LoadingMessage (line 18) | function LoadingMessage() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/loading/LoadingStateScreen.tsx
type Props (line 75) | type Props = PropsWithChildren<{
function LoadingStateScreen (line 84) | function LoadingStateScreen({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/loading/StaticVideoPlayer.tsx
type VideoAspectRatio (line 18) | type VideoAspectRatio = 'wide' | 'square' | 'normal' | 'fill';
type VideoProps (line 20) | type VideoProps = {
function StaticVideoPlayer (line 27) | function StaticVideoPlayer({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/loading/UploadLoadingScreen.tsx
function UploadLoadingScreen (line 24) | function UploadLoadingScreen() {
function UploadLoadingScreenChangeVideoTrigger (line 49) | function UploadLoadingScreenChangeVideoTrigger({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/logger/DemoLogger.ts
type UploadSourceType (line 19) | type UploadSourceType = 'gallery' | 'option';
type DemoEventMap (line 22) | type DemoEventMap = {
type LoggerInterface (line 87) | interface LoggerInterface<TEventMap> {
function initialize (line 94) | function initialize(): void {
class DemoLogger (line 98) | class DemoLogger implements LoggerInterface<DemoEventMap> {
method event (line 99) | event<K extends keyof DemoEventMap>(eventName: K, options?: DemoEventM...
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/logger/LogEnvironment.ts
constant LOG_LEVEL (line 20) | const LOG_LEVEL: LogLevel =
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/logger/Logger.ts
type LogFn (line 19) | type LogFn = {
type Logger (line 24) | interface Logger {
type LogLevel (line 32) | type LogLevel = 'info' | 'warn' | 'error' | 'debug';
class ConsoleLogger (line 37) | class ConsoleLogger implements Logger {
method constructor (line 43) | constructor(options?: {level?: LogLevel}) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/screen/useScreenSize.tsx
function useScreenSize (line 19) | function useScreenSize(): {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/SAM2Model.ts
type Options (line 66) | type Options = Pick<TrackerOptions, 'inferenceEndpoint'>;
type Session (line 68) | type Session = {
type StreamMasksResult (line 73) | type StreamMasksResult = {
type StreamMasksAbortResult (line 81) | type StreamMasksAbortResult = {
class SAM2Model (line 85) | class SAM2Model extends Tracker {
method constructor (line 103) | constructor(
method startSession (line 119) | public startSession(videoPath: string): Promise<void> {
method closeSession (line 171) | public closeSession(): Promise<void> {
method createTracklet (line 212) | public createTracklet(): void {
method deleteTracklet (line 240) | public deleteTracklet(trackletId: number): Promise<void> {
method updatePoints (line 298) | public updatePoints(
method clearPointsInFrame (line 383) | public clearPointsInFrame(
method clearPointsInVideo (line 441) | public clearPointsInVideo(): Promise<void> {
method streamMasks (line 497) | public async streamMasks(frameIndex: number): Promise<void> {
method abortStreamMasks (line 546) | public abortStreamMasks() {
method enableStats (line 551) | public enableStats(): void {
method _cleanup (line 557) | private _cleanup() {
method _clearTracklets (line 563) | private _clearTracklets() {
method _updateStreamingState (line 568) | private _updateStreamingState(
method _removeTrackletMasks (line 581) | private async _removeTrackletMasks(tracklet: Tracklet) {
method _updateTrackletMasks (line 590) | private async _updateTrackletMasks(
method _updateTracklets (line 640) | private _updateTracklets() {
method _clearTrackletMasks (line 672) | private _clearTrackletMasks() {
method _compressMaskForCanvas (line 682) | private async _compressMaskForCanvas(
method _streamMasksForSession (line 717) | private async *_streamMasksForSession(
method _abortRequest (line 793) | private async _abortRequest(): Promise<void> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/Tracker.ts
type Point (line 22) | type Point = [x: number, y: number];
type SegmentationPoint (line 24) | type SegmentationPoint = [...point: Point, label: 0 | 1];
type FramePoints (line 26) | type FramePoints = Array<SegmentationPoint> | undefined;
type Mask (line 28) | type Mask = DatalessMask & {
type DatalessMask (line 32) | type DatalessMask = {
type Tracklet (line 38) | type Tracklet = {
type BaseTracklet (line 47) | type BaseTracklet = Omit<Tracklet, 'masks'> & {
type StreamingState (line 51) | type StreamingState =
type ITracker (line 60) | interface ITracker {
method constructor (line 79) | constructor(context: VideoWorkerContext, _options?: TrackerOptions) {
method _sendResponse (line 102) | protected _sendResponse<T extends TrackerResponse>(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/TrackerTypes.ts
type Flags (line 31) | type Flags = {
type Request (line 36) | type Request<A, P> = {
type InitializeTrackerRequest (line 42) | type InitializeTrackerRequest = Request<
type StartSessionRequest (line 49) | type StartSessionRequest = Request<
type CloseSessionRequest (line 55) | type CloseSessionRequest = Request<'closeSession', unknown>;
type CreateTrackletRequest (line 56) | type CreateTrackletRequest = Request<'createTracklet', unknown>;
type DeleteTrackletRequest (line 57) | type DeleteTrackletRequest = Request<
type UpdatePointsRequest (line 63) | type UpdatePointsRequest = Request<
type ClearPointsInFrameRequest (line 71) | type ClearPointsInFrameRequest = Request<
type ClearPointsInVideoRequest (line 78) | type ClearPointsInVideoRequest = Request<'clearPointsInVideo', unknown>;
type StreamMasksRequest (line 79) | type StreamMasksRequest = Request<
type AbortStreamMasksRequest (line 85) | type AbortStreamMasksRequest = Request<'abortStreamMasks', unknown>;
type LogAnnotationsRequest (line 87) | type LogAnnotationsRequest = Request<'logAnnotations', unknown>;
type TrackerRequest (line 89) | type TrackerRequest =
type TrackerRequestMessageEvent (line 102) | type TrackerRequestMessageEvent = MessageEvent<TrackerRequest>;
type SessionStartedResponse (line 106) | type SessionStartedResponse = Request<
type SessionStartFailedResponse (line 111) | type SessionStartFailedResponse = Request<
type TrackletCreatedResponse (line 116) | type TrackletCreatedResponse = Request<
type TrackletsUpdatedResponse (line 121) | type TrackletsUpdatedResponse = Request<
type TrackletDeletedResponse (line 126) | type TrackletDeletedResponse = Request<
type AddPointsResponse (line 131) | type AddPointsResponse = Request<'addPoints', AddPointsEvent>;
type ClearPointsInVideoResponse (line 133) | type ClearPointsInVideoResponse = Request<
type StreamingStartedResponse (line 138) | type StreamingStartedResponse = Request<
type StreamingCompletedResponse (line 143) | type StreamingCompletedResponse = Request<
type StreamingStateUpdateResponse (line 148) | type StreamingStateUpdateResponse = Request<
type TrackerResponse (line 153) | type TrackerResponse =
type TrackerResponseMessageEvent (line 165) | type TrackerResponseMessageEvent = MessageEvent<TrackerResponse>;
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/Trackers.ts
type Headers (line 18) | type Headers = {[name: string]: string};
type TrackerOptions (line 20) | type TrackerOptions = {
type Trackers (line 24) | type Trackers = {
constant TRACKER_MAPPING (line 28) | const TRACKER_MAPPING: Trackers = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelAddNewPointsMutation.graphql.ts
type AddPointsInput (line 12) | type AddPointsInput = {
type SAM2ModelAddNewPointsMutation$variables (line 20) | type SAM2ModelAddNewPointsMutation$variables = {
type SAM2ModelAddNewPointsMutation$data (line 23) | type SAM2ModelAddNewPointsMutation$data = {
type SAM2ModelAddNewPointsMutation (line 35) | type SAM2ModelAddNewPointsMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelCancelPropagateInVideoMutation.graphql.ts
type CancelPropagateInVideoInput (line 12) | type CancelPropagateInVideoInput = {
type SAM2ModelCancelPropagateInVideoMutation$variables (line 15) | type SAM2ModelCancelPropagateInVideoMutation$variables = {
type SAM2ModelCancelPropagateInVideoMutation$data (line 18) | type SAM2ModelCancelPropagateInVideoMutation$data = {
type SAM2ModelCancelPropagateInVideoMutation (line 23) | type SAM2ModelCancelPropagateInVideoMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelClearPointsInFrameMutation.graphql.ts
type ClearPointsInFrameInput (line 12) | type ClearPointsInFrameInput = {
type SAM2ModelClearPointsInFrameMutation$variables (line 17) | type SAM2ModelClearPointsInFrameMutation$variables = {
type SAM2ModelClearPointsInFrameMutation$data (line 20) | type SAM2ModelClearPointsInFrameMutation$data = {
type SAM2ModelClearPointsInFrameMutation (line 32) | type SAM2ModelClearPointsInFrameMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelClearPointsInVideoMutation.graphql.ts
type ClearPointsInVideoInput (line 12) | type ClearPointsInVideoInput = {
type SAM2ModelClearPointsInVideoMutation$variables (line 15) | type SAM2ModelClearPointsInVideoMutation$variables = {
type SAM2ModelClearPointsInVideoMutation$data (line 18) | type SAM2ModelClearPointsInVideoMutation$data = {
type SAM2ModelClearPointsInVideoMutation (line 23) | type SAM2ModelClearPointsInVideoMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelCloseSessionMutation.graphql.ts
type CloseSessionInput (line 12) | type CloseSessionInput = {
type SAM2ModelCloseSessionMutation$variables (line 15) | type SAM2ModelCloseSessionMutation$variables = {
type SAM2ModelCloseSessionMutation$data (line 18) | type SAM2ModelCloseSessionMutation$data = {
type SAM2ModelCloseSessionMutation (line 23) | type SAM2ModelCloseSessionMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelRemoveObjectMutation.graphql.ts
type RemoveObjectInput (line 12) | type RemoveObjectInput = {
type SAM2ModelRemoveObjectMutation$variables (line 16) | type SAM2ModelRemoveObjectMutation$variables = {
type SAM2ModelRemoveObjectMutation$data (line 19) | type SAM2ModelRemoveObjectMutation$data = {
type SAM2ModelRemoveObjectMutation (line 31) | type SAM2ModelRemoveObjectMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/tracker/__generated__/SAM2ModelStartSessionMutation.graphql.ts
type StartSessionInput (line 12) | type StartSessionInput = {
type SAM2ModelStartSessionMutation$variables (line 15) | type SAM2ModelStartSessionMutation$variables = {
type SAM2ModelStartSessionMutation$data (line 18) | type SAM2ModelStartSessionMutation$data = {
type SAM2ModelStartSessionMutation (line 23) | type SAM2ModelStartSessionMutation = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/FileUtils.ts
type Range (line 18) | type Range = {
type FileStreamPart (line 23) | type FileStreamPart = {
type FileStream (line 29) | type FileStream = AsyncGenerator<FileStreamPart, File | null, null>;
function hashBlob (line 41) | async function hashBlob(blob: Blob): Promise<string> {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/ImageUtils.ts
function convertVideoFrameToImageData (line 16) | function convertVideoFrameToImageData(
function findBoundingBox (line 34) | function findBoundingBox() {
function magnifyImageRegion (line 77) | function magnifyImageRegion(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/MaskUtils.ts
function convertMaskToRGBA (line 30) | function convertMaskToRGBA(data: Uint8Array): Uint8ClampedArray {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/MultipartStream.ts
constant STATE_BOUNDARY (line 20) | const STATE_BOUNDARY = 0;
constant STATE_HEADERS (line 21) | const STATE_HEADERS = 1;
constant STATE_BODY (line 22) | const STATE_BODY = 2;
function compareArrays (line 30) | function compareArrays(a: Uint8Array, b: Uint8Array): boolean {
function getBoundary (line 47) | function getBoundary(contentType: string): Uint8Array | null {
function multipartStream (line 70) | function multipartStream(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/ShaderUtils.ts
function load3DLUT (line 25) | function load3DLUT(
function generateLUTDATA (line 62) | function generateLUTDATA(lutSize: number) {
function normalizeBounds (line 84) | function normalizeBounds(
function preAllocateTextures (line 104) | function preAllocateTextures(
function findIndexByTrackletId (line 130) | function findIndexByTrackletId(id: number, objects: Tracklet[]): number {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/common/utils/uuid.ts
function uuidv4 (line 32) | function uuidv4() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/debug/stats/Stats.ts
type Request (line 24) | type Request<A, P> = {
type Response (line 28) | type Response<A, P> = Request<A, P>;
type GetStatsCanvasRequest (line 30) | type GetStatsCanvasRequest = Request<
type GetMemoryStatsRequest (line 39) | type GetMemoryStatsRequest = Request<
type SetStatsCanvasResponse (line 49) | type SetStatsCanvasResponse = Response<
type MemoryStatsResponse (line 58) | type MemoryStatsResponse = Response<
type StatsType (line 68) | type StatsType = 'fps' | 'ms' | 'memory';
class Stats (line 70) | class Stats {
method constructor (line 80) | constructor(type: StatsType, label: string = '', maxValue: number = 10...
method updateMaxValue (line 130) | updateMaxValue(maxValue: number) {
method begin (line 134) | begin() {
method end (line 138) | end() {
method update (line 176) | update() {
class Panel (line 181) | class Panel {
method constructor (line 206) | constructor(
method update (line 269) | update(value: number, maxValue: number) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/debug/stats/StatsView.tsx
constant URL_PARAM (line 43) | const URL_PARAM = 'monitors';
function StatsView (line 45) | function StatsView() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/demo/DemoConfig.tsx
type EffectLayers (line 18) | type EffectLayers = {
constant DEMO_SHORT_NAME (line 23) | const DEMO_SHORT_NAME = 'SAM 2 Demo';
constant RESEARCH_BY_META_AI (line 24) | const RESEARCH_BY_META_AI = 'By Meta FAIR';
constant DEMO_FRIENDLY_NAME (line 25) | const DEMO_FRIENDLY_NAME = 'Segment Anything 2 Demo';
constant VIDEO_WATERMARK_TEXT (line 26) | const VIDEO_WATERMARK_TEXT = `Modified with ${DEMO_FRIENDLY_NAME}`;
constant PROJECT_GITHUB_URL (line 27) | const PROJECT_GITHUB_URL =
constant AIDEMOS_URL (line 29) | const AIDEMOS_URL = 'https://aidemos.meta.com';
constant ABOUT_URL (line 30) | const ABOUT_URL = 'https://ai.meta.com/sam2';
constant EMAIL_ADDRESS (line 31) | const EMAIL_ADDRESS = 'segment-anything@meta.com';
constant BLOG_URL (line 32) | const BLOG_URL = 'http://ai.meta.com/blog/sam2';
constant VIDEO_API_ENDPOINT (line 34) | const VIDEO_API_ENDPOINT = 'http://localhost:7263';
constant INFERENCE_API_ENDPOINT (line 35) | const INFERENCE_API_ENDPOINT = 'http://localhost:7263';
constant DEFAULT_EFFECT_LAYERS (line 39) | const DEFAULT_EFFECT_LAYERS: EffectLayers = {
constant MAX_UPLOAD_FILE_SIZE (line 44) | const MAX_UPLOAD_FILE_SIZE = '70MB';
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/demo/DemoErrorFallback.tsx
function DemoErrorFallback (line 19) | function DemoErrorFallback(_props: FallbackProps) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/demo/DemoSuspenseFallback.tsx
function DemoSuspenseFallback (line 18) | function DemoSuspenseFallback() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/demo/SAM2DemoApp.tsx
function DemoAppWrapper (line 27) | function DemoAppWrapper() {
function DemoApp (line 39) | function DemoApp() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/demo/atoms.ts
type VideoData (line 33) | type VideoData = {
type Session (line 50) | type Session = {
type TrackletMask (line 73) | type TrackletMask = {
type TrackletObject (line 78) | type TrackletObject = {
constant MAX_NUMBER_TRACKLET_OBJECTS (line 87) | const MAX_NUMBER_TRACKLET_OBJECTS = 3;
type EffectConfig (line 144) | type EffectConfig = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/RelayEnvironment.ts
function createFetchRelay (line 33) | function createFetchRelay(endpoint: string): FetchFunction {
function createEnvironment (line 47) | function createEnvironment(endpoint: string): Environment {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/RelayEnvironmentProvider.tsx
type Props (line 30) | type Props = PropsWithChildren<{
function OnevisionRelayEnvironmentProvider (line 36) | function OnevisionRelayEnvironmentProvider({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/errors/CreateFilmstripError.ts
class CreateFilmstripError (line 16) | class CreateFilmstripError extends Error {
method constructor (line 18) | constructor(message?: string) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/errors/DrawFrameError.ts
class DrawFrameError (line 16) | class DrawFrameError extends Error {
method constructor (line 18) | constructor(message?: string) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/errors/WebGLContextError.ts
class WebGLContextError (line 16) | class WebGLContextError extends Error {
method constructor (line 18) | constructor(message?: string) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/graphql/fetchGraphQL.ts
function fetchGraphQL (line 28) | async function fetchGraphQL(
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/jscocotools/mask.ts
class DataArray (line 16) | class DataArray {
method constructor (line 20) | constructor(data: Uint8Array, shape: Array<number>) {
type RLEObject (line 26) | type RLEObject = {
type RLE (line 31) | type RLE = {
type BB (line 38) | type BB = number[];
function rleInit (line 40) | function rleInit(R: RLE, h: number, w: number, m: number, cnts: number[]) {
function rlesInit (line 47) | function rlesInit(R: RLE[], n: number) {
class RLEs (line 55) | class RLEs {
method constructor (line 59) | constructor(n: number) {
class Masks (line 66) | class Masks {
method constructor (line 72) | constructor(h: number, w: number, n: number) {
method toDataArray (line 79) | toDataArray(): DataArray {
function encode (line 86) | function encode(mask: DataArray): RLEObject[] {
function decode (line 97) | function decode(rleObjs: RLEObject[]): DataArray {
function toBbox (line 107) | function toBbox(rleObjs: RLEObject[]): BB {
function rleEncode (line 115) | function rleEncode(R: RLE[], M: Uint8Array, h: number, w: number, n: num...
function rleDecode (line 144) | function rleDecode(R: RLE[], M: Uint8Array, n: number): void {
function rleToString (line 160) | function rleToString(R: RLE): string {
function _toString (line 189) | function _toString(Rs: RLEs): RLEObject[] {
function _frString (line 206) | function _frString(rleObjs: RLEObject[]): RLEs {
function rleToBbox (line 220) | function rleToBbox(R: RLE[], bb: BB, n: number) {
function rleFrString (line 269) | function rleFrString(R: RLE, s: string, h: number, w: number): void {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/layouts/DemoPageLayout.tsx
type Props (line 20) | type Props = PropsWithChildren;
function DemoPageLayout (line 44) | function DemoPageLayout({children}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/layouts/RootLayout.tsx
function RootLayout (line 54) | function RootLayout() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/routes/DemoPage.tsx
type LocationState (line 27) | type LocationState = {
function DemoPage (line 31) | function DemoPage() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/routes/DemoPageWrapper.tsx
constant REQUIRED_WINDOW_APIS (line 28) | const REQUIRED_WINDOW_APIS = ['VideoEncoder', 'VideoDecoder', 'VideoFram...
function isBrowserSupported (line 30) | function isBrowserSupported() {
function DemoPageWrapper (line 48) | function DemoPageWrapper() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/routes/PageNotFoundPage.tsx
function PageNotFoundPage (line 18) | function PageNotFoundPage() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/routes/__generated__/DemoPageQuery.graphql.ts
type DemoPageQuery$variables (line 12) | type DemoPageQuery$variables = Record<PropertyKey, never>;
type DemoPageQuery$data (line 13) | type DemoPageQuery$data = {
type DemoPageQuery (line 23) | type DemoPageQuery = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/ApprovableInput.tsx
type Props (line 21) | type Props<T extends string | number> = Omit<
function getStep (line 31) | function getStep(value: number) {
function ApprovableInput (line 42) | function ApprovableInput<T extends string | number>({
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/SAM2Settings.tsx
function SAMVSettings (line 20) | function SAMVSettings() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/SettingsContextProvider.tsx
type ContextProps (line 34) | type ContextProps = {
type Props (line 50) | type Props = PropsWithChildren;
function SettingsContextProvider (line 52) | function SettingsContextProvider({children}: Props) {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/SettingsModal.tsx
type Props (line 23) | type Props = unknown;
type Config (line 25) | type Config = {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/SettingsReducer.ts
type Settings (line 18) | type Settings = {
constant SAM2_SETTINGS_KEY (line 24) | const SAM2_SETTINGS_KEY = 'SAM2_SETTINGS_KEY';
type Action (line 26) | type Action =
constant DEFAULT_SETTINGS (line 31) | const DEFAULT_SETTINGS: Settings = {
function settingsReducer (line 36) | function settingsReducer(state: Settings, action: Action): Settings {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/settings/useSettingsContext.tsx
function useSettingsContext (line 19) | function useSettingsContext() {
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/theme/colors.ts
constant THEME_COLORS (line 16) | const THEME_COLORS = [
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/theme/gradientStyle.ts
constant BLUE_PINK_FILL (line 16) | const BLUE_PINK_FILL = 'from-[#595FEF] from-40% to-[#FB73A5]';
constant BLUE_PINK_FILL_BR (line 17) | const BLUE_PINK_FILL_BR =
FILE: auto-seg/submodules/segment-anything-2/demo/frontend/src/types/mp4box/index.d.ts
type MP4MediaTrackEdit (line 17) | interface MP4MediaTrackEdit {
type MP4MediaTrack (line 24) | interface MP4MediaTrack {
type MP4VideoData (line 45) | interface MP4VideoData {
type MP4VideoTrack (line 50) | interface MP4VideoTrack extends MP4MediaTrack {
type MP4AudioData (line 54) | interface MP4AudioData {
type MP4AudioTrack (line 60) | interface MP4AudioTrack extends MP4MediaTrack {
type MP4Track (line 64) | type MP4Track = MP4VideoTrack | MP4AudioTrack;
type MP4Info (line 66) | interface MP4Info {
type MP4Sample (line 82) | interface MP4Sample {
type MP4ArrayBuffer (line 105) | type MP4ArrayBuffer = ArrayBuffer & {fileStart: number};
class DataStream (line 107) | class DataStream {
type Trak (line 118) | interface Trak {
class Box (line 138) | class Box {
class ContainerBox (line 152) | class ContainerBox extends Box {}
class avcCBox (line 154) | class avcCBox extends ContainerBox {}
class hvcCBox (line 156) | class hvcCBox extends ContainerBox {}
class vpcCBox (line 158) | class vpcCBox extends ContainerBox {}
class av1CBox (line 160) | class av1CBox extends ContainerBox {}
type TrackOptions (line 163) | interface TrackOptions {
type SampleOptions (line 198) | interface SampleOptions {
type Sample (line 211) | interface Sample {
type MP4File (line 237) | interface MP4File {
FILE: auto-seg/submodules/segment-anything-2/sam2/automatic_mask_generator.py
class SAM2AutomaticMaskGenerator (line 36) | class SAM2AutomaticMaskGenerator:
method __init__ (line 37) | def __init__(
method from_pretrained (line 153) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2AutomaticMas...
method generate (line 170) | def generate(self, image: np.ndarray) -> List[Dict[str, Any]]:
method _generate_masks (line 224) | def _generate_masks(self, image: np.ndarray) -> MaskData:
method _process_crop (line 251) | def _process_crop(
method _process_batch (line 294) | def _process_batch(
method postprocess_small_regions (line 387) | def postprocess_small_regions(
method refine_with_m2m (line 437) | def refine_with_m2m(self, points, point_labels, low_res_masks, points_...
FILE: auto-seg/submodules/segment-anything-2/sam2/build_sam.py
function build_sam2 (line 71) | def build_sam2(
function build_sam2_video_predictor (line 100) | def build_sam2_video_predictor(
function _hf_download (line 137) | def _hf_download(model_id):
function build_sam2_hf (line 145) | def build_sam2_hf(model_id, **kwargs):
function build_sam2_video_predictor_hf (line 150) | def build_sam2_video_predictor_hf(model_id, **kwargs):
function _load_checkpoint (line 157) | def _load_checkpoint(model, ckpt_path):
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/backbones/hieradet.py
function do_pool (line 25) | def do_pool(x: torch.Tensor, pool: nn.Module, norm: nn.Module = None) ->...
class MultiScaleAttention (line 39) | class MultiScaleAttention(nn.Module):
method __init__ (line 40) | def __init__(
method forward (line 56) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class MultiScaleBlock (line 84) | class MultiScaleBlock(nn.Module):
method __init__ (line 85) | def __init__(
method forward (line 134) | def forward(self, x: torch.Tensor) -> torch.Tensor:
class Hiera (line 169) | class Hiera(nn.Module):
method __init__ (line 174) | def __init__(
method _get_pos_embed (line 273) | def _get_pos_embed(self, hw: Tuple[int, int]) -> torch.Tensor:
method forward (line 283) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
method get_layer_id (line 301) | def get_layer_id(self, layer_name):
method get_num_layers (line 316) | def get_num_layers(self) -> int:
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/backbones/image_encoder.py
class ImageEncoder (line 14) | class ImageEncoder(nn.Module):
method __init__ (line 15) | def __init__(
method forward (line 29) | def forward(self, sample: torch.Tensor):
class FpnNeck (line 45) | class FpnNeck(nn.Module):
method __init__ (line 52) | def __init__(
method forward (line 102) | def forward(self, xs: List[torch.Tensor]):
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/backbones/utils.py
function window_partition (line 16) | def window_partition(x, window_size):
function window_unpartition (line 41) | def window_unpartition(windows, window_size, pad_hw, hw):
class PatchEmbed (line 65) | class PatchEmbed(nn.Module):
method __init__ (line 70) | def __init__(
method forward (line 91) | def forward(self, x: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/memory_attention.py
class MemoryAttentionLayer (line 17) | class MemoryAttentionLayer(nn.Module):
method __init__ (line 19) | def __init__(
method _forward_sa (line 58) | def _forward_sa(self, tgt, query_pos):
method _forward_ca (line 66) | def _forward_ca(self, tgt, memory, query_pos, pos, num_k_exclude_rope=0):
method forward (line 83) | def forward(
class MemoryAttention (line 102) | class MemoryAttention(nn.Module):
method __init__ (line 103) | def __init__(
method forward (line 119) | def forward(
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/memory_encoder.py
class MaskDownSampler (line 17) | class MaskDownSampler(nn.Module):
method __init__ (line 26) | def __init__(
method forward (line 57) | def forward(self, x):
class CXBlock (line 62) | class CXBlock(nn.Module):
method __init__ (line 74) | def __init__(
method forward (line 104) | def forward(self, x):
class Fuser (line 120) | class Fuser(nn.Module):
method __init__ (line 121) | def __init__(self, layer, num_layers, dim=None, input_projection=False):
method forward (line 130) | def forward(self, x):
class MemoryEncoder (line 138) | class MemoryEncoder(nn.Module):
method __init__ (line 139) | def __init__(
method forward (line 158) | def forward(
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/position_encoding.py
class PositionEmbeddingSine (line 16) | class PositionEmbeddingSine(nn.Module):
method __init__ (line 22) | def __init__(
method _encode_xy (line 42) | def _encode_xy(self, x, y):
method encode_boxes (line 62) | def encode_boxes(self, x, y, w, h):
method encode_points (line 70) | def encode_points(self, x, y, labels):
method forward (line 79) | def forward(self, x: torch.Tensor):
class PositionEmbeddingRandom (line 115) | class PositionEmbeddingRandom(nn.Module):
method __init__ (line 120) | def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = N...
method _pe_encoding (line 129) | def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:
method forward (line 138) | def forward(self, size: Tuple[int, int]) -> torch.Tensor:
method forward_with_coords (line 151) | def forward_with_coords(
function init_t_xy (line 167) | def init_t_xy(end_x: int, end_y: int):
function compute_axial_cis (line 174) | def compute_axial_cis(dim: int, end_x: int, end_y: int, theta: float = 1...
function reshape_for_broadcast (line 186) | def reshape_for_broadcast(freqs_cis: torch.Tensor, x: torch.Tensor):
function apply_rotary_enc (line 194) | def apply_rotary_enc(
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/sam/mask_decoder.py
class MaskDecoder (line 15) | class MaskDecoder(nn.Module):
method __init__ (line 16) | def __init__(
method forward (line 110) | def forward(
method predict_masks (line 168) | def predict_masks(
method _get_stability_scores (line 247) | def _get_stability_scores(self, mask_logits):
method _dynamic_multimask_via_stability (line 259) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc...
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/sam/prompt_encoder.py
class PromptEncoder (line 17) | class PromptEncoder(nn.Module):
method __init__ (line 18) | def __init__(
method get_dense_pe (line 68) | def get_dense_pe(self) -> torch.Tensor:
method _embed_points (line 79) | def _embed_points(
method _embed_boxes (line 103) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor:
method _embed_masks (line 114) | def _embed_masks(self, masks: torch.Tensor) -> torch.Tensor:
method _get_batch_size (line 119) | def _get_batch_size(
method _get_device (line 137) | def _get_device(self) -> torch.device:
method forward (line 140) | def forward(
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/sam/transformer.py
function sdp_kernel_context (line 28) | def sdp_kernel_context(dropout_p):
class TwoWayTransformer (line 44) | class TwoWayTransformer(nn.Module):
method __init__ (line 45) | def __init__(
method forward (line 90) | def forward(
class TwoWayAttentionBlock (line 137) | class TwoWayAttentionBlock(nn.Module):
method __init__ (line 138) | def __init__(
method forward (line 181) | def forward(
class Attention (line 215) | class Attention(nn.Module):
method __init__ (line 221) | def __init__(
method _separate_heads (line 245) | def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor:
method _recombine_heads (line 250) | def _recombine_heads(self, x: Tensor) -> Tensor:
method forward (line 255) | def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor:
class RoPEAttention (line 289) | class RoPEAttention(Attention):
method __init__ (line 292) | def __init__(
method forward (line 311) | def forward(
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/sam2_base.py
class SAM2Base (line 22) | class SAM2Base(torch.nn.Module):
method __init__ (line 23) | def __init__(
method device (line 198) | def device(self):
method forward (line 201) | def forward(self, *args, **kwargs):
method _build_sam_heads (line 207) | def _build_sam_heads(self):
method _forward_sam_heads (line 257) | def _forward_sam_heads(
method _use_mask_as_output (line 415) | def _use_mask_as_output(self, backbone_features, high_res_features, ma...
method forward_image (line 467) | def forward_image(self, img_batch: torch.Tensor):
method _prepare_backbone_features (line 481) | def _prepare_backbone_features(self, backbone_out):
method _prepare_memory_conditioned_features (line 497) | def _prepare_memory_conditioned_features(
method _encode_new_memory (line 676) | def _encode_new_memory(
method _track_step (line 726) | def _track_step(
method _encode_memory_in_output (line 787) | def _encode_memory_in_output(
method track_step (line 812) | def track_step(
method _use_multimask (line 879) | def _use_multimask(self, is_init_cond_frame, point_inputs):
method _apply_non_overlapping_constraints (line 889) | def _apply_non_overlapping_constraints(self, pred_masks):
FILE: auto-seg/submodules/segment-anything-2/sam2/modeling/sam2_utils.py
function select_closest_cond_frames (line 19) | def select_closest_cond_frames(frame_idx, cond_frame_outputs, max_cond_f...
function get_1d_sine_pe (line 64) | def get_1d_sine_pe(pos_inds, dim, temperature=10000):
function get_activation_fn (line 77) | def get_activation_fn(activation):
function get_clones (line 88) | def get_clones(module, N):
class DropPath (line 92) | class DropPath(nn.Module):
method __init__ (line 94) | def __init__(self, drop_prob=0.0, scale_by_keep=True):
method forward (line 99) | def forward(self, x):
class MLP (line 112) | class MLP(nn.Module):
method __init__ (line 113) | def __init__(
method forward (line 131) | def forward(self, x):
class LayerNorm2d (line 141) | class LayerNorm2d(nn.Module):
method __init__ (line 142) | def __init__(self, num_channels: int, eps: float = 1e-6) -> None:
method forward (line 148) | def forward(self, x: torch.Tensor) -> torch.Tensor:
function sample_box_points (line 156) | def sample_box_points(
function sample_random_points_from_errors (line 202) | def sample_random_points_from_errors(gt_masks, pred_masks, num_pt=1):
function sample_one_point_from_error_center (line 252) | def sample_one_point_from_error_center(gt_masks, pred_masks, padding=True):
function get_next_point (line 317) | def get_next_point(gt_masks, pred_masks, method):
FILE: auto-seg/submodules/segment-anything-2/sam2/sam2_image_predictor.py
class SAM2ImagePredictor (line 20) | class SAM2ImagePredictor:
method __init__ (line 21) | def __init__(
method from_pretrained (line 69) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2ImagePredict...
method set_image (line 86) | def set_image(
method set_image_batch (line 132) | def set_image_batch(
method predict_batch (line 175) | def predict_batch(
method predict (line 237) | def predict(
method _prep_prompts (line 305) | def _prep_prompts(
method _predict (line 337) | def _predict(
method get_image_embedding (line 440) | def get_image_embedding(self) -> torch.Tensor:
method device (line 456) | def device(self) -> torch.device:
method reset_predictor (line 459) | def reset_predictor(self) -> None:
FILE: auto-seg/submodules/segment-anything-2/sam2/sam2_video_predictor.py
class SAM2VideoPredictor (line 18) | class SAM2VideoPredictor(SAM2Base):
method __init__ (line 21) | def __init__(
method init_state (line 41) | def init_state(
method from_pretrained (line 101) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2VideoPredict...
method _obj_id_to_idx (line 117) | def _obj_id_to_idx(self, inference_state, obj_id):
method _obj_idx_to_id (line 151) | def _obj_idx_to_id(self, inference_state, obj_idx):
method _get_obj_num (line 155) | def _get_obj_num(self, inference_state):
method add_new_points_or_box (line 160) | def add_new_points_or_box(
method add_new_points (line 294) | def add_new_points(self, *args, **kwargs):
method add_new_mask (line 299) | def add_new_mask(
method _get_orig_video_res_output (line 382) | def _get_orig_video_res_output(self, inference_state, any_res_masks):
method _consolidate_temp_output_across_obj (line 404) | def _consolidate_temp_output_across_obj(
method propagate_in_video_preflight (line 479) | def propagate_in_video_preflight(self, inference_state):
method propagate_in_video (line 545) | def propagate_in_video(
method clear_all_prompts_in_frame (line 632) | def clear_all_prompts_in_frame(
method reset_state (line 675) | def reset_state(self, inference_state):
method _reset_tracking_results (line 688) | def _reset_tracking_results(self, inference_state):
method _get_image_feature (line 703) | def _get_image_feature(self, inference_state, frame_idx, batch_size):
method _run_single_frame_inference (line 736) | def _run_single_frame_inference(
method _run_memory_encoder (line 804) | def _run_memory_encoder(
method _get_maskmem_pos_enc (line 840) | def _get_maskmem_pos_enc(self, inference_state, current_out):
method remove_object (line 866) | def remove_object(self, inference_state, obj_id, strict=False, need_ou...
method _clear_non_cond_mem_around_input (line 955) | def _clear_non_cond_mem_around_input(self, inference_state, frame_idx):
class SAM2VideoPredictorVOS (line 975) | class SAM2VideoPredictorVOS(SAM2VideoPredictor):
method __init__ (line 978) | def __init__(self, *args, **kwargs):
method _compile_all_components (line 982) | def _compile_all_components(self):
method forward_image (line 1012) | def forward_image(self, img_batch: torch.Tensor):
method _forward_sam_heads (line 1035) | def _forward_sam_heads(
method _encode_new_memory (line 1170) | def _encode_new_memory(
FILE: auto-seg/submodules/segment-anything-2/sam2/sam2_video_predictor_legacy.py
class SAM2VideoPredictor (line 17) | class SAM2VideoPredictor(SAM2Base):
method __init__ (line 20) | def __init__(
method init_state (line 43) | def init_state(
method from_pretrained (line 113) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2VideoPredict...
method _obj_id_to_idx (line 129) | def _obj_id_to_idx(self, inference_state, obj_id):
method _obj_idx_to_id (line 163) | def _obj_idx_to_id(self, inference_state, obj_idx):
method _get_obj_num (line 167) | def _get_obj_num(self, inference_state):
method add_new_points_or_box (line 172) | def add_new_points_or_box(
method add_new_points (line 315) | def add_new_points(self, *args, **kwargs):
method add_new_mask (line 320) | def add_new_mask(
method _get_orig_video_res_output (line 403) | def _get_orig_video_res_output(self, inference_state, any_res_masks):
method _consolidate_temp_output_across_obj (line 425) | def _consolidate_temp_output_across_obj(
method _get_empty_mask_ptr (line 555) | def _get_empty_mask_ptr(self, inference_state, frame_idx):
method propagate_in_video_preflight (line 592) | def propagate_in_video_preflight(self, inference_state):
method propagate_in_video (line 662) | def propagate_in_video(
method _add_output_per_object (line 746) | def _add_output_per_object(
method clear_all_prompts_in_frame (line 776) | def clear_all_prompts_in_frame(
method reset_state (line 847) | def reset_state(self, inference_state):
method _reset_tracking_results (line 859) | def _reset_tracking_results(self, inference_state):
method _get_image_feature (line 878) | def _get_image_feature(self, inference_state, frame_idx, batch_size):
method _run_single_frame_inference (line 911) | def _run_single_frame_inference(
method _run_memory_encoder (line 979) | def _run_memory_encoder(
method _get_maskmem_pos_enc (line 1015) | def _get_maskmem_pos_enc(self, inference_state, current_out):
method remove_object (line 1041) | def remove_object(self, inference_state, obj_id, strict=False, need_ou...
method _clear_non_cond_mem_around_input (line 1154) | def _clear_non_cond_mem_around_input(self, inference_state, frame_idx):
FILE: auto-seg/submodules/segment-anything-2/sam2/utils/amg.py
class MaskData (line 18) | class MaskData:
method __init__ (line 24) | def __init__(self, **kwargs) -> None:
method __setitem__ (line 31) | def __setitem__(self, key: str, item: Any) -> None:
method __delitem__ (line 37) | def __delitem__(self, key: str) -> None:
method __getitem__ (line 40) | def __getitem__(self, key: str) -> Any:
method items (line 43) | def items(self) -> ItemsView[str, Any]:
method filter (line 46) | def filter(self, keep: torch.Tensor) -> None:
method cat (line 61) | def cat(self, new_stats: "MaskData") -> None:
method to_numpy (line 74) | def to_numpy(self) -> None:
function is_box_near_crop_edge (line 80) | def is_box_near_crop_edge(
function box_xyxy_to_xywh (line 93) | def box_xyxy_to_xywh(box_xyxy: torch.Tensor) -> torch.Tensor:
function batch_iterator (line 100) | def batch_iterator(batch_size: int, *args) -> Generator[List[Any], None,...
function mask_to_rle_pytorch (line 109) | def mask_to_rle_pytorch(tensor: torch.Tensor) -> List[Dict[str, Any]]:
function rle_to_mask (line 140) | def rle_to_mask(rle: Dict[str, Any]) -> np.ndarray:
function area_from_rle (line 154) | def area_from_rle(rle: Dict[str, Any]) -> int:
function calculate_stability_score (line 158) | def calculate_stability_score(
function build_point_grid (line 181) | def build_point_grid(n_per_side: int) -> np.ndarray:
function build_all_layer_point_grids (line 191) | def build_all_layer_point_grids(
function generate_crop_boxes (line 202) | def generate_crop_boxes(
function uncrop_boxes_xyxy (line 239) | def uncrop_boxes_xyxy(boxes: torch.Tensor, crop_box: List[int]) -> torch...
function uncrop_points (line 248) | def uncrop_points(points: torch.Tensor, crop_box: List[int]) -> torch.Te...
function uncrop_masks (line 257) | def uncrop_masks(
function remove_small_regions (line 269) | def remove_small_regions(
function coco_encode_rle (line 296) | def coco_encode_rle(uncompressed_rle: Dict[str, Any]) -> Dict[str, Any]:
function batched_mask_to_box (line 305) | def batched_mask_to_box(masks: torch.Tensor) -> torch.Tensor:
FILE: auto-seg/submodules/segment-anything-2/sam2/utils/misc.py
function get_sdpa_settings (line 17) | def get_sdpa_settings():
function get_connected_components (line 47) | def get_connected_components(mask):
function mask_to_box (line 66) | def mask_to_box(masks: torch.Tensor):
function _load_img_as_tensor (line 92) | def _load_img_as_tensor(img_path, image_size):
class AsyncVideoFrameLoader (line 104) | class AsyncVideoFrameLoader:
method __init__ (line 109) | def __init__(
method __getitem__ (line 147) | def __getitem__(self, index):
method __len__ (line 168) | def __len__(self):
function load_video_frames (line 172) | def load_video_frames(
function load_video_frames_from_jpg_images (line 213) | def load_video_frames_from_jpg_images(
function load_video_frames_from_video_file (line 280) | def load_video_frames_from_video_file(
function fill_holes_in_mask_scores (line 312) | def fill_holes_in_mask_scores(mask, max_area):
function concat_points (line 341) | def concat_points(old_point_inputs, new_points, new_labels):
FILE: auto-seg/submodules/segment-anything-2/sam2/utils/transforms.py
class SAM2Transforms (line 15) | class SAM2Transforms(nn.Module):
method __init__ (line 16) | def __init__(
method __call__ (line 37) | def __call__(self, x):
method forward_batch (line 41) | def forward_batch(self, img_list):
method transform_coords (line 46) | def transform_coords(
method transform_boxes (line 66) | def transform_boxes(
method postprocess_masks (line 76) | def postprocess_masks(self, masks: torch.Tensor, orig_hw) -> torch.Ten...
FILE: auto-seg/submodules/segment-anything-2/sav_dataset/utils/sav_utils.py
function decode_video (line 16) | def decode_video(video_path: str) -> List[np.ndarray]:
function show_anns (line 32) | def show_anns(masks, colors: List, borders=True) -> None:
class SAVDataset (line 63) | class SAVDataset:
method __init__ (line 68) | def __init__(self, sav_dir, annot_sample_rate=4):
method read_frames (line 80) | def read_frames(self, mp4_path: str) -> None:
method get_frames_and_annotations (line 101) | def get_frames_and_annotations(
method visualize_annotation (line 131) | def visualize_annotation(
FILE: auto-seg/submodules/segment-anything-2/setup.py
function get_extensions (line 86) | def get_extensions():
class BuildExtensionIgnoreErrors (line 117) | class BuildExtensionIgnoreErrors(BuildExtension):
method finalize_options (line 119) | def finalize_options(self):
method build_extensions (line 126) | def build_extensions(self):
method get_ext_filename (line 133) | def get_ext_filename(self, ext_name):
FILE: auto-seg/submodules/segment-anything-2/tools/vos_inference.py
function load_ann_png (line 21) | def load_ann_png(path):
function save_ann_png (line 29) | def save_ann_png(path, mask, palette):
function get_per_obj_mask (line 38) | def get_per_obj_mask(mask):
function put_per_obj_mask (line 46) | def put_per_obj_mask(per_obj_mask, height, width):
function load_masks_from_dir (line 57) | def load_masks_from_dir(
function save_masks_to_dir (line 84) | def save_masks_to_dir(
function vos_inference (line 118) | def vos_inference(
function vos_separate_inference_per_object (line 249) | def vos_separate_inference_per_object(
function main (line 367) | def main():
FILE: auto-seg/submodules/segment-anything-2/training/dataset/sam2_datasets.py
class MixedDataLoader (line 18) | class MixedDataLoader:
method __init__ (line 19) | def __init__(self, dataloaders: List[DataLoader], mixing_prob: torch.F...
method __len__ (line 34) | def __len__(self):
method __iter__ (line 37) | def __iter__(self):
method __next__ (line 44) | def __next__(self):
class TorchTrainMixedDataset (line 70) | class TorchTrainMixedDataset:
method __init__ (line 71) | def __init__(
method _set_dataset_epoch (line 129) | def _set_dataset_epoch(self, dataset, epoch: int) -> None:
method get_loader (line 135) | def get_loader(self, epoch) -> Iterable:
FILE: auto-seg/submodules/segment-anything-2/training/dataset/transforms.py
function hflip (line 27) | def hflip(datapoint, index):
function get_size_with_aspect_ratio (line 37) | def get_size_with_aspect_ratio(image_size, size, max_size=None):
function resize (line 58) | def resize(datapoint, index, size, max_size=None, square=False, v2=False):
function pad (line 104) | def pad(datapoint, index, padding, v2=False):
class RandomHorizontalFlip (line 140) | class RandomHorizontalFlip:
method __init__ (line 141) | def __init__(self, consistent_transform, p=0.5):
method __call__ (line 145) | def __call__(self, datapoint, **kwargs):
class RandomResizeAPI (line 157) | class RandomResizeAPI:
method __init__ (line 158) | def __init__(
method __call__ (line 170) | def __call__(self, datapoint, **kwargs):
class ToTensorAPI (line 186) | class ToTensorAPI:
method __init__ (line 187) | def __init__(self, v2=False):
method __call__ (line 190) | def __call__(self, datapoint: VideoDatapoint, **kwargs):
class NormalizeAPI (line 199) | class NormalizeAPI:
method __init__ (line 200) | def __init__(self, mean, std, v2=False):
method __call__ (line 205) | def __call__(self, datapoint: VideoDatapoint, **kwargs):
class ComposeAPI (line 216) | class ComposeAPI:
method __init__ (line 217) | def __init__(self, transforms):
method __call__ (line 220) | def __call__(self, datapoint, **kwargs):
method __repr__ (line 225) | def __repr__(self):
class RandomGrayscale (line 234) | class RandomGrayscale:
method __init__ (line 235) | def __init__(self, consistent_transform, p=0.5):
method __call__ (line 240) | def __call__(self, datapoint: VideoDatapoint, **kwargs):
class ColorJitter (line 252) | class ColorJitter:
method __init__ (line 253) | def __init__(self, consistent_transform, brightness, contrast, saturat...
method __call__ (line 272) | def __call__(self, datapoint: VideoDatapoint, **kwargs):
class RandomAffine (line 307) | class RandomAffine:
method __init__ (line 308) | def __init__(
method __call__ (line 342) | def __call__(self, datapoint: VideoDatapoint, **kwargs):
method transform_datapoint (line 354) | def transform_datapoint(self, datapoint: VideoDatapoint):
function random_mosaic_frame (line 414) | def random_mosaic_frame(
class RandomMosaicVideoAPI (line 498) | class RandomMosaicVideoAPI:
method __init__ (line 499) | def __init__(self, prob=0.15, grid_h=2, grid_w=2, use_random_hflip=Fal...
method __call__ (line 505) | def __call__(self, datapoint, **kwargs):
FILE: auto-seg/submodules/segment-anything-2/training/dataset/utils.py
class ConcatDataset (line 19) | class ConcatDataset(TorchConcatDataset):
method __init__ (line 20) | def __init__(self, datasets: Iterable[Dataset]) -> None:
method set_epoch (line 25) | def set_epoch(self, epoch: int):
class Subset (line 33) | class Subset(TorchSubset):
method __init__ (line 34) | def __init__(self, dataset, indices) -> None:
class RepeatFactorWrapper (line 42) | class RepeatFactorWrapper(Dataset):
method __init__ (line 49) | def __init__(self, dataset, seed: int = 0):
method _get_epoch_indices (line 58) | def _get_epoch_indices(self, generator):
method __len__ (line 81) | def __len__(self):
method set_epoch (line 91) | def set_epoch(self, epoch: int):
method __getitem__ (line 98) | def __getitem__(self, idx):
FILE: auto-seg/submodules/segment-anything-2/training/dataset/vos_dataset.py
class VOSDataset (line 27) | class VOSDataset(VisionDataset):
method __init__ (line 28) | def __init__(
method _get_datapoint (line 51) | def _get_datapoint(self, idx):
method construct (line 79) | def construct(self, video, sampled_frms_and_objs, segment_loader):
method __getitem__ (line 131) | def __getitem__(self, idx):
method __len__ (line 134) | def __len__(self):
function load_images (line 138) | def load_images(frames):
function tensor_2_PIL (line 159) | def tensor_2_PIL(data: torch.Tensor) -> PILImage.Image:
FILE: auto-seg/submodules/segment-anything-2/training/dataset/vos_raw_dataset.py
class VOSFrame (line 31) | class VOSFrame:
class VOSVideo (line 39) | class VOSVideo:
method __len__ (line 44) | def __len__(self):
class VOSRawDataset (line 48) | class VOSRawDataset:
method __init__ (line 49) | def __init__(self):
method get_video (line 52) | def get_video(self, idx):
class PNGRawDataset (line 56) | class PNGRawDataset(VOSRawDataset):
method __init__ (line 57) | def __init__(
method get_video (line 112) | def get_video(self, idx):
method __len__ (line 144) | def __len__(self):
class SA1BRawDataset (line 148) | class SA1BRawDataset(VOSRawDataset):
method __init__ (line 149) | def __init__(
method get_video (line 187) | def get_video(self, idx):
method __len__ (line 211) | def __len__(self):
class JSONRawDataset (line 215) | class JSONRawDataset(VOSRawDataset):
method __init__ (line 220) | def __init__(
method get_video (line 266) | def get_video(self, video_idx):
method __len__ (line 307) | def __len__(self):
FILE: auto-seg/submodules/segment-anything-2/training/dataset/vos_sampler.py
class SampledFramesAndObjects (line 17) | class SampledFramesAndObjects:
class VOSSampler (line 22) | class VOSSampler:
method __init__ (line 23) | def __init__(self, sort_frames=True):
method sample (line 27) | def sample(self, video):
class RandomUniformSampler (line 31) | class RandomUniformSampler(VOSSampler):
method __init__ (line 32) | def __init__(
method sample (line 42) | def sample(self, video, segment_loader, epoch=None):
class EvalSampler (line 81) | class EvalSampler(VOSSampler):
method __init__ (line 86) | def __init__(
method sample (line 91) | def sample(self, video, segment_loader, epoch=None):
FILE: auto-seg/submodules/segment-anything-2/training/dataset/vos_segment_loader.py
class JSONSegmentLoader (line 23) | class JSONSegmentLoader:
method __init__ (line 24) | def __init__(self, video_json_path, ann_every=1, frames_fps=24, valid_...
method load (line 46) | def load(self, frame_id, obj_ids=None):
method get_valid_obj_frames_ids (line 82) | def get_valid_obj_frames_ids(self, num_frames_min=None):
class PalettisedPNGSegmentLoader (line 103) | class PalettisedPNGSegmentLoader:
method __init__ (line 104) | def __init__(self, video_png_root):
method load (line 119) | def load(self, frame_id):
method __len__ (line 147) | def __len__(self):
class MultiplePNGSegmentLoader (line 151) | class MultiplePNGSegmentLoader:
method __init__ (line 152) | def __init__(self, video_png_root, single_object_mode=False):
method load (line 174) | def load(self, frame_id):
method _load_single_png (line 180) | def _load_single_png(self, frame_id):
method _load_multiple_pngs (line 199) | def _load_multiple_pngs(self, frame_id):
method __len__ (line 227) | def __len__(self):
class LazySegments (line 231) | class LazySegments:
method __init__ (line 236) | def __init__(self):
method __setitem__ (line 240) | def __setitem__(self, key, item):
method __getitem__ (line 243) | def __getitem__(self, key):
method __contains__ (line 251) | def __contains__(self, key):
method __len__ (line 254) | def __len__(self):
method keys (line 257) | def keys(self):
class SA1BSegmentLoader (line 261) | class SA1BSegmentLoader:
method __init__ (line 262) | def __init__(
method load (line 299) | def load(self, frame_idx):
FILE: auto-seg/submodules/segment-anything-2/training/loss_fns.py
function dice_loss (line 20) | def dice_loss(inputs, targets, num_objects, loss_on_multimask=False):
function sigmoid_focal_loss (line 52) | def sigmoid_focal_loss(
function iou_loss (line 93) | def iou_loss(
class MultiStepMultiMasksAndIous (line 126) | class MultiStepMultiMasksAndIous(nn.Module):
method __init__ (line 127) | def __init__(
method forward (line 167) | def forward(self, outs_batch: List[Dict], targets_batch: torch.Tensor):
method _forward (line 184) | def _forward(self, outputs: Dict, targets: torch.Tensor, num_objects):
method _update_losses (line 218) | def _update_losses(
method reduce_loss (line 299) | def reduce_loss(self, losses):
FILE: auto-seg/submodules/segment-anything-2/training/optimizer.py
class Optimizer (line 34) | class Optimizer:
method __init__ (line 35) | def __init__(self, optimizer, schedulers=None) -> None:
method _validate_optimizer_schedulers (line 41) | def _validate_optimizer_schedulers(self):
method step_schedulers (line 52) | def step_schedulers(self, where: float, step: int) -> None:
method step (line 70) | def step(self, where, step, closure=None):
method zero_grad (line 74) | def zero_grad(self, *args, **kwargs):
function set_default_parameters (line 78) | def set_default_parameters(
function name_constraints_to_parameters (line 112) | def name_constraints_to_parameters(
function map_scheduler_cfgs_to_param_groups (line 131) | def map_scheduler_cfgs_to_param_groups(
function validate_param_group_params (line 172) | def validate_param_group_params(param_groups: List[Dict], model: nn.Modu...
function unix_module_cls_pattern_to_parameter_names (line 194) | def unix_module_cls_pattern_to_parameter_names(
function unix_param_pattern_to_parameter_names (line 227) | def unix_param_pattern_to_parameter_names(
function _unix_pattern_to_parameter_names (line 253) | def _unix_pattern_to_parameter_names(
function get_module_cls_to_param_names (line 275) | def get_module_cls_to_param_names(
function construct_optimizer (line 299) | def construct_optimizer(
function get_full_parameter_name (line 374) | def get_full_parameter_name(module_name, param_name):
class GradientClipper (line 380) | class GradientClipper:
method __init__ (line 385) | def __init__(self, max_norm: float = 1.0, norm_type: int = 2):
method __call__ (line 390) | def __call__(self, model: nn.Module):
class ValueScaler (line 399) | class ValueScaler:
method __init__ (line 400) | def __init__(self, scheduler, mult_val: float):
method __call__ (line 404) | def __call__(self, *args, **kwargs):
function rgetattr (line 409) | def rgetattr(obj, rattrs: str = None):
function layer_decay_param_modifier (line 422) | def layer_decay_param_modifier(
FILE: auto-seg/submodules/segment-anything-2/training/scripts/sav_frame_extraction_submitit.py
function get_args_parser (line 14) | def get_args_parser():
function decode_video (line 85) | def decode_video(video_path: str):
function extract_frames (line 98) | def extract_frames(video_path, sample_rate):
function submitit_launch (line 103) | def submitit_launch(video_paths, sample_rate, save_root):
FILE: auto-seg/submodules/segment-anything-2/training/train.py
function single_proc_run (line 28) | def single_proc_run(local_rank, main_port, cfg, world_size):
function single_node_runner (line 44) | def single_node_runner(cfg, main_port: int):
function format_exception (line 63) | def format_exception(e: Exception, limit=20):
class SubmititRunner (line 68) | class SubmititRunner(submitit.helpers.Checkpointable):
method __init__ (line 71) | def __init__(self, port, cfg):
method run_trainer (line 76) | def run_trainer(self):
method __call__ (line 94) | def __call__(self):
method setup_job_info (line 105) | def setup_job_info(self, job_id, rank):
function add_pythonpath_to_sys_path (line 117) | def add_pythonpath_to_sys_path():
function main (line 123) | def main(args) -> None:
FILE: auto-seg/submodules/segment-anything-2/training/trainer.py
function unwrap_ddp_if_wrapped (line 60) | def unwrap_ddp_if_wrapped(model):
class OptimAMPConf (line 67) | class OptimAMPConf:
class OptimConf (line 73) | class OptimConf:
method __post_init__ (line 81) | def __post_init__(self):
class DistributedConf (line 91) | class DistributedConf:
class CudaConf (line 99) | class CudaConf:
class CheckpointConf (line 110) | class CheckpointConf:
method infer_missing (line 121) | def infer_missing(self):
class LoggingConf (line 129) | class LoggingConf:
class Trainer (line 141) | class Trainer:
method __init__ (line 148) | def __init__(
method _setup_timers (line 231) | def _setup_timers(self):
method _get_meters (line 239) | def _get_meters(self, phase_filters=None):
method _infer_distributed_backend_if_none (line 253) | def _infer_distributed_backend_if_none(self, distributed_conf, acceler...
method _setup_env_variables (line 257) | def _setup_env_variables(self, env_variables_conf) -> None:
method _setup_torch_dist_and_backend (line 262) | def _setup_torch_dist_and_backend(self, cuda_conf, distributed_conf) -...
method _setup_device (line 281) | def _setup_device(self, accelerator):
method _setup_ddp_distributed_training (line 291) | def _setup_ddp_distributed_training(self, distributed_conf, accelerator):
method _move_to_device (line 313) | def _move_to_device(self):
method save_checkpoint (line 324) | def save_checkpoint(self, epoch, checkpoint_names=None):
method _save_checkpoint (line 363) | def _save_checkpoint(self, checkpoint, checkpoint_path):
method load_checkpoint (line 382) | def load_checkpoint(self):
method _init_model_state (line 391) | def _init_model_state(self):
method _call_model_initializer (line 412) | def _call_model_initializer(self):
method _load_resuming_checkpoint (line 422) | def _load_resuming_checkpoint(self, ckpt_path: str):
method is_intermediate_val_epoch (line 447) | def is_intermediate_val_epoch(self, epoch):
method _step (line 450) | def _step(
method run (line 499) | def run(self):
method _setup_dataloaders (line 517) | def _setup_dataloaders(self):
method run_train (line 527) | def run_train(self):
method run_val (line 566) | def run_val(self):
method val_epoch (line 583) | def val_epoch(self, val_loader, phase):
method _get_trainer_state (line 696) | def _get_trainer_state(self, phase):
method train_epoch (line 703) | def train_epoch(self, train_loader):
method _log_sync_data_times (line 834) | def _log_sync_data_times(self, phase, data_times):
method _run_step (line 845) | def _run_step(
method _log_meters_and_save_best_ckpts (line 891) | def _log_meters_and_save_best_ckpts(self, phases: List[str]):
method _log_timers (line 923) | def _log_timers(self, phase):
method _reset_meters (line 952) | def _reset_meters(self, phases: str) -> None:
method _check_val_key_match (line 956) | def _check_val_key_match(self, val_keys, phase):
method _setup_components (line 979) | def _setup_components(self):
method _construct_optimizers (line 1025) | def _construct_optimizers(self):
method _log_loss_detailed_and_return_core_loss (line 1033) | def _log_loss_detailed_and_return_core_loss(self, loss, loss_str, step):
function print_model_summary (line 1042) | def print_model_summary(model: torch.nn.Module, log_dir: str = ""):
function get_human_readable_count (line 1080) | def get_human_readable_count(number: int) -> str:
FILE: auto-seg/submodules/segment-anything-2/training/utils/checkpoint_utils.py
function unix_pattern_to_parameter_names (line 30) | def unix_pattern_to_parameter_names(
function filter_params_matching_unix_pattern (line 47) | def filter_params_matching_unix_pattern(
function exclude_params_matching_unix_pattern (line 68) | def exclude_params_matching_unix_pattern(
function _get_state_dict_summary (line 89) | def _get_state_dict_summary(state_dict: Dict[str, torch.Tensor]):
function assert_skipped_parameters_are_frozen (line 99) | def assert_skipped_parameters_are_frozen(model: nn.Module, patterns: Lis...
function with_check_parameter_frozen (line 123) | def with_check_parameter_frozen(
class CkptExcludeKernel (line 164) | class CkptExcludeKernel:
method __init__ (line 173) | def __init__(self, key_pattern: List[str]):
method __call__ (line 176) | def __call__(self, state_dict: Dict):
function load_checkpoint (line 189) | def load_checkpoint(
function get_state_dict (line 227) | def get_state_dict(checkpoint, ckpt_state_dict_keys):
function load_checkpoint_and_apply_kernels (line 247) | def load_checkpoint_and_apply_kernels(
function check_load_state_dict_errors (line 297) | def check_load_state_dict_errors(
function load_state_dict_into_model (line 330) | def load_state_dict_into_model(
FILE: auto-seg/submodules/segment-anything-2/training/utils/data_utils.py
class BatchedVideoMetaData (line 23) | class BatchedVideoMetaData:
class BatchedVideoDatapoint (line 36) | class BatchedVideoDatapoint:
method pin_memory (line 54) | def pin_memory(self, device=None):
method num_frames (line 58) | def num_frames(self) -> int:
method num_videos (line 65) | def num_videos(self) -> int:
method flat_obj_to_img_idx (line 72) | def flat_obj_to_img_idx(self) -> torch.IntTensor:
method flat_img_batch (line 82) | def flat_img_batch(self) -> torch.FloatTensor:
class Object (line 91) | class Object:
class Frame (line 100) | class Frame:
class VideoDatapoint (line 106) | class VideoDatapoint:
function collate_fn (line 114) | def collate_fn(
FILE: auto-seg/submodules/segment-anything-2/training/utils/distributed.py
function _get_global_gloo_group (line 31) | def _get_global_gloo_group():
function is_main_process (line 50) | def is_main_process():
function all_gather_via_filesys (line 55) | def all_gather_via_filesys(data, filesys_save_dir=None, gather_to_rank_0...
function all_gather (line 114) | def all_gather(data, force_cpu=False, force_filesys=False, filesys_save_...
function convert_to_distributed_tensor (line 186) | def convert_to_distributed_tensor(tensor: torch.Tensor) -> Tuple[torch.T...
function convert_to_normal_tensor (line 202) | def convert_to_normal_tensor(tensor: torch.Tensor, orig_device: str) -> ...
function is_distributed_training_run (line 212) | def is_distributed_training_run() -> bool:
function is_primary (line 220) | def is_primary() -> bool:
function all_reduce_mean (line 228) | def all_reduce_mean(tensor: torch.Tensor) -> torch.Tensor:
function all_reduce_sum (line 240) | def all_reduce_sum(tensor: torch.Tensor) -> torch.Tensor:
function all_reduce_min (line 249) | def all_reduce_min(tensor: torch.Tensor) -> torch.Tensor:
function all_reduce_max (line 258) | def all_reduce_max(tensor: torch.Tensor) -> torch.Tensor:
function all_reduce_op (line 267) | def all_reduce_op(
function gather_tensors_from_all (line 286) | def gather_tensors_from_all(tensor: torch.Tensor) -> List[torch.Tensor]:
function gather_from_all (line 312) | def gather_from_all(tensor: torch.Tensor) -> torch.Tensor:
function broadcast (line 318) | def broadcast(tensor: torch.Tensor, src: int = 0) -> torch.Tensor:
function barrier (line 330) | def barrier() -> None:
function get_world_size (line 340) | def get_world_size() -> int:
function get_rank (line 352) | def get_rank() -> int:
function get_primary_rank (line 364) | def get_primary_rank() -> int:
function set_cuda_device_index (line 368) | def set_cuda_device_index(idx: int) -> None:
function set_cpu_device (line 374) | def set_cpu_device() -> None:
function get_cuda_device_index (line 379) | def get_cuda_device_index() -> int:
function init_distributed_data_parallel_model (line 383) | def init_distributed_data_parallel_model(
function broadcast_object (line 411) | def broadcast_object(obj: Any, src: int = _PRIMARY_RANK, use_disk: bool ...
function all_gather_tensor (line 451) | def all_gather_tensor(tensor: torch.Tensor, world_size=None):
function all_gather_batch (line 465) | def all_gather_batch(tensors: List[torch.Tensor]):
class GatherLayer (line 485) | class GatherLayer(autograd.Function):
method forward (line 492) | def forward(ctx, x):
method backward (line 498) | def backward(ctx, *grads):
function all_gather_batch_with_grad (line 504) | def all_gather_batch_with_grad(tensors):
function unwrap_ddp_if_wrapped (line 526) | def unwrap_ddp_if_wrapped(model):
function create_new_process_group (line 532) | def create_new_process_group(group_size):
function is_dist_avail_and_initialized (line 571) | def is_dist_avail_and_initialized():
FILE: auto-seg/submodules/segment-anything-2/training/utils/logger.py
function make_tensorboard_logger (line 27) | def make_tensorboard_logger(log_dir: str, **writer_kwargs: Any):
class TensorBoardWriterWrapper (line 35) | class TensorBoardWriterWrapper:
method __init__ (line 40) | def __init__(
method writer (line 82) | def writer(self) -> Optional[SummaryWriter]:
method path (line 86) | def path(self) -> str:
method flush (line 89) | def flush(self) -> None:
method close (line 97) | def close(self) -> None:
class TensorBoardLogger (line 109) | class TensorBoardLogger(TensorBoardWriterWrapper):
method log_dict (line 114) | def log_dict(self, payload: Dict[str, Scalar], step: int) -> None:
method log (line 126) | def log(self, name: str, data: Scalar, step: int) -> None:
method log_hparams (line 138) | def log_hparams(
class Logger (line 152) | class Logger:
method __init__ (line 157) | def __init__(self, logging_conf):
method log_dict (line 163) | def log_dict(self, payload: Dict[str, Scalar], step: int) -> None:
method log (line 167) | def log(self, name: str, data: Scalar, step: int) -> None:
method log_hparams (line 171) | def log_hparams(
function _cached_log_stream (line 181) | def _cached_log_stream(filename):
function setup_logging (line 190) | def setup_logging(
function shutdown_logging (line 239) | def shutdown_logging():
FILE: auto-seg/submodules/segment-anything-2/training/utils/train_utils.py
function multiply_all (line 25) | def multiply_all(*args):
function collect_dict_keys (line 29) | def collect_dict_keys(config):
class Phase (line 47) | class Phase:
function register_omegaconf_resolvers (line 52) | def register_omegaconf_resolvers():
function setup_distributed_backend (line 66) | def setup_distributed_backend(backend, timeout_mins):
function get_machine_local_and_dist_rank (line 81) | def get_machine_local_and_dist_rank():
function print_cfg (line 93) | def print_cfg(cfg):
function set_seeds (line 101) | def set_seeds(seed_value, max_epochs, dist_rank):
function makedir (line 116) | def makedir(dir_path):
function is_dist_avail_and_initialized (line 130) | def is_dist_avail_and_initialized():
function get_amp_type (line 138) | def get_amp_type(amp_type: Optional[str] = None):
function log_env_variables (line 148) | def log_env_variables():
class AverageMeter (line 158) | class AverageMeter:
method __init__ (line 161) | def __init__(self, name, device, fmt=":f"):
method reset (line 167) | def reset(self):
method update (line 174) | def update(self, val, n=1):
method __str__ (line 180) | def __str__(self):
class MemMeter (line 185) | class MemMeter:
method __init__ (line 188) | def __init__(self, name, device, fmt=":f"):
method reset (line 194) | def reset(self):
method update (line 202) | def update(self, n=1, reset_peak_usage=True):
method __str__ (line 211) | def __str__(self):
function human_readable_time (line 224) | def human_readable_time(time_seconds):
class DurationMeter (line 232) | class DurationMeter:
method __init__ (line 233) | def __init__(self, name, device, fmt=":f"):
method reset (line 239) | def reset(self):
method update (line 242) | def update(self, val):
method add (line 245) | def add(self, val):
method __str__ (line 248) | def __str__(self):
class ProgressMeter (line 252) | class ProgressMeter:
method __init__ (line 253) | def __init__(self, num_batches, meters, real_meters, prefix=""):
method display (line 259) | def display(self, batch, enable_print=False):
method _get_batch_fmtstr (line 275) | def _get_batch_fmtstr(self, num_batches):
function get_resume_checkpoint (line 281) | def get_resume_checkpoint(checkpoint_save_dir):
FILE: cogvideox_interpolation/datasets.py
class ImageVideoDataset (line 21) | class ImageVideoDataset(Dataset):
method __init__ (line 22) | def __init__(
method __len__ (line 63) | def __len__(self):
method _resize_for_rectangle_crop (line 66) | def _resize_for_rectangle_crop(self, arr):
method __getitem__ (line 98) | def __getitem__(self, index):
class AutoEncoderDataset (line 161) | class AutoEncoderDataset(ImageVideoDataset):
method __init__ (line 162) | def __init__(self, *args, **kwargs):
method __getitem__ (line 164) | def __getitem__(self, index):
class LvisDataset (line 190) | class LvisDataset(Dataset):
method __init__ (line 191) | def __init__(
method __len__ (line 216) | def __len__(self):
method __getitem__ (line 219) | def __getitem__(self, index):
FILE: cogvideox_interpolation/losses.py
function l2_loss (line 8) | def l2_loss(network_output, gt):
function cos_loss (line 11) | def cos_loss(network_output, gt):
function hinge_d_loss (line 14) | def hinge_d_loss(logits_real, logits_fake):
function vanilla_d_loss (line 21) | def vanilla_d_loss(logits_real, logits_fake):
function sigmoid_cross_entropy_with_logits (line 29) | def sigmoid_cross_entropy_with_logits(labels, logits):
function lecam_reg (line 38) | def lecam_reg(real_pred, fake_pred, ema_real_pred, ema_fake_pred):
function gradient_penalty_fn (line 45) | def gradient_penalty_fn(images, output):
class VAELoss (line 59) | class VAELoss(nn.Module):
method __init__ (line 60) | def __init__(
method forward (line 85) | def forward(
function adopt_weight (line 132) | def adopt_weight(weight, global_step, threshold=0, value=0.0):
class AdversarialLoss (line 138) | class AdversarialLoss(nn.Module):
method __init__ (line 139) | def __init__(
method calculate_adaptive_weight (line 152) | def calculate_adaptive_weight(self, nll_loss, g_loss, last_layer):
method forward (line 160) | def forward(
class LeCamEMA (line 195) | class LeCamEMA:
method __init__ (line 196) | def __init__(self, ema_real=0.0, ema_fake=0.0, decay=0.999, dtype=torc...
method update (line 201) | def update(self, ema_real, ema_fake):
method get (line 205) | def get(self):
class DiscriminatorLoss (line 209) | class DiscriminatorLoss(nn.Module):
method __init__ (line 210) | def __init__(
method forward (line 227) | def forward(
FILE: cogvideox_interpolation/lpips.py
function md5_hash (line 18) | def md5_hash(path):
function download (line 24) | def download(url, local_path, chunk_size=1024):
function get_ckpt_path (line 36) | def get_ckpt_path(name, root, check=False):
class LPIPS (line 47) | class LPIPS(nn.Module):
method __init__ (line 49) | def __init__(self, use_dropout=True):
method load_from_pretrained (line 63) | def load_from_pretrained(self, name="vgg_lpips"):
method from_pretrained (line 69) | def from_pretrained(cls, name="vgg_lpips"):
method forward (line 77) | def forward(self, input, target):
class ScalingLayer (line 93) | class ScalingLayer(nn.Module):
method __init__ (line 94) | def __init__(self):
method forward (line 99) | def forward(self, inp):
class NetLinLayer (line 103) | class NetLinLayer(nn.Module):
method __init__ (line 106) | def __init__(self, chn_in, chn_out=1, use_dropout=False):
class vgg16 (line 121) | class vgg16(torch.nn.Module):
method __init__ (line 122) | def __init__(self, requires_grad=False, pretrained=True):
method forward (line 145) | def forward(self, X):
function normalize_tensor (line 161) | def normalize_tensor(x, eps=1e-10):
function spatial_average (line 166) | def spatial_average(x, keepdim=True):
FILE: cogvideox_interpolation/pipeline.py
function get_resize_crop_region_for_grid (line 20) | def get_resize_crop_region_for_grid(src, tgt_width, tgt_height):
function retrieve_timesteps (line 38) | def retrieve_timesteps(
function retrieve_latents (line 97) | def retrieve_latents(
class CogVideoXInterpolationPipeline (line 109) | class CogVideoXInterpolationPipeline(DiffusionPipeline):
method __init__ (line 118) | def __init__(
method _get_t5_prompt_embeds (line 146) | def _get_t5_prompt_embeds(
method encode_prompt (line 189) | def encode_prompt(
method prepare_latents (line 270) | def prepare_latents(
method decode_latents (line 343) | def decode_latents(self, latents: torch.Tensor) -> torch.Tensor:
method get_timesteps (line 351) | def get_timesteps(self, num_inference_steps, timesteps, strength, devi...
method prepare_extra_step_kwargs (line 361) | def prepare_extra_step_kwargs(self, generator, eta):
method check_inputs (line 378) | def check_inputs(
method fuse_qkv_projections (line 458) | def fuse_qkv_projections(self) -> None:
method unfuse_qkv_projections (line 464) | def unfuse_qkv_projections(self) -> None:
method _prepare_rotary_positional_embeddings (line 473) | def _prepare_rotary_positional_embeddings(
method guidance_scale (line 500) | def guidance_scale(self):
method num_timesteps (line 504) | def num_timesteps(self):
method interrupt (line 508) | def interrupt(self):
method __call__ (line 512) | def __call__(
FILE: cogvideox_interpolation/utils/colormaps.py
class ColormapOptions (line 32) | class ColormapOptions:
function apply_colormap (line 47) | def apply_colormap(
function apply_float_colormap (line 99) | def apply_float_colormap(image: Float[Tensor, "*bs 1"], colormap: Colorm...
function apply_depth_colormap (line 123) | def apply_depth_colormap(
function apply_boolean_colormap (line 158) | def apply_boolean_colormap(
function apply_pca_colormap (line 180) | def apply_pca_colormap(image: Float[Tensor, "*bs dim"]):
function colormap_saving (line 222) | def colormap_saving(image: torch.Tensor, colormap_options, mask_thresh=N...
FILE: cogvideox_interpolation/utils/colors.py
function get_color (line 37) | def get_color(color: Union[str, list]) -> Float[Tensor, "3"]:
FILE: cogvideox_interpolation/utils/config_utils.py
function parse_args (line 7) | def parse_args():
function merge_args (line 175) | def merge_args(cfg, args):
function read_config (line 188) | def read_config(config_path):
function parse_configs (line 193) | def parse_configs():
function str2bool (line 199) | def str2bool(v):
FILE: cogvideox_interpolation/utils/misc.py
class Timer (line 2) | class Timer:
method __init__ (line 3) | def __init__(self, name, log=False):
method elapsed_time (line 9) | def elapsed_time(self):
method __enter__ (line 12) | def __enter__(self):
method __exit__ (line 17) | def __exit__(self, exc_type, exc_val, exc_tb):
FILE: entry_point.py
function setup_seed (line 14) | def setup_seed(seed):
function main (line 22) | def main(cfg: DictConfig):
FILE: field_construction/auto_encoder.py
class Autoencoder_dataset (line 10) | class Autoencoder_dataset(Dataset):
method __init__ (line 11) | def __init__(self, data_dir):
method __getitem__ (line 20) | def __getitem__(self, index):
method __len__ (line 24) | def __len__(self):
class Autoencoder (line 28) | class Autoencoder(nn.Module):
method __init__ (line 29) | def __init__(self, encoder_hidden_dims=None, decoder_hidden_dims=None):
method forward (line 54) | def forward(self, x):
method encode (line 63) | def encode(self, x):
method decode (line 69) | def decode(self, x):
FILE: field_construction/extract_with_openseg.py
function extract_with_openseg (line 10) | def extract_with_openseg(cfg):
FILE: field_construction/gaussian_field.py
function post_process_mesh (line 43) | def post_process_mesh(mesh, cluster_to_keep=3):
function permuted_pca (line 65) | def permuted_pca(image):
function save_pose (line 68) | def save_pose(path, quat_pose, train_cams):
function load_and_prepare_confidence (line 85) | def load_and_prepare_confidence(confidence_path, device='cuda', scale=(0...
class GaussianField (line 109) | class GaussianField():
method __init__ (line 110) | def __init__(self, cfg):
method train (line 113) | def train(self):
method training_report (line 562) | def training_report(self, iteration, camera_list, l1_loss, renderFunc,...
method render (line 605) | def render(self):
method eval (line 870) | def eval(self):
FILE: field_construction/gaussian_renderer/__init__.py
function render_normal (line 28) | def render_normal(viewpoint_cam, depth, offset=None, normal=None, scale=1):
function render (line 42) | def render(
FILE: field_construction/gaussian_renderer/network_gui.py
function init (line 28) | def init(wish_host, wish_port):
function try_connect (line 36) | def try_connect():
function read (line 45) | def read():
function send (line 52) | def send(message_bytes, verify):
function receive (line 59) | def receive():
FILE: field_construction/lpipsPyTorch/__init__.py
function lpips (line 6) | def lpips(x: torch.Tensor,
FILE: field_construction/lpipsPyTorch/modules/lpips.py
class LPIPS (line 8) | class LPIPS(nn.Module):
method __init__ (line 17) | def __init__(self, net_type: str = 'alex', version: str = '0.1'):
method forward (line 30) | def forward(self, x: torch.Tensor, y: torch.Tensor):
FILE: field_construction/lpipsPyTorch/modules/networks.py
function get_network (line 12) | def get_network(net_type: str):
class LinLayers (line 23) | class LinLayers(nn.ModuleList):
method __init__ (line 24) | def __init__(self, n_channels_list: Sequence[int]):
class BaseNet (line 36) | class BaseNet(nn.Module):
method __init__ (line 37) | def __init__(self):
method set_requires_grad (line 46) | def set_requires_grad(self, state: bool):
method z_score (line 50) | def z_score(self, x: torch.Tensor):
method forward (line 53) | def forward(self, x: torch.Tensor):
class SqueezeNet (line 66) | class SqueezeNet(BaseNet):
method __init__ (line 67) | def __init__(self):
class AlexNet (line 77) | class AlexNet(BaseNet):
method __init__ (line 78) | def __init__(self):
class VGG16 (line 88) | class VGG16(BaseNet):
method __init__ (line 89) | def __init__(self):
FILE: field_construction/lpipsPyTorch/modules/utils.py
function normalize_activation (line 6) | def normalize_activation(x, eps=1e-10):
function get_state_dict (line 11) | def get_state_dict(net_type: str = 'alex', version: str = '0.1'):
FILE: field_construction/pipeline.py
class FieldConstructionPipeline (line 8) | class FieldConstructionPipeline:
method __init__ (line 9) | def __init__(self, cfg):
method construct_field (line 16) | def construct_field(self):
method render_result (line 25) | def render_result(self):
method eval (line 29) | def eval(self):
FILE: field_construction/pose_estimator/__init__.py
class BaseEstimator (line 19) | class BaseEstimator(ABC):
method get_poses (line 21) | def get_poses():
class ColmapEstimator (line 25) | class ColmapEstimator(BaseEstimator):
method __init__ (line 26) | def __init__(self, cfg):
method get_poses (line 29) | def get_poses(self, camera_model="OPENCV", use_gpu=True):
class MASt3REstimator (line 99) | class MASt3REstimator(BaseEstimator):
method __init__ (line 100) | def __init__(self, cfg):
method get_poses (line 106) | def get_poses(self):
class CUT3REstimator (line 166) | class CUT3REstimator(BaseEstimator):
method __init__ (line 167) | def __init__(self, cfg):
method get_poses (line 171) | def get_poses(self):
class VGGTEstimator (line 227) | class VGGTEstimator(BaseEstimator):
method __init__ (line 228) | def __init__(self, cfg):
method get_poses (line 232) | def get_poses(self):
function get_pose_estimator (line 296) | def get_pose_estimator(cfg):
FILE: field_construction/pose_estimator/utils.py
function storePly (line 9) | def storePly(path, xyz, rgb):
function prepare_input (line 16) | def prepare_input(
function prepare_output (line 124) | def prepare_output(outputs, orig_shape, outdir, revisit=1, use_pose=True):
FILE: field_construction/preprocessor.py
function extract_with_openseg (line 22) | def extract_with_openseg(cfg):
class Preprocessor (line 92) | class Preprocessor:
method __init__ (line 93) | def __init__(self, cfg):
method generate_lang_features_with_openseg (line 146) | def generate_lang_features_with_openseg(self):
method generate_lang_features_with_lseg (line 229) | def generate_lang_features_with_lseg(self):
method select_valid_data (line 257) | def select_valid_data(self):
method preprocess (line 296) | def preprocess(self):
FILE: field_construction/scene/__init__.py
class Scene (line 26) | class Scene:
method __init__ (line 29) | def __init__(self, args, gaussians: GaussianModel, load_iteration=None...
method save (line 138) | def save(self, iteration, mask=None, include_feature=False, finetune=F...
method getTrainCameras (line 148) | def getTrainCameras(self, scale=1.0):
method getTestCameras (line 151) | def getTestCameras(self, scale=1.0):
FILE: field_construction/scene/app_model.py
function searchForMaxIteration (line 7) | def searchForMaxIteration(folder):
class AppModel (line 11) | class AppModel(nn.Module):
method __init__ (line 12) | def __init__(self, num_images=1600):
method save_weights (line 19) | def save_weights(self, model_path, iteration):
method load_weights (line 25) | def load_weights(self, model_path, iteration=-1):
method freeze (line 34) | def freeze(self):
FILE: field_construction/scene/cameras.py
function dilate (line 27) | def dilate(bin_img, ksize=6):
function erode (line 33) | def erode(bin_img, ksize=12):
function process_image (line 37) | def process_image(image_path, resolution, ncc_scale):
class Camera (line 56) | class Camera(nn.Module):
method __init__ (line 57) | def __init__(self, colmap_id, R, T, FoVx, FoVy,
method get_image (line 115) | def get_image(self):
method get_normal (line 122) | def get_normal(self):
method get_language_feature (line 137) | def get_language_feature(self, language_feature_dir):
method get_calib_matrix_nerf (line 153) | def get_calib_matrix_nerf(self, scale=1.0):
method get_rays (line 158) | def get_rays(self, scale=1.0):
method get_k (line 168) | def get_k(self, scale=1.0):
method get_inv_k (line 174) | def get_inv_k(self, scale=1.0):
class MiniCam (line 180) | class MiniCam:
method __init__ (line 181) | def __init__(self, width, height, fovy, fovx, znear, zfar, world_view_...
function sample_cam (line 193) | def sample_cam(cam_l: Camera, cam_r: Camera):
FILE: field_construction/scene/colmap_loader.py
function qvec2rotmat (line 44) | def qvec2rotmat(qvec):
function rotmat2qvec (line 56) | def rotmat2qvec(R):
class Image (line 69) | class Image(BaseImage):
method qvec2rotmat (line 70) | def qvec2rotmat(self):
function read_next_bytes (line 73) | def read_next_bytes(fid, num_bytes, format_char_sequence, endian_charact...
function read_points3D_text (line 84) | def read_points3D_text(path):
function read_points3D_binary (line 130) | def read_points3D_binary(path_to_model_file):
function read_intrinsics_text (line 167) | def read_intrinsics_text(path):
function read_extrinsics_binary (line 191) | def read_extrinsics_binary(path_to_model_file):
function read_intrinsics_binary (line 226) | def read_intrinsics_binary(path_to_model_file):
function read_extrinsics_text (line 255) | def read_extrinsics_text(path):
function read_colmap_bin_array (line 284) | def read_colmap_bin_array(path):
function write_cameras_text (line 307) | def write_cameras_text(cameras, path):
function write_next_bytes (line 326) | def write_next_bytes(fid, data, format_char_sequence, endian_character="...
function write_cameras_binary (line 342) | def write_cameras_binary(cameras, path_to_model_file):
function write_images_text (line 359) | def write_images_text(images, path):
function write_images_binary (line 399) | def write_images_binary(images, path_to_model_file):
function write_points3D_text (line 420) | def write_points3D_text(points3D, path):
function write_points3D_binary (line 451) | def write_points3D_binary(points3D, path_to_model_file):
FILE: field_construction/scene/dataset_readers.py
class CameraInfo (line 37) | class CameraInfo(NamedTuple):
class SceneInfo (line 51) | class SceneInfo(NamedTuple):
function getNerfppNorm (line 58) | def getNerfppNorm(cam_info):
function load_poses (line 81) | def load_poses(pose_path, num):
function readColmapCameras (line 95) | def readColmapCameras(cam_extrinsics, cam_intrinsics, images_folder):
function fetchPly_o3d (line 134) | def fetchPly_o3d(path):
function fetchPly (line 141) | def fetchPly(path):
function storePly (line 149) | def storePly(path, xyz, rgb):
function readColmapSceneInfo (line 166) | def readColmapSceneInfo(path, images, eval, llffhold=10, loaded_iter=None):
function read_camera_npz (line 234) | def read_camera_npz(camera_dir):
function readCUT3RInfo (line 296) | def readCUT3RInfo(path, images, eval, llffhold=10, loaded_iter=None):
function readCamerasFromTransforms (line 357) | def readCamerasFromTransforms(path, transformsfile, white_background, ex...
function readNerfSyntheticInfo (line 399) | def readNerfSyntheticInfo(path, white_background, eval, extension=".png"):
FILE: field_construction/scene/gaussian_model.py
function dilate (line 34) | def dilate(bin_img, ksize=5):
function erode (line 40) | def erode(bin_img, ksize=5):
class GaussianModel (line 44) | class GaussianModel:
method setup_functions (line 46) | def setup_functions(self):
method __init__ (line 63) | def __init__(self, sh_degree : int):
method capture (line 90) | def capture(self, include_feature=False):
method restore (line 136) | def restore(self, model_args, training_args, mode='train'):
method get_scaling (line 194) | def get_scaling(self):
method get_rotation (line 198) | def get_rotation(self):
method get_xyz (line 202) | def get_xyz(self):
method get_features (line 206) | def get_features(self):
method get_opacity (line 212) | def get_opacity(self):
method get_language_feature (line 216) | def get_language_feature(self):
method get_instance_feature (line 220) | def get_instance_feature(self):
method get_smallest_axis (line 223) | def get_smallest_axis(self, return_idx=False):
method get_normal (line 231) | def get_normal(self, view_cam):
method init_RT_seq (line 238) | def init_RT_seq(self, cam_list):
method get_RT (line 249) | def get_RT(self, idx):
method get_RT_test (line 253) | def get_RT_test(self, idx):
method get_rotation_matrix (line 257) | def get_rotation_matrix(self):
method get_covariance (line 260) | def get_covariance(self, scaling_modifier = 1):
method oneupSHdegree (line 263) | def oneupSHdegree(self):
method create_from_pcd (line 267) | def create_from_pcd(self, pcd : BasicPointCloud, spatial_lr_scale : fl...
method training_setup (line 303) | def training_setup(self, training_args, device):
method training_setup_pp (line 344) | def training_setup_pp(self, training_args, confidence_lr=None, device=...
method clip_grad (line 384) | def clip_grad(self, norm=1.0):
method update_learning_rate (line 388) | def update_learning_rate(self, iteration):
method construct_list_of_attributes (line 400) | def construct_list_of_attributes(self, include_feature=False):
method save_ply (line 419) | def save_ply(self, path, mask=None, include_feature=False):
method reset_opacity (line 443) | def reset_opacity(self):
method load_ply (line 448) | def load_ply(self, path):
method replace_tensor_to_optimizer (line 506) | def replace_tensor_to_optimizer(self, tensor, name):
method _prune_optimizer (line 521) | def _prune_optimizer(self, mask):
method prune_points (line 539) | def prune_points(self, mask):
method cat_tensors_to_optimizer (line 561) | def cat_tensors_to_optimizer(self, tensors_dict):
method densification_postfix (line 583) | def densification_postfix(self, new_xyz, new_knn_f, new_features_dc, n...
method densify_and_split (line 612) | def densify_and_split(self, grads, grad_threshold, grads_abs, grad_abs...
method densify_and_clone (line 664) | def densify_and_clone(self, grads, grad_threshold, scene_extent):
method densify_and_prune (line 700) | def densify_and_prune(self, max_grad, abs_max_grad, min_opacity, exten...
method add_densification_stats (line 720) | def add_densification_stats(self, viewspace_point_tensor, viewspace_po...
method get_points_depth_in_depth_map (line 726) | def get_points_depth_in_depth_map(self, fov_camera, depth, points_in_c...
method get_points_from_depth (line 749) | def get_points_from_depth(self, fov_camera, depth, scale=1):
method change_reqiures_grad (line 760) | def change_reqiures_grad(self, change, iteration, quiet=True):
FILE: field_construction/scene/per_point_adam.py
class PerPointAdam (line 5) | class PerPointAdam(Optimizer):
method __init__ (line 18) | def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weig...
method _adjust_per_point_lr (line 27) | def _adjust_per_point_lr(self, per_point_lr, grad, mask):
method step (line 35) | def step(self, closure=None):
FILE: field_construction/submodules/diff-langsurf-rasterizer/cuda_rasterizer/auxiliary.h
function ndc2Pix (line 41) | float ndc2Pix(float v, int S)
function getRect (line 46) | void getRect(const float2 p, int max_radius, uint2& rect_min, uint2& rec...
function float3 (line 58) | float3 transformPoint4x3(const float3& p, const float* matrix)
function float4 (line 68) | float4 transformPoint4x4(const float3& p, const float* matrix)
function float3 (line 79) | float3 transformVec4x3(const float3& p, const float* matrix)
function float3 (line 89) | float3 transformVec4x3Transpose(const float3& p, const float* matrix)
function dnormvdz (line 99) | float dnormvdz(float3 v, float3 dv)
function float3 (line 107) | float3 dnormvdv(float3 v, float3 dv)
function float4 (line 119) | float4 dnormvdv(float4 v, float4 dv)
function sigmoid (line 134) | float sigmoid(float x)
function in_frustum (line 139) | bool in_frustum(int idx,
FILE: field_construction/submodules/diff-langsurf-rasterizer/cuda_rasterizer/backward.h
function namespace (line 21) | namespace BACKWARD
FILE: field_construction/submodules/diff-langsurf-rasterizer/cuda_rasterizer/forward.h
function namespace (line 21) | namespace FORWARD
FILE: field_construction/submodules/diff-langsurf-rasterizer/cuda_rasterizer/rasterizer.h
function namespace (line 18) | namespace CudaRasterizer
FILE: field_construction/submodules/diff-langsurf-rasterizer/cuda_rasterizer/rasterizer_impl.h
function namespace (line 19) | namespace CudaRasterizer
FILE: field_construction/submodules/diff-langsurf-rasterizer/diff_LangSurf_rasterization/__init__.py
function cpu_deep_copy_tuple (line 17) | def cpu_deep_copy_tuple(input_tuple):
function rasterize_gaussians (line 21) | def rasterize_gaussians(
class _RasterizeGaussians (line 52) | class _RasterizeGaussians(torch.autograd.Function):
method forward (line 54) | def forward(
method backward (line 118) | def backward(ctx, grad_out_color, grad_out_language_feature, grad_out_...
class GaussianRasterizationSettings (line 189) | class GaussianRasterizationSettings(NamedTuple):
class GaussianRasterizer (line 205) | class GaussianRasterizer(nn.Module):
method __init__ (line 206) | def __init__(self, raster_settings):
method markVisible (line 210) | def markVisible(self, positions):
method forward (line 221) | def forward(self, means3D, means2D, means2D_abs, opacities, shs = None...
FILE: field_construction/submodules/diff-langsurf-rasterizer/ext.cpp
function PYBIND11_MODULE (line 15) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/doc/api/dynsections.js
function toggleVisibility (line 1) | function toggleVisibility(linkObj)
function updateStripes (line 22) | function updateStripes()
function toggleLevel (line 28) | function toggleLevel(level)
function toggleFolder (line 49) | function toggleFolder(id)
function toggleInherit (line 84) | function toggleInherit(id)
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/doc/api/jquery.js
function b0 (line 16) | function b0(b3,b4){return new b0.fn.init(b3,b4)}
function bw (line 16) | function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("lef...
function X (line 16) | function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.lengt...
function bD (line 16) | function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(ar...
function bz (line 16) | function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(ar...
function a5 (line 16) | function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.repl...
function S (line 16) | function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){c...
function bi (line 16) | function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._...
function bE (line 16) | function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}
function bk (line 16) | function bk(){return false}
function i (line 16) | function i(){return true}
function bv (line 23) | function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var...
function bN (line 23) | function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var...
function C (line 23) | function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}
function aG (line 23) | function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,func...
function a (line 23) | function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.c...
function ba (line 23) | function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("...
function t (line 23) | function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e...
function ai (line 23) | function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes)...
function bg (line 23) | function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e....
function az (line 23) | function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecke...
function E (line 23) | function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(...
function al (line 23) | function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.inne...
function bo (line 23) | function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"sc...
function p (line 23) | function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,...
function f (line 23) | function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="...
function aW (line 23) | function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=t...
function am (line 23) | function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in ...
function bF (line 23) | function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}...
function v (line 23) | function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(b...
function bj (line 23) | function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseF...
function G (line 23) | function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var...
function aL (line 23) | function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}
function aj (line 23) | function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch...
function bv (line 23) | function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK...
function bB (line 23) | function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}
function bh (line 23) | function bh(){setTimeout(at,0);return(a4=b.now())}
function at (line 23) | function at(){a4=L}
function a0 (line 23) | function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),fun...
function bv (line 23) | function bv(bA){return e.step(bA)}
function x (line 23) | function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=...
function aK (line 23) | function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.pa...
function j (line 32) | function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"paddin...
function c (line 32) | function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.pa...
function b (line 32) | function b(e){return !a(e).parents().andSelf().filter(function(){return ...
function a (line 61) | function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}
function n (line 61) | function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if...
function h (line 61) | function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}
function b (line 61) | function b(d){return typeof d=="object"?d:{top:d,left:d}}
function b (line 68) | function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bott...
function t (line 68) | function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c...
function j (line 68) | function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(...
function x (line 68) | function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<di...
function q (line 68) | function q(F){return window.SVGElement&&F[0] instanceof SVGElement}
function h (line 68) | function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(fun...
function i (line 68) | function i(F){c.currentX=F.pageX;c.currentY=F.pageY}
function v (line 68) | function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-...
function B (line 68) | function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isF...
function m (line 68) | function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=...
function a (line 68) | function a(G){var F=0;while(G){G&=G-1;F++}return F}
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/doc/api/search/search.js
function convertToId (line 1) | function convertToId(search)
function getXPos (line 24) | function getXPos(item)
function getYPos (line 38) | function getYPos(item)
function SearchBox (line 59) | function SearchBox(name, resultsPath, inFrame, label)
function SearchResults (line 404) | function SearchResults(name)
function setKeyActions (line 709) | function setKeyActions(elem,action)
function setClassAttr (line 716) | function setClassAttr(elem,attr)
function createResults (line 722) | function createResults()
function init_search (line 777) | function init_search()
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/common.hpp
type glm (line 20) | namespace glm
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/detail/_noise.hpp
type glm (line 5) | namespace glm{
type detail (line 6) | namespace detail
function GLM_FUNC_QUALIFIER (line 9) | GLM_FUNC_QUALIFIER T mod289(T const& x)
function GLM_FUNC_QUALIFIER (line 15) | GLM_FUNC_QUALIFIER T permute(T const& x)
function GLM_FUNC_QUALIFIER (line 21) | GLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x)
function GLM_FUNC_QUALIFIER (line 27) | GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x)
function GLM_FUNC_QUALIFIER (line 33) | GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x)
function GLM_FUNC_QUALIFIER (line 39) | GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)
function GLM_FUNC_QUALIFIER (line 45) | GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)
function GLM_FUNC_QUALIFIER (line 51) | GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)
function GLM_FUNC_QUALIFIER (line 57) | GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)
function GLM_FUNC_QUALIFIER (line 63) | GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)
function GLM_FUNC_QUALIFIER (line 69) | GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)
function GLM_FUNC_QUALIFIER (line 75) | GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/detail/_swizzle.hpp
type glm (line 3) | namespace glm{
type detail (line 4) | namespace detail
type _swizzle_base0 (line 8) | struct _swizzle_base0
method GLM_FUNC_QUALIFIER (line 11) | GLM_FUNC_QUALIFIER T& elem(size_t i){ return (reinterpret_cast<T*>...
method GLM_FUNC_QUALIFIER (line 12) | GLM_FUNC_QUALIFIER T const& elem(size_t i) const{ return (reinterp...
type _swizzle_base1 (line 21) | struct _swizzle_base1 : public _swizzle_base0<T, N>
type _swizzle_base1<2, T, Q, E0,E1,-1,-2, Aligned> (line 26) | struct _swizzle_base1<2, T, Q, E0,E1,-1,-2, Aligned> : public _swizz...
method GLM_FUNC_QUALIFIER (line 28) | GLM_FUNC_QUALIFIER vec<2, T, Q> operator ()() const { return vec<...
type _swizzle_base1<3, T, Q, E0,E1,E2,-1, Aligned> (line 32) | struct _swizzle_base1<3, T, Q, E0,E1,E2,-1, Aligned> : public _swizz...
method GLM_FUNC_QUALIFIER (line 34) | GLM_FUNC_QUALIFIER vec<3, T, Q> operator ()() const { return vec<...
type _swizzle_base1<4, T, Q, E0,E1,E2,E3, Aligned> (line 38) | struct _swizzle_base1<4, T, Q, E0,E1,E2,E3, Aligned> : public _swizz...
method GLM_FUNC_QUALIFIER (line 40) | GLM_FUNC_QUALIFIER vec<4, T, Q> operator ()() const { return vec<...
type _swizzle_base2 (line 55) | struct _swizzle_base2 : public _swizzle_base1<N, T, Q, E0,E1,E2,E3, ...
type op_equal (line 57) | struct op_equal
method GLM_FUNC_QUALIFIER (line 59) | GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e = t; }
type op_minus (line 62) | struct op_minus
method GLM_FUNC_QUALIFIER (line 64) | GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e -= t; }
type op_plus (line 67) | struct op_plus
method GLM_FUNC_QUALIFIER (line 69) | GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e += t; }
type op_mul (line 72) | struct op_mul
method GLM_FUNC_QUALIFIER (line 74) | GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e *= t; }
type op_div (line 77) | struct op_div
method GLM_FUNC_QUALIFIER (line 79) | GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e /= t; }
method GLM_FUNC_QUALIFIER (line 83) | GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const T& t)
method GLM_FUNC_QUALIFIER (line 90) | GLM_FUNC_QUALIFIER _swizzle_base2& operator= (vec<N, T, Q> const& ...
method GLM_FUNC_QUALIFIER (line 96) | GLM_FUNC_QUALIFIER void operator -= (vec<N, T, Q> const& that)
method GLM_FUNC_QUALIFIER (line 101) | GLM_FUNC_QUALIFIER void operator += (vec<N, T, Q> const& that)
method GLM_FUNC_QUALIFIER (line 106) | GLM_FUNC_QUALIFIER void operator *= (vec<N, T, Q> const& that)
method GLM_FUNC_QUALIFIER (line 111) | GLM_FUNC_QUALIFIER void operator /= (vec<N, T, Q> const& that)
method GLM_FUNC_QUALIFIER (line 116) | GLM_FUNC_QUALIFIER T& operator[](size_t i)
method GLM_FUNC_QUALIFIER (line 121) | GLM_FUNC_QUALIFIER T operator[](size_t i) const
method GLM_FUNC_QUALIFIER (line 129) | GLM_FUNC_QUALIFIER void _apply_op(vec<N, T, Q> const& that, const ...
type _swizzle_base2<N, T, Q, E0,E1,E2,E3, 1> (line 144) | struct _swizzle_base2<N, T, Q, E0,E1,E2,E3, 1> : public _swizzle_bas...
type Stub (line 146) | struct Stub {}
method GLM_FUNC_QUALIFIER (line 148) | GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const&) { retur...
method GLM_FUNC_QUALIFIER (line 150) | GLM_FUNC_QUALIFIER T operator[] (size_t i) const
type _swizzle (line 158) | struct _swizzle : public _swizzle_base2<N, T, Q, E0, E1, E2, E3, (E0...
method GLM_FUNC_QUALIFIER (line 164) | GLM_FUNC_QUALIFIER operator vec<N, T, Q> () const { return (*this)...
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/detail/_vectorize.hpp
type glm (line 3) | namespace glm{
type detail (line 4) | namespace detail
type functor1 (line 7) | struct functor1{}
type functor1<vec, 1, R, T, Q> (line 10) | struct functor1<vec, 1, R, T, Q>
method call (line 12) | static vec<1, R, Q> call(R (*Func) (T x), vec<1, T, Q> const& v)
type functor1<vec, 2, R, T, Q> (line 19) | struct functor1<vec, 2, R, T, Q>
method call (line 21) | static vec<2, R, Q> call(R (*Func) (T x), vec<2, T, Q> const& v)
type functor1<vec, 3, R, T, Q> (line 28) | struct functor1<vec, 3, R, T, Q>
method call (line 30) | static vec<3, R, Q> call(R (*Func) (T x), vec<3, T, Q> const& v)
type functor1<vec, 4, R, T, Q> (line 37) | struct functor1<vec, 4, R, T, Q>
method call (line 39) | static vec<4, R, Q> call(R (*Func) (T x), vec<4, T, Q> const& v)
type functor2 (line 46) | struct functor2{}
type functor2<vec, 1, T, Q> (line 49) | struct functor2<vec, 1, T, Q>
method call (line 51) | call(T (*Func) (T x, T y), vec<1, T, Q> const& a, vec<1, T, Q> con...
type functor2<vec, 2, T, Q> (line 58) | struct functor2<vec, 2, T, Q>
method call (line 60) | call(T (*Func) (T x, T y), vec<2, T, Q> const& a, vec<2, T, Q> con...
type functor2<vec, 3, T, Q> (line 67) | struct functor2<vec, 3, T, Q>
method call (line 69) | call(T (*Func) (T x, T y), vec<3, T, Q> const& a, vec<3, T, Q> con...
type functor2<vec, 4, T, Q> (line 76) | struct functor2<vec, 4, T, Q>
method call (line 78) | call(T (*Func) (T x, T y), vec<4, T, Q> const& a, vec<4, T, Q> con...
type functor2_vec_sca (line 85) | struct functor2_vec_sca{}
type functor2_vec_sca<vec, 1, T, Q> (line 88) | struct functor2_vec_sca<vec, 1, T, Q>
method call (line 90) | call(T (*Func) (T x, T y), vec<1, T, Q> const& a, T b)
type functor2_vec_sca<vec, 2, T, Q> (line 97) | struct functor2_vec_sca<vec, 2, T, Q>
method call (line 99) | call(T (*Func) (T x, T y), vec<2, T, Q> const& a, T b)
type functor2_vec_sca<vec, 3, T, Q> (line 106) | struct functor2_vec_sca<vec, 3, T, Q>
method call (line 108) | call(T (*Func) (T x, T y), vec<3, T, Q> const& a, T b)
type functor2_vec_sca<vec, 4, T, Q> (line 115) | struct functor2_vec_sca<vec, 4, T, Q>
method call (line 117) | call(T (*Func) (T x, T y), vec<4, T, Q> const& a, T b)
type functor2_vec_int (line 124) | struct functor2_vec_int {}
type functor2_vec_int<1, T, Q> (line 127) | struct functor2_vec_int<1, T, Q>
method call (line 129) | call(int (*Func) (T x, int y), vec<1, T, Q> const& a, vec<1, int, ...
type functor2_vec_int<2, T, Q> (line 136) | struct functor2_vec_int<2, T, Q>
method call (line 138) | call(int (*Func) (T x, int y), vec<2, T, Q> const& a, vec<2, int, ...
type functor2_vec_int<3, T, Q> (line 145) | struct functor2_vec_int<3, T, Q>
method call (line 147) | call(int (*Func) (T x, int y), vec<3, T, Q> const& a, vec<3, int, ...
type functor2_vec_int<4, T, Q> (line 154) | struct functor2_vec_int<4, T, Q>
method call (line 156) | call(int (*Func) (T x, int y), vec<4, T, Q> const& a, vec<4, int, ...
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/detail/compute_common.hpp
type glm (line 6) | namespace glm{
type detail (line 7) | namespace detail
type compute_abs (line 10) | struct compute_abs
type compute_abs<genFIType, true> (line 14) | struct compute_abs<genFIType, true>
method genFIType (line 16) | static genFIType call(genFIType x)
type compute_abs<float, true> (line 29) | struct compute_abs<float, true>
method call (line 31) | static float call(float x)
type compute_abs<genFIType, false> (line 39) | struct compute_abs<genFIType, false>
method genFIType (line 41) | static genFIType call(genFIType x)
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_party/glm/glm/detail/compute_vector_relational.hpp
type glm (line 7) | namespace glm{
type detail (line 8) | namespace detail
type compute_equal (line 11) | struct compute_equal
method call (line 13) | static bool call(T a, T b)
FILE: field_construction/submodules/diff-langsurf-rasterizer/third_pa
Copy disabled (too large)
Download .json
Condensed preview — 1984 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (22,318K chars).
[
{
"path": ".gitignore",
"chars": 50,
"preview": ".vscode\n*.log\n**/__pycache__/\n**/data/\n**/output/\n"
},
{
"path": "LICENSE",
"chars": 1068,
"preview": "MIT License\n\nCopyright (c) 2025 Fangfu-0830\n\nPermission is hereby granted, free of charge, to any person obtaining a cop"
},
{
"path": "README.md",
"chars": 5221,
"preview": "<div align=\"center\">\n\n# ✨LangScene-X: Reconstruct Generalizable 3D Language-Embedded Scenes with TriMap Video Diffusion✨"
},
{
"path": "auto-seg/auto-mask-align.py",
"chars": 25936,
"preview": "import argparse\nimport os\nimport random\n\nimport cv2\nimport imageio\nimport matplotlib.pyplot as plt\nimport numpy as np\nim"
},
{
"path": "auto-seg/sam2/__init__.py",
"chars": 303,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/automatic_mask_generator.py",
"chars": 18461,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/build_sam.py",
"chars": 4779,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/csrc/connected_components.cu",
"chars": 7808,
"preview": "// Copyright (c) Meta Platforms, Inc. and affiliates.\n// All rights reserved.\n\n// This source code is licensed under the"
},
{
"path": "auto-seg/sam2/modeling/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/backbones/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/backbones/hieradet.py",
"chars": 9053,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/backbones/image_encoder.py",
"chars": 4675,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/backbones/utils.py",
"chars": 3053,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/memory_attention.py",
"chars": 5509,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/memory_encoder.py",
"chars": 5657,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/position_encoding.py",
"chars": 8361,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam/mask_decoder.py",
"chars": 12720,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam/prompt_encoder.py",
"chars": 7016,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam/transformer.py",
"chars": 12870,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam2_base.py",
"chars": 44207,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/modeling/sam2_utils.py",
"chars": 5727,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/sam2_image_predictor.py",
"chars": 19937,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/sam2_video_predictor.py",
"chars": 47896,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/utils/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/utils/amg.py",
"chars": 12842,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/utils/misc.py",
"chars": 10621,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2/utils/transforms.py",
"chars": 4899,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2_configs/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/sam2_configs/sam2_hiera_b+.yaml",
"chars": 3548,
"preview": "# @package _global_\n\n# Model\nmodel:\n _target_: sam2.modeling.sam2_base.SAM2Base\n image_encoder:\n _target_: sam2.mod"
},
{
"path": "auto-seg/sam2_configs/sam2_hiera_l.yaml",
"chars": 3696,
"preview": "# @package _global_\n\n# Model\nmodel:\n _target_: sam2.modeling.sam2_base.SAM2Base\n image_encoder:\n _target_: sam2.mod"
},
{
"path": "auto-seg/sam2_configs/sam2_hiera_s.yaml",
"chars": 3659,
"preview": "# @package _global_\n\n# Model\nmodel:\n _target_: sam2.modeling.sam2_base.SAM2Base\n image_encoder:\n _target_: sam2.mod"
},
{
"path": "auto-seg/sam2_configs/sam2_hiera_t.yaml",
"chars": 3753,
"preview": "# @package _global_\n\n# Model\nmodel:\n _target_: sam2.modeling.sam2_base.SAM2Base\n image_encoder:\n _target_: sam2.mod"
},
{
"path": "auto-seg/sam2_hiera_l.yaml",
"chars": 3695,
"preview": "# @package _global_\n# model\nmodel:\n _target_: sam2.modeling.sam2_base.SAM2Base\n image_encoder:\n _target_: sam2.mode"
},
{
"path": "auto-seg/submodules/segment-anything-1/.gitignore",
"chars": 389,
"preview": ".nfs*\n\n# compilation and distribution\n__pycache__\n_ext\n*.pyc\n*.pyd\n*.so\n*.dll\n*.egg-info/\nbuild/\ndist/\nwheels/\n\n# pytorc"
},
{
"path": "auto-seg/submodules/segment-anything-1/README.md",
"chars": 291,
"preview": "# Segment-Anything-LangSplat\nThis is the modidied version of [SAM](https://github.com/facebookresearch/segment-anything)"
},
{
"path": "auto-seg/submodules/segment-anything-1/scripts/amg.py",
"chars": 7043,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/scripts/export_onnx_model.py",
"chars": 6250,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/__init__.py",
"chars": 427,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/automatic_mask_generator.py",
"chars": 23032,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/build_sam.py",
"chars": 2941,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/__init__.py",
"chars": 385,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/common.py",
"chars": 1479,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/image_encoder.py",
"chars": 14420,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/mask_decoder.py",
"chars": 6615,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/prompt_encoder.py",
"chars": 8594,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/sam.py",
"chars": 7226,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/modeling/transformer.py",
"chars": 8397,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/predictor.py",
"chars": 11649,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/utils/__init__.py",
"chars": 197,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/utils/amg.py",
"chars": 12802,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/utils/onnx.py",
"chars": 5812,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/segment_anything/utils/transforms.py",
"chars": 3972,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-1/setup.cfg",
"chars": 371,
"preview": "[isort]\nline_length=100\nmulti_line_output=3\ninclude_trailing_comma=True\nknown_standard_library=numpy,setuptools\nskip_glo"
},
{
"path": "auto-seg/submodules/segment-anything-1/setup.py",
"chars": 541,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-2/.clang-format",
"chars": 2544,
"preview": "AccessModifierOffset: -1\nAlignAfterOpenBracket: AlwaysBreak\nAlignConsecutiveAssignments: false\nAlignConsecutiveDeclarati"
},
{
"path": "auto-seg/submodules/segment-anything-2/.gitignore",
"chars": 104,
"preview": ".vscode/\n.DS_Store\n__pycache__/\n*-checkpoint.ipynb\n.venv\n*.egg*\nbuild/*\n_C.*\noutputs/*\ncheckpoints/*.pt\n"
},
{
"path": "auto-seg/submodules/segment-anything-2/.watchmanconfig",
"chars": 2,
"preview": "{}"
},
{
"path": "auto-seg/submodules/segment-anything-2/CODE_OF_CONDUCT.md",
"chars": 3541,
"preview": "# Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and"
},
{
"path": "auto-seg/submodules/segment-anything-2/CONTRIBUTING.md",
"chars": 1425,
"preview": "# Contributing to segment-anything\nWe want to make contributing to this project as easy and transparent as\npossible.\n\n##"
},
{
"path": "auto-seg/submodules/segment-anything-2/INSTALL.md",
"chars": 10579,
"preview": "## Installation\n\n### Requirements\n\n- Linux with Python ≥ 3.10, PyTorch ≥ 2.3.1 and [torchvision](https://github.com/pyto"
},
{
"path": "auto-seg/submodules/segment-anything-2/LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "auto-seg/submodules/segment-anything-2/LICENSE_cctorch",
"chars": 1566,
"preview": "BSD 3-Clause License\n\nCopyright (c) 2020, the respective contributors, as shown by the AUTHORS file.\nAll rights reserved"
},
{
"path": "auto-seg/submodules/segment-anything-2/MANIFEST.in",
"chars": 254,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed under the li"
},
{
"path": "auto-seg/submodules/segment-anything-2/README.md",
"chars": 15440,
"preview": "# SAM 2: Segment Anything in Images and Videos\n\n**[AI at Meta, FAIR](https://ai.meta.com/research/)**\n\n[Nikhila Ravi](ht"
},
{
"path": "auto-seg/submodules/segment-anything-2/backend.Dockerfile",
"chars": 2069,
"preview": "ARG BASE_IMAGE=pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime\nARG MODEL_SIZE=base_plus\n\nFROM ${BASE_IMAGE}\n\n# Gunicorn en"
},
{
"path": "auto-seg/submodules/segment-anything-2/checkpoints/download_ckpts.sh",
"chars": 2612,
"preview": "#!/bin/bash\n\n# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n\n# This source code is licensed"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/.gitignore",
"chars": 26,
"preview": "data/uploads\ndata/posters\n"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/README.md",
"chars": 4797,
"preview": "# SAM 2 Demo\n\nWelcome to the SAM 2 Demo! This project consists of a frontend built with React TypeScript and Vite and a "
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/backend/server/app.py",
"chars": 4070,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n# This source code is licensed under the lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/backend/server/app_conf.py",
"chars": 1587,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n# This source code is licensed under the lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/backend/server/inference/data_types.py",
"chars": 3060,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n# This source code is licensed under the lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/backend/server/inference/multipart.py",
"chars": 1593,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n# This source code is licensed under the lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/backend/server/inference/predictor.py",
"chars": 17062,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n# All rights reserved.\n# This source code is licensed under the lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.babelrc",
"chars": 102,
"preview": "{\n \"env\": {\n \"production\": {\n \"plugins\": [\"babel-plugin-strip-invariant\"]\n }\n }\n}"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.dockerignore",
"chars": 357,
"preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndis"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.eslintignore",
"chars": 28,
"preview": "node_modules/\ndist/\nenv.d.ts"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.eslintrc.cjs",
"chars": 1714,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.gitignore",
"chars": 357,
"preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndis"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.prettierignore",
"chars": 19,
"preview": "node_modules/\ndist/"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.prettierrc.json",
"chars": 171,
"preview": "{\n \"arrowParens\": \"avoid\",\n \"bracketSameLine\": true,\n \"bracketSpacing\": false,\n \"singleQuote\": true,\n \"tabWidth\": 2"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/.watchmanconfig",
"chars": 3,
"preview": "{}\n"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/frontend.Dockerfile",
"chars": 531,
"preview": "# Stage 1: Build Stage\nFROM node:22.9.0 AS build\n\nWORKDIR /app\n\n# Copy package.json and yarn.lock\nCOPY package.json ./\nC"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/index.html",
"chars": 342,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta\n name=\"viewport\"\n content=\"wi"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/package.json",
"chars": 3012,
"preview": "{\n \"name\": \"frontend-vite\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vit"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/postcss.config.js",
"chars": 758,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/schema.graphql",
"chars": 4039,
"preview": "input AddPointsInput {\n sessionId: String!\n frameIndex: Int!\n clearOldPoints: Boolean!\n objectId: Int!\n labels: [In"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/schemas/inference-api-schema.graphql",
"chars": 2152,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/schemas/merge-schemas.ts",
"chars": 1264,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/schemas/video-api-schema.graphql",
"chars": 3079,
"preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/App.tsx",
"chars": 1087,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/assets/scss/App.scss",
"chars": 6302,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"Li"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/VideoDecoder.ts",
"chars": 9254,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/VideoEncoder.ts",
"chars": 4671,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/codecs/WebCodecUtils.ts",
"chars": 1690,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/MobileFirstClickBanner.tsx",
"chars": 2222,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/Tooltip.tsx",
"chars": 1180,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/AddObjectButton.tsx",
"chars": 1968,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ClearAllPointsInVideoButton.tsx",
"chars": 2492,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/CloseSessionButton.tsx",
"chars": 1216,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/FirstClickView.tsx",
"chars": 1794,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/LimitNotice.tsx",
"chars": 1050,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsList.tsx",
"chars": 2442,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsToolbar.tsx",
"chars": 1876,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/MobileObjectsToolbarHeader.tsx",
"chars": 1662,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectActions.tsx",
"chars": 3441,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectPlaceholder.tsx",
"chars": 1438,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectThumbnail.tsx",
"chars": 1207,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectUtils.ts",
"chars": 773,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbar.tsx",
"chars": 2754,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbarBottomActions.tsx",
"chars": 1916,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ObjectsToolbarHeader.tsx",
"chars": 1757,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/PointsToggle.tsx",
"chars": 1755,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/PrimaryCTAButton.tsx",
"chars": 1229,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ToolbarObject.tsx",
"chars": 2688,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/ToolbarObjectContainer.tsx",
"chars": 3209,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/TrackletSwimlane.tsx",
"chars": 4492,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/TrackletsAnnotation.tsx",
"chars": 1691,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/annotations/useTracklets.ts",
"chars": 794,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/GradientBorder.tsx",
"chars": 1977,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/PlaybackButton.tsx",
"chars": 2859,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/PrimaryCTAButton.tsx",
"chars": 1229,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/ResponsiveButton.tsx",
"chars": 1022,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/button/TrackAndPlayButton.tsx",
"chars": 4068,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/code/InitializeLocalMonaco.ts",
"chars": 1205,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/BackgroundEffects.tsx",
"chars": 2476,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectVariantBadge.tsx",
"chars": 1200,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsCarousel.tsx",
"chars": 2999,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsCarouselShadow.tsx",
"chars": 1389,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbar.tsx",
"chars": 1774,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbarBottomActions.tsx",
"chars": 1615,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsToolbarHeader.tsx",
"chars": 2235,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/EffectsUtils.ts",
"chars": 2330,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/HighlightEffects.tsx",
"chars": 2506,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/MobileEffectsToolbar.tsx",
"chars": 4141,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/effects/MoreFunEffects.tsx",
"chars": 2078,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/ChangeVideoModal.tsx",
"chars": 2518,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DefaultVideoGalleryModalTrigger.tsx",
"chars": 1145,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DemoVideoGallery.tsx",
"chars": 5748,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/DemoVideoGalleryModal.tsx",
"chars": 4137,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/VideoGalleryUploadPhoto.tsx",
"chars": 3146,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/VideoPhoto.tsx",
"chars": 3024,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/DemoVideoGalleryModalQuery.graphql.ts",
"chars": 9059,
"preview": "/**\n * @generated SignedSource<<db7e183e1996cf656749b4e33c2424e6>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:di"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/DemoVideoGalleryQuery.graphql.ts",
"chars": 3876,
"preview": "/**\n * @generated SignedSource<<20d31a82b5f3b251b0e42b4f0e3522b8>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:di"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/__generated__/useUploadVideoMutation.graphql.ts",
"chars": 3056,
"preview": "/**\n * @generated SignedSource<<76014dced98d6c8989e7322712e38963>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:di"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/gallery/useUploadVideo.ts",
"chars": 3459,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/icons/GitHubIcon.tsx",
"chars": 1626,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/DownloadOption.tsx",
"chars": 1090,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/GalleryOption.tsx",
"chars": 1488,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/MoreOptionsToolbar.tsx",
"chars": 2129,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/MoreOptionsToolbarBottomActions.tsx",
"chars": 1632,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/OptionButton.tsx",
"chars": 2509,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/ShareSection.tsx",
"chars": 796,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/ShareUtils.ts",
"chars": 1316,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/TryAnotherVideoSection.tsx",
"chars": 2150,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/UploadOption.tsx",
"chars": 2722,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/__generated__/GetLinkOptionShareVideoMutation.graphql.ts",
"chars": 2026,
"preview": "/**\n * @generated SignedSource<<39d7e92a6c15de1583c90ae21a7825e5>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:di"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/options/useDownloadVideo.ts",
"chars": 2883,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/RestartSessionButton.tsx",
"chars": 1323,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/__generated__/useCloseSessionBeforeUnloadMutation.graphql.ts",
"chars": 2148,
"preview": "/**\n * @generated SignedSource<<f56872c0a8b65fa7e9bdaff351930ff0>>\n * @lightSyntaxTransform\n * @nogrep\n */\n\n/* tslint:di"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/useCloseSessionBeforeUnload.ts",
"chars": 2746,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/session/useRestartSession.ts",
"chars": 2098,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/DemoMessagesSnackbarUtils.ts",
"chars": 2867,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/MessagesSnackbar.tsx",
"chars": 3324,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/snackbarAtoms.ts",
"chars": 952,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useDemoMessagesSnackbar.ts",
"chars": 1673,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useExpireMessage.ts",
"chars": 2057,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/snackbar/useMessagesSnackbar.ts",
"chars": 1687,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/DesktopToolbar.tsx",
"chars": 1598,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/MobileToolbar.tsx",
"chars": 1360,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/Toolbar.tsx",
"chars": 3082,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarActionIcon.tsx",
"chars": 3033,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarBottomActionsWrapper.tsx",
"chars": 1224,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarConfig.tsx",
"chars": 743,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarHeaderWrapper.tsx",
"chars": 1421,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarProgressChip.tsx",
"chars": 1727,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/ToolbarSection.tsx",
"chars": 1069,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/useListenToStreamingState.ts",
"chars": 2125,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/toolbar/useToolbarTabs.ts",
"chars": 860,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/useFunctionThrottle.tsx",
"chars": 2894,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/ChangeVideoModal.tsx",
"chars": 2518,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/EventEmitter.ts",
"chars": 1711,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/Video.tsx",
"chars": 10781,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoFilmstripWithPlayback.tsx",
"chars": 1561,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoLoadingOverlay.tsx",
"chars": 1631,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorker.ts",
"chars": 4399,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerBridge.ts",
"chars": 13919,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerContext.ts",
"chars": 24944,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/VideoWorkerTypes.ts",
"chars": 3443,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/DemoVideoEditor.tsx",
"chars": 10090,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/ImageUtils.ts",
"chars": 3594,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/VideoEditor.tsx",
"chars": 2888,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/VideoEditorUtils.ts",
"chars": 7318,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/atoms.ts",
"chars": 738,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useResetEditor.ts",
"chars": 2826,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useVideo.ts",
"chars": 765,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/editor/useVideoEffect.ts",
"chars": 2595,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/ArrowGLEffect.ts",
"chars": 4817,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BackgroundBlurEffect.ts",
"chars": 2666,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "auto-seg/submodules/segment-anything-2/demo/frontend/src/common/components/video/effects/BackgroundTextEffect.ts",
"chars": 2701,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
}
]
// ... and 1784 more files (download for full content)
About this extraction
This page contains the full source code of the liuff19/LangScene-X GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1984 files (20.0 MB), approximately 5.4M tokens, and a symbol index with 5282 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.