Last active
May 10, 2024 05:54
-
-
Save ariG23498/475f782e25a9b2b86647381929e165b7 to your computer and use it in GitHub Desktop.
torch distribtuions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/ariG23498/475f782e25a9b2b86647381929e165b7/scratchpad.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 36, | |
"metadata": { | |
"id": "lIYdn1woOS1n" | |
}, | |
"outputs": [], | |
"source": [ | |
"from PIL import Image\n", | |
"import requests\n", | |
"import numpy as np\n", | |
"import torch\n", | |
"from matplotlib import pyplot as plt" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"url = 'http://images.cocodataset.org/val2017/000000039769.jpg'\n", | |
"pil_image = Image.open(requests.get(url, stream=True).raw) # PIL image of shape HWC\n", | |
"pil_image" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 497 | |
}, | |
"id": "0BX2KPCy_EhZ", | |
"outputId": "ab42aa7f-a6ba-4d9c-9238-6453f1b15bb2" | |
}, | |
"execution_count": 30, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=640x480>" | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment