pytorch / pytorch/vision

JIT compatible way to convert base64 encoded image to a Tensor

Open
#6,878 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

Hello -
I have an image which is encoded as a base64 string. I want to take this string as an input and convert it to a Tensor.

How can I achieve this in a way which is torchscriptable?

So far, I have tried the two step process: 1) Convert base64 encoded image to Pillow Image using pillow library, 2) convert PIL Image to Tensor using transformations provided in torchvision
However, this approach is not torchscript compatible.

Any recommendations on how to do this in torchscript-compatible manner?

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue describes converting a base64-encoded image string to a Tensor in a TorchScript-compatible way, but it does not name files, tests, or an entry point. Start by locating existing image decoding and TorchScript-supported transform code in the repository. Done would require an agreed implementation and tests demonstrating that the conversion works under TorchScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.