repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
bottom-up-attention | bottom-up-attention-master/caffe/tools/extra/resize_and_crop_images.py | #!/usr/bin/env python
from mincepie import mapreducer, launcher
import gflags
import os
import cv2
from PIL import Image
# gflags
gflags.DEFINE_string('image_lib', 'opencv',
'OpenCV or PIL, case insensitive. The default value is the faster OpenCV.')
gflags.DEFINE_string('input_folder', '',
... | 4,541 | 40.290909 | 99 | py |
bottom-up-attention | bottom-up-attention-master/caffe/tools/extra/parse_log.py | #!/usr/bin/env python
"""
Parse training log
Evolved from parse_log.sh
"""
import os
import re
import extract_seconds
import argparse
import csv
from collections import OrderedDict
def parse_log(path_to_log):
"""Parse log file
Returns (train_dict_list, test_dict_list)
train_dict_list and test_dict_lis... | 7,114 | 32.720379 | 86 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/web_demo/app.py | import os
import time
import cPickle
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
import numpy as np
import pandas as pd
from PIL import Image
import cStringIO as StringIO
import urllib
import exifutil
import caffe
REPO_DIRNAME = os.path.abs... | 7,793 | 33.184211 | 105 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/web_demo/exifutil.py | """
This script handles the skimage exif problem.
"""
from PIL import Image
import numpy as np
ORIENTATIONS = { # used in apply_orientation
2: (Image.FLIP_LEFT_RIGHT,),
3: (Image.ROTATE_180,),
4: (Image.FLIP_TOP_BOTTOM,),
5: (Image.FLIP_LEFT_RIGHT, Image.ROTATE_90),
6: (Image.ROTATE_270,),
7... | 1,046 | 25.175 | 51 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/pycaffe/caffenet.py | from __future__ import print_function
from caffe import layers as L, params as P, to_proto
from caffe.proto import caffe_pb2
# helper function for common structures
def conv_relu(bottom, ks, nout, stride=1, pad=0, group=1):
conv = L.Convolution(bottom, kernel_size=ks, stride=stride,
... | 2,112 | 36.732143 | 91 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/pycaffe/tools.py | import numpy as np
class SimpleTransformer:
"""
SimpleTransformer is a simple class for preprocessing and deprocessing
images for caffe.
"""
def __init__(self, mean=[128, 128, 128]):
self.mean = np.array(mean, dtype=np.float32)
self.scale = 1.0
def set_mean(self, mean):
... | 3,457 | 27.344262 | 79 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/pycaffe/layers/pascal_multilabel_datalayers.py | # imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import caffe
import numpy as np
import os.path as osp
from xml.dom import minidom
from random import shuffle
from threading import Thread
from PIL import Image
from tools import SimpleTransformer
class PascalMultilabelDataLayerSync... | 6,846 | 30.552995 | 78 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/pycaffe/layers/pyloss.py | import caffe
import numpy as np
class EuclideanLossLayer(caffe.Layer):
"""
Compute the Euclidean Loss in the same manner as the C++ EuclideanLossLayer
to demonstrate the class interface for developing layers in Python.
"""
def setup(self, bottom, top):
# check input pair
if len(bo... | 1,223 | 31.210526 | 79 | py |
bottom-up-attention | bottom-up-attention-master/caffe/examples/finetune_flickr_style/assemble_data.py | #!/usr/bin/env python
"""
Form a subset of the Flickr Style data, download images to dirname, and write
Caffe ImagesDataLayer training file.
"""
import os
import urllib
import hashlib
import argparse
import numpy as np
import pandas as pd
from skimage import io
import multiprocessing
# Flickr returns a special image i... | 3,636 | 35.737374 | 94 | py |
bottom-up-attention | bottom-up-attention-master/caffe/src/caffe/test/test_data/generate_sample_data.py | """
Generate data used in the HDF5DataLayer and GradientBasedSolver tests.
"""
import os
import numpy as np
import h5py
script_dir = os.path.dirname(os.path.abspath(__file__))
# Generate HDF5DataLayer sample_data.h5
num_cols = 8
num_rows = 10
height = 6
width = 5
total_size = num_cols * num_rows * height * width
da... | 2,104 | 24.670732 | 70 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/draw_net.py | #!/usr/bin/env python
"""
Draw a graph of the net architecture.
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from google.protobuf import text_format
import caffe
import caffe.draw
from caffe.proto import caffe_pb2
def parse_args():
"""Parse input arguments
"""
parser = Argument... | 1,934 | 31.79661 | 81 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/detect.py | #!/usr/bin/env python
"""
detector.py is an out-of-the-box windowed detector
callable from the command line.
By default it configures and runs the Caffe reference ImageNet model.
Note that this model was trained for image classification and not detection,
and finetuning for detection can be expected to improve results... | 5,734 | 31.95977 | 88 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/classify.py | #!/usr/bin/env python
"""
classify.py is an out-of-the-box image classifer callable from the command line.
By default it configures and runs the Caffe reference ImageNet model.
"""
import numpy as np
import os
import sys
import argparse
import glob
import time
import caffe
def main(argv):
pycaffe_dir = os.path.... | 4,262 | 29.669065 | 88 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/train.py | #!/usr/bin/env python
"""
Trains a model using one or more GPUs.
"""
from multiprocessing import Process
import caffe
def train(
solver, # solver proto definition
snapshot, # solver snapshot to restore
gpus, # list of device ids
timing=False, # show timing info for compute and com... | 3,145 | 30.148515 | 85 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/net_spec.py | """Python net specification.
This module provides a way to write nets directly in Python, using a natural,
functional style. See examples/pycaffe/caffenet.py for an example.
Currently this works as a thin wrapper around the Python protobuf interface,
with layers and parameters automatically generated for the "layers"... | 8,048 | 34.45815 | 88 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/classifier.py | #!/usr/bin/env python
"""
Classifier is an image classifier specialization of Net.
"""
import numpy as np
import caffe
class Classifier(caffe.Net):
"""
Classifier extends Net for image class prediction
by scaling, center cropping, or oversampling.
Parameters
----------
image_dims : dimensio... | 3,537 | 34.737374 | 78 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/coord_map.py | """
Determine spatial relationships between layers to relate their coordinates.
Coordinates are mapped from input-to-output (forward), but can
be mapped output-to-input (backward) by the inverse mapping too.
This helps crop and align feature maps among other uses.
"""
from __future__ import division
import numpy as np... | 6,721 | 35.139785 | 79 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/detector.py | #!/usr/bin/env python
"""
Do windowed detection by classifying a number of images/crops at once,
optionally using the selective search window proposal method.
This implementation follows ideas in
Ross Girshick, Jeff Donahue, Trevor Darrell, Jitendra Malik.
Rich feature hierarchies for accurate object detection... | 8,541 | 38.364055 | 80 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/__init__.py | from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
from ._caffe import init_log, log, set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list, set_random_seed, solver_count, set_solver_count, solver_rank, set_solver_rank, set_mul... | 561 | 61.444444 | 225 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/pycaffe.py | """
Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic
interface.
"""
from collections import OrderedDict
try:
from itertools import izip_longest
except:
from itertools import zip_longest as izip_longest
import numpy as np
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \... | 11,256 | 32.602985 | 89 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/draw.py | """
Caffe network visualization: draw the NetParameter protobuffer.
.. note::
This requires pydot>=1.0.2, which is not included in requirements.txt since
it requires graphviz and other prerequisites outside the scope of the
Caffe.
"""
from caffe.proto import caffe_pb2
"""
pydot is not supported under p... | 8,813 | 34.97551 | 120 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/io.py | import numpy as np
import skimage.io
from scipy.ndimage import zoom
from skimage.transform import resize
try:
# Python3 will most likely not be able to load protobuf
from caffe.proto import caffe_pb2
except:
import sys
if sys.version_info >= (3, 0):
print("Failed to include caffe_pb2, things mi... | 12,729 | 32.151042 | 110 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_coord_map.py | import unittest
import numpy as np
import random
import caffe
from caffe import layers as L
from caffe import params as P
from caffe.coord_map import coord_map_from_to, crop
def coord_net_spec(ks=3, stride=1, pad=0, pool=2, dstride=2, dpad=0):
"""
Define net spec for simple conv-pool-deconv pattern common t... | 6,894 | 34.725389 | 79 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_python_layer_with_param_str.py | import unittest
import tempfile
import os
import six
import caffe
class SimpleParamLayer(caffe.Layer):
"""A layer that just multiplies by the numeric value of its param string"""
def setup(self, bottom, top):
try:
self.value = float(self.param_str)
except ValueError:
... | 2,031 | 31.774194 | 79 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_io.py | import numpy as np
import unittest
import caffe
class TestBlobProtoToArray(unittest.TestCase):
def test_old_format(self):
data = np.zeros((10,10))
blob = caffe.proto.caffe_pb2.BlobProto()
blob.data.extend(list(data.flatten()))
shape = (1,1,10,10)
blob.num, blob.channels, b... | 1,694 | 28.736842 | 65 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_solver.py | import unittest
import tempfile
import os
import numpy as np
import six
import caffe
from test_net import simple_net_file
class TestSolver(unittest.TestCase):
def setUp(self):
self.num_output = 13
net_f = simple_net_file(self.num_output)
f = tempfile.NamedTemporaryFile(mode='w+', delete=F... | 2,165 | 33.380952 | 76 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_layer_type_list.py | import unittest
import caffe
class TestLayerTypeList(unittest.TestCase):
def test_standard_types(self):
#removing 'Data' from list
for type_name in ['Data', 'Convolution', 'InnerProduct']:
self.assertIn(type_name, caffe.layer_type_list(),
'%s not in layer_type_lis... | 338 | 27.25 | 65 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_net.py | import unittest
import tempfile
import os
import numpy as np
import six
from collections import OrderedDict
import caffe
def simple_net_file(num_output):
"""Make a simple net prototxt, based on test_net.cpp, returning the name
of the (temporary) file."""
f = tempfile.NamedTemporaryFile(mode='w+', delete... | 9,722 | 27.101156 | 78 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_net_spec.py | import unittest
import tempfile
import caffe
from caffe import layers as L
from caffe import params as P
def lenet(batch_size):
n = caffe.NetSpec()
n.data, n.label = L.DummyData(shape=[dict(dim=[batch_size, 1, 28, 28]),
dict(dim=[batch_size, 1, 1, 1])],
... | 3,287 | 39.097561 | 77 | py |
bottom-up-attention | bottom-up-attention-master/caffe/python/caffe/test/test_python_layer.py | import unittest
import tempfile
import os
import six
import caffe
class SimpleLayer(caffe.Layer):
"""A layer that just multiplies by ten"""
def setup(self, bottom, top):
pass
def reshape(self, bottom, top):
top[0].reshape(*bottom[0].data.shape)
def forward(self, bottom, top):
... | 5,510 | 31.609467 | 81 | py |
bottom-up-attention | bottom-up-attention-master/caffe/scripts/cpp_lint.py | #!/usr/bin/python2
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | 187,450 | 37.49887 | 93 | py |
bottom-up-attention | bottom-up-attention-master/caffe/scripts/split_caffe_proto.py | #!/usr/bin/env python
import mmap
import re
import os
import errno
script_path = os.path.dirname(os.path.realpath(__file__))
# a regex to match the parameter definitions in caffe.proto
r = re.compile(r'(?://.*\n)*message ([^ ]*) \{\n(?: .*\n|\n)*\}')
# create directory to put caffe.proto fragments
try:
os.mkdir(... | 941 | 25.166667 | 65 | py |
bottom-up-attention | bottom-up-attention-master/caffe/scripts/download_model_binary.py | #!/usr/bin/env python
import os
import sys
import time
import yaml
import hashlib
import argparse
from six.moves import urllib
required_keys = ['caffemodel', 'caffemodel_url', 'sha1']
def reporthook(count, block_size, total_size):
"""
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
... | 2,531 | 31.461538 | 78 | py |
bottom-up-attention | bottom-up-attention-master/caffe/scripts/copy_notebook.py | #!/usr/bin/env python
"""
Takes as arguments:
1. the path to a JSON file (such as an IPython notebook).
2. the path to output file
If 'metadata' dict in the JSON file contains 'include_in_docs': true,
then copies the file to output file, appending the 'metadata' property
as YAML front-matter, adding the field 'categor... | 1,089 | 32.030303 | 87 | py |
bottom-up-attention | bottom-up-attention-master/lib/setup.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
from setuptools import setu... | 5,665 | 35.089172 | 90 | py |
bottom-up-attention | bottom-up-attention-master/lib/roi_data_layer/layer.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""The data layer used during training to train a Fast R-CNN network.
... | 7,856 | 37.326829 | 81 | py |
bottom-up-attention | bottom-up-attention-master/lib/roi_data_layer/roidb.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Transform a roidb into a trainable roidb by adding a bunch of metada... | 5,818 | 40.863309 | 83 | py |
bottom-up-attention | bottom-up-attention-master/lib/roi_data_layer/minibatch.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Compute minibatch blobs for training a Fast R-CNN network."""
impor... | 10,006 | 41.046218 | 96 | py |
bottom-up-attention | bottom-up-attention-master/lib/roi_data_layer/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/test.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Test a Fast R-CNN network on an imdb (image database)."""
from fast... | 19,368 | 38.690574 | 123 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/train_multi_gpu.py | # --------------------------------------------------------
# Written by Bharat Singh
# Modified version of py-R-FCN
# --------------------------------------------------------
"""Train a Fast R-CNN network."""
import caffe
from fast_rcnn.config import cfg
import roi_data_layer.roidb as rdl_roidb
from utils.timer impor... | 9,558 | 37.857724 | 107 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/bbox_transform.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def bbox_transform(ex_rois, gt_rois):
ex_widths... | 2,539 | 32.421053 | 79 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/nms_wrapper.py | # ----------------------------------------------------------
# Soft-NMS: Improving Object Detection With One Line of Code
# Copyright (c) University of Maryland, College Park
# Licensed under The MIT License [see LICENSE for details]
# Written by Navaneeth Bodla and Bharat Singh
# --------------------------------------... | 1,101 | 33.4375 | 69 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/config.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Fast R-CNN config system.
This file specifies default config option... | 10,118 | 31.329073 | 99 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
bottom-up-attention | bottom-up-attention-master/lib/fast_rcnn/train.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Fast R-CNN network."""
import caffe
from fast_rcnn.config i... | 8,539 | 39.861244 | 92 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/voc_eval.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import xml.etree.ElementTree as ET
import os
import cPickle
import numpy as np
def parse_rec(f... | 6,937 | 33.69 | 78 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/vg.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from datasets.imdb import imdb
import datasets.ds_utils as ds... | 15,143 | 40.719008 | 101 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/pascal_voc.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from datasets.imdb import imdb
import datasets.ds_utils as ds... | 14,217 | 40.211594 | 80 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/imdb.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
import os.path as osp
import PIL
from utils.cython_bbox impor... | 11,606 | 36.931373 | 87 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/factory.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
__sets = {}
fr... | 2,055 | 33.847458 | 126 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/ds_utils.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def unique_boxes(boxes, scale=1.0):
"""Return indices of unique boxes."""
... | 1,336 | 30.833333 | 72 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/vg_eval.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import xml.etree.ElementTree as ET
import os
import cPickle
import numpy as np
from voc_eval im... | 4,153 | 31.968254 | 111 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/imagenet.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import datasets
import datasets.imagenet
import os, sys
from datasets.i... | 8,245 | 38.644231 | 121 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/coco.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from datasets.imdb import imdb
import datasets.ds_utils as ds_utils
from fast_rcnn.config import cf... | 17,316 | 40.727711 | 94 | py |
bottom-up-attention | bottom-up-attention-master/lib/datasets/tools/mcg_munge.py | import os
import sys
"""Hacky tool to convert file system layout of MCG boxes downloaded from
http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/mcg/
so that it's consistent with those computed by Jan Hosang (see:
http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-
computing/research... | 1,451 | 36.230769 | 94 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/proposal_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
import caffe
import numpy as np
import yaml
from fast_r... | 7,265 | 38.064516 | 88 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/generate_anchors.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
import numpy as np
# Verify that we compute the same a... | 3,110 | 28.349057 | 78 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/generate.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from fast_rcnn.config import cfg
from fast_rcnn.train import filter_r... | 7,868 | 35.771028 | 88 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/proposal_target_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
import caffe
import yaml
import numpy as np
import nump... | 12,616 | 41.625 | 137 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/anchor_target_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
import os
import caffe
import yaml
from fast_rcnn.confi... | 11,700 | 39.487889 | 95 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
| 262 | 36.571429 | 58 | py |
bottom-up-attention | bottom-up-attention-master/lib/rpn/heatmap_layer.py |
import caffe
import yaml
import numpy as np
import numpy.random as npr
from fast_rcnn.config import cfg
from fast_rcnn.bbox_transform import bbox_transform
from utils.cython_bbox import bbox_overlaps
DEBUG = False
class HeatmapLayer(caffe.Layer):
"""
Takes regions of interest (rois) and outputs heatmaps.
... | 2,111 | 37.4 | 91 | py |
bottom-up-attention | bottom-up-attention-master/lib/pycocotools/cocoeval.py | __author__ = 'tsungyi'
import numpy as np
import datetime
import time
from collections import defaultdict
import mask
import copy
class COCOeval:
# Interface for evaluating detection on the Microsoft COCO dataset.
#
# The usage for CocoEval is as follows:
# cocoGt=..., cocoDt=... # load dataset... | 19,735 | 43.45045 | 131 | py |
bottom-up-attention | bottom-up-attention-master/lib/pycocotools/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
bottom-up-attention | bottom-up-attention-master/lib/pycocotools/coco.py | __author__ = 'tylin'
__version__ = '1.0.1'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Ple... | 14,881 | 41.278409 | 128 | py |
bottom-up-attention | bottom-up-attention-master/lib/pycocotools/mask.py | __author__ = 'tsungyi'
import pycocotools._mask as _mask
# Interface for manipulating masks stored in RLE format.
#
# RLE is a simple yet efficient format for storing binary masks. RLE
# first divides a vector (or vectorized image) into a series of piecewise
# constant regions and then for each piece simply stores th... | 4,058 | 48.5 | 100 | py |
bottom-up-attention | bottom-up-attention-master/lib/utils/timer.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import time
class Timer(object):
"""A simple timer."""
def __i... | 948 | 27.757576 | 71 | py |
bottom-up-attention | bottom-up-attention-master/lib/utils/blob.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Blob helper functions."""
import numpy as np
import cv2
def im_lis... | 1,625 | 34.347826 | 75 | py |
bottom-up-attention | bottom-up-attention-master/lib/utils/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
bottom-up-attention | bottom-up-attention-master/lib/transform/__init__.py | 0 | 0 | 0 | py | |
bottom-up-attention | bottom-up-attention-master/lib/transform/torch_image_transform_layer.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
""" Transform images for compatibility with models trained with
https://github.com/facebook/fb.resnet.torch.
Usage in model p... | 2,000 | 29.784615 | 72 | py |
bottom-up-attention | bottom-up-attention-master/lib/nms/py_cpu_nms.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def py_cpu_nms(dets, thresh):
"""Pure Python NM... | 1,051 | 25.974359 | 59 | py |
bottom-up-attention | bottom-up-attention-master/lib/nms/__init__.py | 0 | 0 | 0 | py | |
XDF-GAN | XDF-GAN-master/run-sgan-tessellate.py | """
Script to create very large tessellated GDF
Copyright 2019 Mike Smith
Please see COPYING for licence details
"""
import matplotlib as mpl
mpl.use("Agg")
# General imports
import numpy as np
import h5py
import os
from time import time
import argparse
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt... | 5,897 | 35.8625 | 166 | py |
XDF-GAN | XDF-GAN-master/run-sgan.py | """
Script to run GDF generation
Copyright 2019 Mike Smith
Please see COPYING for licence details
"""
import matplotlib as mpl
mpl.use("Agg")
# General imports
import numpy as np
import h5py
import os
from time import time
import argparse
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt
from matplotli... | 6,620 | 35.379121 | 150 | py |
XDF-GAN | XDF-GAN-master/sgan.py | """
Script to train GDF-SGAN
Copyright 2019 Mike Smith
Please see COPYING for licence details
"""
import matplotlib as mpl
mpl.use("Agg")
# General imports
import numpy as np
import h5py
import os
from time import time
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import argparse
# ML specifi... | 10,761 | 39.920152 | 145 | py |
rlmeta | rlmeta-main/setup.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
import os
import re
import subprocess
import sys
from distutils.version import LooseVersion
from setuptools import E... | 2,829 | 28.789474 | 79 | py |
rlmeta | rlmeta-main/examples/plot.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import re
from datetime import datetime
from typing import Any, Dict, Optional, Union
import matplotlib.pyplot... | 2,320 | 26.305882 | 77 | py |
rlmeta | rlmeta-main/examples/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
rlmeta | rlmeta-main/examples/atari/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
rlmeta | rlmeta-main/examples/atari/ppo/atari_ppo_rnd_model.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import rlmeta.core.remote as remote
from rlme... | 2,889 | 35.125 | 78 | py |
rlmeta | rlmeta-main/examples/atari/ppo/atari_ppo_model.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Tuple
import torch
import torch.nn as nn
import rlmeta.core.remote as remote
from rlmeta.agents.ppo import PPOModel
fr... | 1,988 | 35.163636 | 78 | py |
rlmeta | rlmeta-main/examples/atari/ppo/atari_ppo.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import json
import logging
import time
import hydra
import torch
import torch.multiprocessing as mp
import rlmeta.envs.atari_... | 5,968 | 38.013072 | 78 | py |
rlmeta | rlmeta-main/examples/atari/ppo/atari_ppo_rnd.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import json
import logging
import time
import hydra
import torch
import torch.multiprocessing as mp
import rlmeta.envs.atari_... | 5,904 | 38.10596 | 78 | py |
rlmeta | rlmeta-main/examples/atari/dqn/atari_dqn_model.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import rlmeta.core.remo... | 4,918 | 34.388489 | 80 | py |
rlmeta | rlmeta-main/examples/atari/dqn/atari_apex_dqn.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import logging
import time
import hydra
import torch
import torch.multiprocessing as mp
import rlmeta.envs.atari_wrapper as a... | 6,771 | 39.071006 | 78 | py |
rlmeta | rlmeta-main/examples/tutorials/loop_example.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import asyncio
import time
from typing import Optional
import numpy as np
import torch
import torch.multiprocessing as mp
import rlmeta.... | 3,493 | 27.177419 | 80 | py |
rlmeta | rlmeta-main/examples/tutorials/remote_example.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import asyncio
import torch
import torch.multiprocessing as mp
import rlmeta.core.remote as remote
import rlmeta.utils.remote_utils as rem... | 2,053 | 22.883721 | 69 | py |
rlmeta | rlmeta-main/examples/tutorials/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
rlmeta | rlmeta-main/tests/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
rlmeta | rlmeta-main/tests/test_utils.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
import torch
import rlmeta.utils.data_utils as data_utils
class TestCaseBase(unittest.TestCase):
... | 752 | 26.888889 | 65 | py |
rlmeta | rlmeta-main/tests/core/replay_buffer_test.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
import rlmeta.utils.data_utils as data_utils
from rlmeta.core.replay_buffer import ReplayBuffer
from rlmeta.... | 10,383 | 42.087137 | 80 | py |
rlmeta | rlmeta-main/tests/core/remotable_test.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
import torch
import rlmeta.core.remote as remote
import rlmeta.utils.remote_utils as remote_utils
from ... | 1,261 | 26.434783 | 67 | py |
rlmeta | rlmeta-main/tests/core/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
rlmeta | rlmeta-main/tests/core/rescalers_test.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
import torch
from rlmeta.core.rescalers import MomentsRescaler, RMSRescaler, SqrtRescaler
from tests.te... | 2,621 | 33.5 | 79 | py |
rlmeta | rlmeta-main/tests/utils/running_stats_test.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from rlmeta.utils.running_stats import RunningMoments, RunningRMS
from tests.test_utils import TestCaseBase
... | 4,653 | 39.824561 | 79 | py |
rlmeta | rlmeta-main/tests/utils/stats_dict_test.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
from rlmeta.utils.stats_dict import StatsDict
from tests.test_utils import TestCaseBase
class StatsDi... | 2,102 | 32.919355 | 65 | py |
rlmeta | rlmeta-main/tests/utils/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 179 | 35 | 65 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.