ConvNeXt(
(stem): Sequential(
(0): Conv2d(3, 128, kernel_size=(4, 4), stride=(4, 4))
(1): LayerNorm2d((128,), eps=1e-06, elementwise_affine=True)
)
(stages): Sequential(
(0): ConvNeXtStage(
(downsample): Identity()
(blocks): Sequential(
This file contains 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
-- Ensure the extension is made | |
CREATE EXTENSION IF NOT EXISTS vectorscale CASCADE; | |
-- Create the collection table | |
CREATE TABLE collection ( | |
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | |
name TEXT NOT NULL | |
); | |
-- Create the asset table with a foreign key to the collection table |
This file contains 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
-- Dataset Params | |
SET app.num_collections TO 30; | |
SET app.num_assets_per_collection TO 50; | |
SET app.num_segments_per_asset TO 300; | |
-- BUILD DATASET | |
-- Ensure the extension is made | |
DROP EXTENSION IF EXISTS vectors; | |
CREATE EXTENSION vectors; |
This file contains 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
import timm | |
import torch | |
import torch.distributed as dist | |
import torch.nn as nn | |
from upyog.imports import * | |
from yolox.exp.yolox_base import Exp as DefaultBaseExp | |
from yolox.models import YOLOPAFPN, YOLOX, YOLOXHead | |
from yolox.utils import get_local_rank, wait_for_the_master |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
import fastcore.all as fastcore | |
import PIL | |
@fastcore.patch | |
def __or__(self: PIL.Image.Image, other: PIL.Image.Image): | |
"Horizontally stack two PIL Images" | |
assert isinstance(other, PIL.Image.Image) | |
widths, heights = zip(*(i.size for i in [self, other])) | |
new_img = PIL.Image.new("RGB", (sum(widths), max(heights))) |
This file contains 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
from PIL import Image, ImageFile | |
ImageFile.LOAD_TRUNCATED_IMAGES = True | |
img_path = "image.jpg" | |
lut_path = "lut.cube" | |
img = Image.open(img_path) # .convert("RGB") | |
lut = read_lut(lut_path) | |
# This returns a PIL Image with the LUT applied |
This file contains 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
import torch, torchvision | |
from onnxruntime import InferenceSession | |
model = torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained=True) | |
x = torch.rand(1, 3, 360, 640) | |
torch.onnx.export( | |
model, | |
x, # ONNX requires fixed input size | |
"test-mask-rcnn-export.onnx", |
This file contains 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
# !pip install pyav | |
import av | |
PATH_VIDEO = "..." | |
container = av.open(PATH_VIDEO) | |
video_stream = container.streams.video[0] | |
video_decoder = container.decode(video_stream) | |
for frame in video_decoder: |
This file contains 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
from icevision.visualize.draw_data import draw_bbox | |
# import a bunch of other stuff here | |
cmap_path = "zz_color_map_coco.json" | |
with open(cmap_path) as f: | |
COLOR_MAP_COCO = json.load(f) | |
COLOR_MAP_COCO = { | |
k: np.array(v).astype(np.float) for k, v in COLOR_MAP_COCO.items() | |
} |
NewerOlder