Skip to content

Instantly share code, notes, and snippets.

View botcs's full-sized avatar

Csaba Botos botcs

  • PhD @ Torr Vision Group
  • Oxford, UK
View GitHub Profile
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"from pycocotools.coco import COCO\n",
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"from pycocotools.coco import COCO\n",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@botcs
botcs / delayed_mirror.py
Last active April 22, 2020 18:17
a delayed mirror with minimal rewind functionality
import numpy as np
import cv2
import time
cap = cv2.VideoCapture(0)
FRAME_DELAY = 120
cv2.namedWindow('frame', cv2.WINDOW_FREERATIO)
# cv2.setWindowProperty('frame', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
bottom_up_features, expt_flops, real_flops, gate_tensor = self.backbone(x, step_rate)
File "/data/engs-tvg-depth/csbotos/miniconda3/envs/dyndet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/csbotos/github/fbscript/DynamicRouting/./dl_lib/modeling/dynamic_arch/dynamic_backbone.py", line 300, in forward
self.all_cell_list[layer_index][_cell_index](
File "/data/engs-tvg-depth/csbotos/miniconda3/envs/dyndet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/csbotos/github/fbscript/DynamicRouting/./dl_lib/modeling/dynamic_arch/dynamic_cell.py", line 273, in forward
result_list[2].append(h_l_down * gate_weights_beta_down)
(function _print_stack)
@botcs
botcs / io_benchmark.sh
Created June 14, 2023 02:01
measuring IO with 1k samples of 1MB
#!/bin/bash
directory=$1 # Replace with your designated directory
# Function to measure write time
measure_write_time() {
local file="$1"
local start_time=$(date +%s%N)
dd if=/dev/zero of="$file" bs=1M count=1 status=none
local end_time=$(date +%s%N)
432908 <empty>
432909 <empty>
432910 <empty>
432911 <empty>
432912 <empty>
432913 <empty>
432914 <empty>
432915 <empty>
432916 <empty>
432917 <empty>
from PIL import Image
import numpy as np
import torch
import torchvision.transforms.functional as F
from torchvision import transforms as T
from torchvision.transforms.functional import _interpolation_modes_from_int, InterpolationMode
import math
from torchvision.transforms.transforms import _setup_size, _log_api_usage_once
from collections.abc import Sequence
from typing import List, Optional, Tuple, Union
class FinalScoreAnnotator:
"""
1) Adds annotations of the last values of the curves
2) Aligns the annotations of the plot to avoid overlaps using L-BFGS-B
Usage:
Has the same signature and functionality as the plt.plot or ax.plot
"""
def __init__(self, ax=None):