{"id":18764162,"url":"https://github.com/peterl1n/backgroundmattingv2-tensorflow","last_synced_at":"2026-03-08T06:31:30.471Z","repository":{"id":50330660,"uuid":"317376724","full_name":"PeterL1n/BackgroundMattingV2-TensorFlow","owner":"PeterL1n","description":"TensorFlow implementation of Real-Time High-Resolution Background Matting","archived":false,"fork":false,"pushed_at":"2021-01-06T03:42:12.000Z","size":11,"stargazers_count":79,"open_issues_count":1,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T04:51:33.308Z","etag":null,"topics":["computer-vision","machine-learning","matting"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PeterL1n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-30T23:59:53.000Z","updated_at":"2025-02-17T09:07:54.000Z","dependencies_parsed_at":"2022-07-30T22:08:02.615Z","dependency_job_id":null,"html_url":"https://github.com/PeterL1n/BackgroundMattingV2-TensorFlow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PeterL1n/BackgroundMattingV2-TensorFlow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterL1n%2FBackgroundMattingV2-TensorFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterL1n%2FBackgroundMattingV2-TensorFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterL1n%2FBackgroundMattingV2-TensorFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterL1n%2FBackgroundMattingV2-TensorFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PeterL1n","download_url":"https://codeload.github.com/PeterL1n/BackgroundMattingV2-TensorFlow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterL1n%2FBackgroundMattingV2-TensorFlow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30247325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T05:41:50.788Z","status":"ssl_error","status_checked_at":"2026-03-08T05:41:39.075Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","machine-learning","matting"],"created_at":"2024-11-07T18:28:54.532Z","updated_at":"2026-03-08T06:31:30.418Z","avatar_url":"https://github.com/PeterL1n.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time High-Resolution Background Matting (TensorFlow)\n\nThis repo contains TensorFlow 2 implementation of Real-Time High-Resolution Background Matting. For more information and downloading the weights, please visit our [official repo](https://github.com/PeterL1n/BackgroundMattingV2).\n\nThe TensorFlow implementation is experimental. We find PyTorch to have faster inference speed and suggest you to use the official PyTorch version whenever possible.\n\n## Use our model\n\nWe reimplement our model natively in TensorFlow 2 and provide a script to load PyTorch weights directly into the TensorFlow model.\n\n```python\nimport tensorflow as tf\nimport torch # For loading PyTorch weights.\n\nfrom model import MattingRefine, load_torch_weights\n\n# Enable mixed precision, it reduces memory and may make model inference faster.\ntf.config.optimizer.set_experimental_options({\"auto_mixed_precision\": True})\n\n# Create TensorFlow model\nmodel = MattingRefine(backbone='resnet50',\n                      backbone_scale=0.25,\n                      refine_mode='sampling',\n                      refine_sample_pixels=80000)\n\n# Load PyTorch weights into TensorFlow model.\nload_torch_weights(model, torch.load('PATH_TO_PYTORCH_WEIGHTS.pth'))\n\nsrc = tf.random.normal((1, 1080, 1920, 3))\nbgr = tf.random.normal((1, 1080, 1920, 3))\n\n# Faster inference with tf.function\n# Note that at the first time the model run with\n# tf.function will be slow.\nmodel = tf.function(model, experimental_relax_shapes=True)\n\npha, fgr = model([src, bgr], training=False)[:2]\n```\n\n## Download weights\n\nPlease visit the [official repo](https://github.com/PeterL1n/BackgroundMattingV2) for detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterl1n%2Fbackgroundmattingv2-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterl1n%2Fbackgroundmattingv2-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterl1n%2Fbackgroundmattingv2-tensorflow/lists"}