Skip to content

Instantly share code, notes, and snippets.

View revantteotia's full-sized avatar

Revant Teotia revantteotia

View GitHub Profile
@revantteotia
revantteotia / ddp_example.py
Created July 12, 2021 06:47 — forked from sgraaf/ddp_example.py
PyTorch Distributed Data Parallel (DDP) example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.utils.data import DataLoader, Dataset
from torch.utils.data.distributed import DistributedSampler
from transformers import BertForMaskedLM
@revantteotia
revantteotia / unNormalize.py
Created May 9, 2021 15:10
UnNormalize an image tensor
class UnNormalize(object):
def __init__(self, mean, std):
self.mean = mean
self.std = std
def __call__(self, tensor):
"""
Args:
tensor (Tensor): Tensor image of size (C, H, W) to be normalized.
Returns:
@revantteotia
revantteotia / extract_FRCNN_feats.py
Last active December 16, 2022 06:07
Extract Faster R-CNN Features: detect objects and their faster rcnn features in images
###################################################
# Steps before running the scripts:
# 1. first install maskrcnn-benchmark : FRCNN Model
# $ git clone https://gitlab.com/meetshah1995/vqa-maskrcnn-benchmark.git
# $ cd vqa-maskrcnn-benchmark
# $ python setup.py build
# $ python setup.py develop
@revantteotia
revantteotia / frcnn-feat-extraction.ipynb
Created December 26, 2020 17:59
frcnn-feat-extraction.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.