Skip to content

Instantly share code, notes, and snippets.

@ariG23498
Last active May 10, 2024 05:54
Show Gist options
  • Save ariG23498/475f782e25a9b2b86647381929e165b7 to your computer and use it in GitHub Desktop.
Save ariG23498/475f782e25a9b2b86647381929e165b7 to your computer and use it in GitHub Desktop.
torch distribtuions
Display the source blob
Display the rendered blob
Raw
{
"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