Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

ai2thor-colab

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai2thor-colab - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+1
-1
ai2thor_colab.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: ai2thor-colab
Version: 0.1.0
Version: 0.1.1
Summary: Utility functions for using AI2-THOR with Google Colab.

@@ -5,0 +5,0 @@ Home-page: https://github.com/allenai/ai2thor-colab

numpy
moviepy
pandas
ai2thor
Pillow

@@ -19,6 +19,9 @@ from IPython.display import HTML, display

from typing import Optional
import ai2thor.server
from typing import Union
from PIL import Image
import matplotlib.pyplot as plt
__version__ = "0.1.0"
__version__ = "0.1.1"
__all__ = ["plot_frames", "show_video", "start_xserver", "overlay", "side_by_side"]

@@ -132,3 +135,3 @@

def plot_frames(event: object) -> None:
def plot_frames(event: Union[ai2thor.server.Event, np.ndarray]) -> None:
"""Visualize all the frames on an AI2-THOR Event.

@@ -139,51 +142,63 @@

"""
frames = dict()
third_person_frames = event.third_party_camera_frames
if event.frame is not None:
frames["RGB"] = event.frame
if event.instance_segmentation_frame is not None:
frames["Instance Segmentation"] = event.instance_segmentation_frame
if event.semantic_segmentation_frame is not None:
frames["Semantic Segmentation"] = event.semantic_segmentation_frame
if event.normals_frame is not None:
frames["Normals"] = event.normals_frame
if event.depth_frame is not None:
frames["Depth"] = event.depth_frame
if isinstance(event, ai2thor.server.Event):
frames = dict()
third_person_frames = event.third_party_camera_frames
if event.frame is not None:
frames["RGB"] = event.frame
if event.instance_segmentation_frame is not None:
frames["Instance Segmentation"] = event.instance_segmentation_frame
if event.semantic_segmentation_frame is not None:
frames["Semantic Segmentation"] = event.semantic_segmentation_frame
if event.normals_frame is not None:
frames["Normals"] = event.normals_frame
if event.depth_frame is not None:
frames["Depth"] = event.depth_frame
if len(frames) == 0:
raise Exception("No agent frames rendered on this event!")
if len(frames) == 0:
raise Exception("No agent frames rendered on this event!")
rows = 2 if len(third_person_frames) else 1
cols = max(len(frames), len(third_person_frames))
fig, axs = plt.subplots(
nrows=rows, ncols=cols, dpi=150, figsize=(3 * cols, 3 * rows)
)
rows = 2 if len(third_person_frames) else 1
cols = max(len(frames), len(third_person_frames))
fig, axs = plt.subplots(
nrows=rows, ncols=cols, dpi=150, figsize=(3 * cols, 3 * rows)
)
agent_row = axs[0] if rows > 1 else axs
agent_row = axs[0] if rows > 1 else axs
for i, (name, frame) in enumerate(frames.items()):
ax = agent_row[i] if cols > 1 else agent_row
im = ax.imshow(frame)
ax.axis("off")
ax.set_title(name)
for i, (name, frame) in enumerate(frames.items()):
ax = agent_row[i] if cols > 1 else agent_row
im = ax.imshow(frame)
ax.axis("off")
ax.set_title(name)
if name == "Depth":
fig.colorbar(im, fraction=0.046, pad=0.04, ax=ax)
if name == "Depth":
fig.colorbar(im, fraction=0.046, pad=0.04, ax=ax)
# set unused axes off
for i in range(len(frames), cols):
agent_row[i].axis("off")
# set unused axes off
for i in range(len(frames), cols):
agent_row[i].axis("off")
# add third party camera frames
if rows > 1:
for i, frame in enumerate(third_person_frames):
ax = axs[1][i] if cols > 1 else axs[1]
ax.imshow(frame)
ax.axis("off")
for i in range(len(third_person_frames), cols):
axs[1][i].axis("off")
# add third party camera frames
if rows > 1:
for i, frame in enumerate(third_person_frames):
ax = axs[1][i] if cols > 1 else axs[1]
ax.imshow(frame)
ax.axis("off")
for i in range(len(third_person_frames), cols):
axs[1][i].axis("off")
fig.text(x=0.1, y=0.715, s="Agent Frames", rotation="vertical", va="center")
fig.text(
x=0.1, y=0.3025, s="Third Person Frames", rotation="vertical", va="center"
fig.text(x=0.1, y=0.715, s="Agent Frames", rotation="vertical", va="center")
fig.text(
x=0.1,
y=0.3025,
s="Third Person Frames",
rotation="vertical",
va="center",
)
elif isinstance(event, np.ndarray):
return Image.fromarray(event)
else:
raise Exception(
f"Unknown type: {type(event)}. "
"Must be np.ndarray or ai2thor.server.Event."
)

@@ -190,0 +205,0 @@

Metadata-Version: 2.1
Name: ai2thor_colab
Version: 0.1.0
Version: 0.1.1
Summary: Utility functions for using AI2-THOR with Google Colab.

@@ -5,0 +5,0 @@ Home-page: https://github.com/allenai/ai2thor-colab

from setuptools import setup
version = "0.1.0"
version = "0.1.1"

@@ -18,3 +18,3 @@ with open("README.md", encoding="utf-8") as f:

author="Allen Institute for AI",
install_requires=["numpy", "moviepy", "pandas"],
install_requires=["numpy", "moviepy", "pandas", "ai2thor", "Pillow"],
url="https://github.com/allenai/ai2thor-colab",

@@ -32,2 +32,2 @@ classifiers=[

],
)
)