repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
aTeK7/deep-stereo1.4
old/planesweep.py
import numpy as np from PIL import Image from glumpy import app, gloo, gl, data, glm from load_camera import CameraLoader, CameraRigType, camera_0 width = 1024/2 height = 768/2 ratio = float(width)/height window = app.Window(width=width, height=height) camera = CameraLoader() posx = -10.0 angleR = 0.0 def cube(): ...
aTeK7/deep-stereo1.4
reprojection/camera.py
<reponame>aTeK7/deep-stereo1.4 import numpy as np import math class Camera(object): def __init__(self, rotation, translation, intrinsics, name="camera"): self.name = name if len(translation) != 3: raise NameError("Translation vector must shape must be of length 3") if rotatio...
aTeK7/deep-stereo1.4
tf_deep_stereo/tf_train.py
import os import sys import time import cv2 import socket import traceback from datetime import datetime from optparse import OptionParser import tensorflow as tf sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from dataset_preparation.kitti_generator import KittiGenerator from da...
aTeK7/deep-stereo1.4
reprojection/reprojection.py
<reponame>aTeK7/deep-stereo1.4<gh_stars>0 import numpy as np import cv2 from dataset_preparation.kitti_camera import Camera from functools import reduce class Reprojection(object): def __init__(self, camSrc, camVirtual, verbose=False): if not isinstance(camSrc, Camera) or not isinstance(camVirtual, Camera...
aTeK7/deep-stereo1.4
reprojection/test_reprojection.py
<filename>reprojection/test_reprojection.py import numpy as np np.set_printoptions(suppress=True) import unittest from reprojection import Reprojection from camera import Camera from PIL import Image class ReprojectionTest(unittest.TestCase): def test_reproject_back(self): srcCam = Camera( in...
aTeK7/deep-stereo1.4
dataset_preparation/test_cameras.py
<gh_stars>0 import numpy as np np.set_printoptions(suppress=True) import unittest from kitti_camera import KittiCamera from kitti_generator import KittiGenerator, extract_multipatch from reprojection.reprojection import Reprojection from scipy import misc import timeit import matplotlib.image as mpimg from dataset_prep...
aTeK7/deep-stereo1.4
old/camera_plot.py
<filename>old/camera_plot.py import matplotlib.pyplot as plt import numpy as np import math def plot_camera(figure, camera, depth=1.0, rotate=True): points = np.array([ (-1, 1, depth), (1, 1, depth), (1, -1, depth), (-1, -1, depth), ]) #print points zDep...
aTeK7/deep-stereo1.4
dataset_preparation/kitti_generator.py
import os from skimage.transform import resize from dataset_preparation.kitti_camera import KittiCamera from reprojection.reprojection import Reprojection import numpy as np from scipy.misc import imsave import matplotlib.image as mpimg from dataset_preparation.set_generator import SetGenerator class KittiGenerator(ob...
aTeK7/deep-stereo1.4
old/test.py
from load_camera import camera_0 import numpy as np np.set_printoptions(suppress=True) import unittest class TestStringMethods(unittest.TestCase): @unittest.skip("demonstrating skipping") def test_intrinsic_opengl(self): opengl_in = camera_0.get_intrinsic_opengl() self.assertEqual(opengl_in.sha...
diogoalmeida/generic_control_toolbox
src/generic_control_toolbox/bag_parser.py
<filename>src/generic_control_toolbox/bag_parser.py #!/usr/bin/env python import glob import os import sys import rosbag import numpy as np import rospkg class BagParser(): ''' Provides functionality to parse a ROS bag which holds an actionlib feedback message. ''' def __init__(self, pkg, ...
acevery/hlsvr
videos/urls.py
<gh_stars>0 from django.urls import path from . import views app_name = 'videos' urlpatterns = [ path('<int:video_id>/', views.video_detail, name='detail'), path('', views.video_list, name='list'), ]
acevery/hlsvr
videos/views.py
from django.shortcuts import render, get_object_or_404 from videos.models import Video # Create your views here. def video_detail(request, video_id): video = get_object_or_404(Video, pk=video_id) context = {'the_video': video} return render(request, 'videos/single.html', context) def video_list(request)...
acevery/hlsvr
videos/admin.py
<reponame>acevery/hlsvr from django.contrib import admin from videos.models import Video # Register your models here. class VideoAdmin(admin.ModelAdmin): list_dispay = ['title', 'source', 'slug', ] admin.site.register(Video, VideoAdmin)
acevery/hlsvr
videos/models.py
from django.db import models from os.path import basename # Create your models here. class Video(models.Model): """Video with source and name.""" title = models.CharField(max_length=128) location = models.CharField(max_length=128) introduction = models.TextField() source = models.URLField() slu...
aravindavk/gluster-file-history
main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com/> # This file is part of GlusterFS. # # This file is licensed to you under your choice of the GNU Lesser # General Public License, version 3 or any later version (LGPLv3 or # later), or the GNU General Public Licens...
bfontaine/Algorithms
dtw/dtw.py
#! /usr/bin/env python # -*- coding: UTF-8 -*- # Dynamic Time Wraping # # Good explanation: https://www.youtube.com/watch?v=_K1OsqCicBY def avg(xs): return sum(xs) / float(len(xs)) def dtw(series1, series2): """ Compute a distance between two numerical series using the DTW algorithm. """ w = len(...
JohnMcGrane/ParticleFinder
FilterView.py
<gh_stars>0 """******************************************************************************* * * Author: <NAME> * Institution: University of Minnesota Duluth * College: Swenson College of Science and Engineering * Department: Chemistry & Biochemistry * Copyright: <NAME>, 2021 * *************************...
JohnMcGrane/ParticleFinder
utilities.py
import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats from scipy.stats import norm import pandas as pd import os import re from scipy import ndimage from scipy.stats.mstats import mquantiles from PIL import Image import matplotlib.image as mpimg def createFileList(name): """A function th...
billy-horn/lightning-flash
tests/core/test_trainer.py
from typing import Any import pytest import torch from torch import nn from torch.nn import functional as F from flash import ClassificationTask, Trainer from flash.core.finetuning import Freeze, NoFreeze class DummyDataset(torch.utils.data.Dataset): def __init__(self, predict: bool = False): self._pre...
billy-horn/lightning-flash
tests/vision/classification/test_model.py
<filename>tests/vision/classification/test_model.py import pytest import torch from pytorch_lightning.utilities.exceptions import MisconfigurationException from flash import Trainer from flash.vision import ImageClassifier # ======== Mock functions ======== class DummyDataset(torch.utils.data.Dataset): def __g...
billy-horn/lightning-flash
flash/vision/embedding/model_map.py
<reponame>billy-horn/lightning-flash from contextlib import suppress from typing import Type from pytorch_lightning.utilities import _BOLTS_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException if _BOLTS_AVAILABLE: with suppress(TypeError): from pl_bolts.models.self_superv...
billy-horn/lightning-flash
tests/vision/classification/test_data.py
from pathlib import Path import numpy as np import torch from PIL import Image from torchvision import transforms as T from flash.vision import ImageClassificationData def _dummy_image_loader(filepath): return torch.rand(3, 64, 64) def _rand_image(): return Image.fromarray(np.random.randint(0, 255, (64, 6...
billy-horn/lightning-flash
flash/vision/classification/dataset.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
billy-horn/lightning-flash
tests/core/test_utils.py
import os from flash import utils from flash.core.data import download_data # ======== Mock functions ======== class A: def __call__(self, x): return True def b(): return True c = lambda: True # noqa: E731 # ============================== def test_get_callable_name(): assert utils.get_c...
billy-horn/lightning-flash
flash_examples/predict/classify_tabular.py
<reponame>billy-horn/lightning-flash from flash.core.data import download_data from flash.tabular import TabularClassifier if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/titanic.zip", 'data/') # 2. Load the model from a checkpoint model = Tabul...
billy-horn/lightning-flash
flash_examples/finetuning/summarization.py
<filename>flash_examples/finetuning/summarization.py<gh_stars>1-10 import flash from flash import download_data from flash.text import SummarizationData, SummarizationTask if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/xsum.zip", 'data/') # 2. Load ...
billy-horn/lightning-flash
flash_examples/predict/summarize.py
<filename>flash_examples/predict/summarize.py from pytorch_lightning import Trainer from flash.core.data import download_data from flash.text import SummarizationData, SummarizationTask if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/xsum.zip", 'data/') ...
billy-horn/lightning-flash
tests/text/translation/test_model.py
<filename>tests/text/translation/test_model.py<gh_stars>1-10 import os import torch from flash import Trainer from flash.text import TranslationTask # ======== Mock functions ======== class DummyDataset(torch.utils.data.Dataset): def __getitem__(self, index): return { "input_ids": torch.ra...
billy-horn/lightning-flash
flash/core/data/datapipeline.py
from typing import Any from torch import Tensor from torch.utils.data._utils.collate import default_collate class DataPipeline: """ This class purpose is to facilitate the conversion of raw data to processed or batched data and back. Several hooks are provided for maximum flexibility. Example:: ...
billy-horn/lightning-flash
tests/examples/test_examples.py
import subprocess import sys from pathlib import Path from typing import List, Optional, Tuple import pytest root = Path(__file__).parent.parent.parent def call_script(filepath: str, args: Optional[List[str]] = None, timeout: Optional[int] = 60 * 5) -> Tuple[int, str, str]: if ar...
billy-horn/lightning-flash
tests/text/test_data_model_integration.py
import os from pathlib import Path from pytorch_lightning import Trainer from flash.text import TextClassificationData, TextClassifier TEST_BACKBONE = "prajjwal1/bert-tiny" # super small model for testing TEST_CSV_DATA = """sentence,label this is a sentence one,0 this is a sentence two,1 this is a sentence three,0...
billy-horn/lightning-flash
tests/text/translation/test_data.py
<filename>tests/text/translation/test_data.py import os from pathlib import Path from flash.text import TranslationData TEST_BACKBONE = "sshleifer/tiny-mbart" # super small model for testing TEST_CSV_DATA = """input,target this is a sentence one,this is a translated sentence one this is a sentence two,this is a tra...
billy-horn/lightning-flash
flash/core/data/utils.py
import os.path import zipfile from io import BytesIO from typing import Any, Type from urllib.request import urlopen, urlretrieve from zipfile import ZipFile import requests import torch from tqdm.auto import tqdm as tq # Code taken from: https://gist.github.com/ruxi/5d6803c116ec1130d484a4ab8c00c603 # __author__ = ...
billy-horn/lightning-flash
tests/tabular/data/test_dataset.py
import numpy as np import pandas as pd from flash.tabular.classification.data.dataset import PandasDataset TEST_DF = pd.DataFrame( data={ "category": [0, 1, 2, 1, 0, 2], "scalar_a": [0.0, 1.0, 2.0, 3.0, 2.0, 5.0], "scalar_b": [5.0, 4.0, 3.0, 2.0, 2.0, 1.0], "label": [0, 1, 0, 1, 0,...
billy-horn/lightning-flash
tests/tabular/classification/test_model.py
<reponame>billy-horn/lightning-flash import torch from pytorch_lightning import Trainer from flash.tabular import TabularClassifier # ======== Mock functions ======== class DummyDataset(torch.utils.data.Dataset): def __init__(self, num_num=16, num_cat=16): super().__init__() self.num_num = num_...
billy-horn/lightning-flash
flash_examples/predict/image_embedder.py
import torch from flash.core.data import download_data from flash.vision import ImageEmbedder if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip", 'data/') # 2. Create an ImageEmbedder with swav trained on imagenet. # Check ou...
billy-horn/lightning-flash
flash_examples/finetuning/tabular_classification.py
<reponame>billy-horn/lightning-flash from pytorch_lightning.metrics.classification import Accuracy, Precision, Recall import flash from flash.core.data import download_data from flash.tabular import TabularClassifier, TabularData if __name__ == "__main__": # 1. Download the data download_data("https://pl-fla...
billy-horn/lightning-flash
flash_examples/predict/classify_image.py
<gh_stars>1-10 from flash import Trainer from flash.core.data import download_data from flash.vision import ImageClassificationData, ImageClassifier if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip", 'data/') # 2. Load the model ...
billy-horn/lightning-flash
flash/vision/embedding/__init__.py
<gh_stars>1-10 from flash.vision.embedding.image_embedder_model import ImageEmbedder
billy-horn/lightning-flash
flash/core/data/datamodule.py
<gh_stars>1-10 import os import warnings from typing import Any, Optional import pytorch_lightning as pl from torch.utils.data import DataLoader, Dataset from flash.core.data.datapipeline import DataPipeline class TaskDataPipeline(DataPipeline): def after_collate(self, batch: Any) -> Any: return (batch...
billy-horn/lightning-flash
flash_examples/predict/translate.py
<gh_stars>1-10 from pytorch_lightning import Trainer from flash import download_data from flash.text import TranslationData, TranslationTask if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/wmt_en_ro.zip", 'data/') # 2. Load the model from a checkpo...
billy-horn/lightning-flash
flash/vision/classification/backbones.py
from typing import Tuple import torch.nn as nn import torchvision from pytorch_lightning.utilities.exceptions import MisconfigurationException def torchvision_backbone_and_num_features(model_name: str, pretrained: bool = True) -> Tuple[nn.Module, int]: model = getattr(torchvision.models, model_name, None) i...
billy-horn/lightning-flash
tests/text/classification/test_data.py
<filename>tests/text/classification/test_data.py import os from pathlib import Path from flash.text import TextClassificationData TEST_BACKBONE = "prajjwal1/bert-tiny" # super small model for testing TEST_CSV_DATA = """sentence,label this is a sentence one,0 this is a sentence two,1 this is a sentence three,0 """ ...
billy-horn/lightning-flash
flash_examples/finetuning/translation.py
import flash from flash import download_data from flash.text import TranslationData, TranslationTask if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/wmt_en_ro.zip", 'data/') # 2. Load the data datamodule = TranslationData.from_files( trai...
billy-horn/lightning-flash
flash_examples/predict/classify_text.py
<filename>flash_examples/predict/classify_text.py from pytorch_lightning import Trainer from flash.core.data import download_data from flash.text import TextClassificationData, TextClassifier if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/imdb.zip", 'd...
billy-horn/lightning-flash
flash_examples/finetuning/image_classification.py
import flash from flash.core.data import download_data from flash.core.finetuning import FreezeUnfreeze from flash.vision import ImageClassificationData, ImageClassifier if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip", 'data/') ...
billy-horn/lightning-flash
tests/tabular/test_data_model_integration.py
import pandas as pd import pytorch_lightning as pl from flash.tabular import TabularClassifier, TabularData TEST_DF_1 = pd.DataFrame( data={ "category": ["a", "b", "c", "a", None, "c"], "scalar_a": [0.0, 1.0, 2.0, 3.0, None, 5.0], "scalar_b": [5.0, 4.0, 3.0, 2.0, None, 1.0], "label...
billy-horn/lightning-flash
tests/vision/test_data_model_integration.py
import torch from flash import Trainer from flash.vision import ImageClassificationData, ImageClassifier def _dummy_image_loader(_): return torch.rand(3, 224, 224) def test_classification(tmpdir): data = ImageClassificationData.from_filepaths( train_filepaths=["a", "b"], train_labels=[0, 1]...
billy-horn/lightning-flash
flash/text/seq2seq/summarization/model.py
<reponame>billy-horn/lightning-flash<filename>flash/text/seq2seq/summarization/model.py<gh_stars>1-10 # Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at #...
billy-horn/lightning-flash
flash_examples/finetuning/text_classification.py
<gh_stars>1-10 import flash from flash.core.data import download_data from flash.text import TextClassificationData, TextClassifier if __name__ == "__main__": # 1. Download the data download_data("https://pl-flash-data.s3.amazonaws.com/imdb.zip", 'data/') # 2. Load the data datamodule = TextClassific...
acheketa/cwavegan
tpu/backup.py
<filename>tpu/backup.py from __future__ import print_function from google.cloud import storage import sys def copy_blob(bucket_name, blob_name, new_bucket_name, new_blob_name): """Copies a blob from one bucket to another with a new name.""" storage_client = storage.Client() source_bucket = storage_client.g...
acheketa/cwavegan
data/dump_tfrecord.py
import os import sys import numpy as np from scipy.io.wavfile import write as wavwrite import tensorflow as tf out_dir, tfrecord_fps = sys.argv[1], sys.argv[2:] if not os.path.isdir(out_dir): os.makedirs(out_dir) def _mapper(example_proto): features = { 'samples': tf.FixedLenSequenceFeature([1], tf.float3...
acheketa/cwavegan
tpu/tpu_input.py
# Based on TensorFlow released DCGAN codes from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf NUM_TRAIN_AUDIO = 60000 NUM_EVAL_AUDIO = 10000 class InputFunction(object): """Wrapper class that is passed as callable to Estimator.""" ...
acheketa/cwavegan
tpu/tpu_main.py
# Based on TensorFlow released DCGAN codes from __future__ import absolute_import from __future__ import division from __future__ import print_function # Standard Imports from absl import flags import numpy as np import tensorflow as tf import tpu_input import tpu_model from tensorflow.contrib import summary from te...
acheketa/cwavegan
gpu/loader.py
<filename>gpu/loader.py<gh_stars>100-1000 import tensorflow as tf """ Data loader fps: List of tfrecords batch_size: Resultant batch size window_len: Size of slice to take from each example first_window: If true, always take the first window in the example, otherwise take a random window repeat: If false,...
acheketa/cwavegan
tpu/preview.py
# Based on TensorFlow released DCGAN codes from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, time # Standard Imports from absl import flags from scipy.io.wavfile import write as wavwrite import numpy as np import tensorflow as tf import bias_inpu...
naschorr/clipster
code/audio_player.py
<filename>code/audio_player.py<gh_stars>1-10 import os import sys import asyncio import async_timeout import time import inspect import logging import random import math from typing import Callable from concurrent import futures import utilities import dynamo_helper import exceptions import discord from discord impor...
naschorr/clipster
code/clips.py
import json import os import random import asyncio import logging from discord.ext import commands from discord.ext.commands.errors import MissingRequiredArgument import utilities import dynamo_helper from string_similarity import StringSimilarity ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger ...
naschorr/clipster
code/clipster.py
<filename>code/clipster.py<gh_stars>1-10 import os import inspect import logging import discord from discord.ext import commands from discord.ext.commands.view import StringView import utilities import audio_player import admin import clips import dynamo_helper import help_command import module_manager from string_si...
naschorr/clipster
code/admin.py
import inspect import logging import utilities import dynamo_helper from discord.ext import commands ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = logging.getLogger(__name__) class Admin(commands.Cog): ## Keys ADMINS_KEY = "admins" def __init__(self, hawking, bot): self...
naschorr/clipster
code/dynamo_helper.py
import boto3 import base64 import time import logging import utilities ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class DynamoItem: def __init__(self, discord_context, query, command, is_valid, error=None): author = di...
naschorr/clipster
code/utilities.py
<filename>code/utilities.py<gh_stars>1-10 import os import sys import json import logging import pathlib from logging.handlers import RotatingFileHandler ## Config CONFIG_OPTIONS = {} # This'll be populated on import CONFIG_NAME = "config.json" # The name of the config file DEV_CONFIG_N...
naschorr/clipster
code/exceptions.py
from discord.errors import ClientException class UnableToConnectToVoiceChannelException(ClientException): ''' Exception that's thrown when the client is unable to connect to a voice channel ''' def __init__(self, message, channel, **kwargs): super(UnableToConnectToVoiceChannelException, self)....
naschorr/clipster
code/help_command.py
<gh_stars>1-10 import logging import random import utilities import dynamo_helper from discord.ext import commands from discord.ext.commands import DefaultHelpCommand, Paginator ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class Cl...
naschorr/clipster
code/module_manager.py
import os import sys import logging import inspect import importlib from collections import OrderedDict import utilities ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class ModuleEntry: def __init__(self, cls, is_cog, *init_args...
lamharrison/coronavirus-machine-learning
mlp_uk.py
<reponame>lamharrison/coronavirus-machine-learning import numpy as np np.random.seed(1337) from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt model = Sequential() model.add(Dense(units=50, input_dim=1, activation='relu')) model.add(Dense(units=50, activation='relu')) mod...
AdityaSrivast/senz
senz-client-samples/python/tests/test_image_utils.py
import sys import os import base64 sys.path.insert( 0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ) from utils.image_utils import imageToString, stringToImage def test_imagetoString(): file_path = (os.path.dirname(__file__))+"/sample.jpg" with open(file_path, "rb") as imageFile: ...
AdityaSrivast/senz
senz-client-samples/python/senz/client.py
#!/usr/bin/env python3 import socket, sys, time host, port = 'localhost', 2552 # Create an ipv4 socket client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the client client.connect((host, port)) # Send message to server def sendMessage(message): # Send message client.send(message.encode())...
makokaz/matsubo
examples/example_cog.py
<gh_stars>0 """Example Cog file Simple example file to help understand how to add more functionality to this bot. This cog defines the following discord commands: - clear - ping It also defines special behaviour when a member has joined the server: - on_member_join Refer to the Discord Docs to learn the basic funct...
makokaz/matsubo
cogs/utils/event.py
"""Event class Simple event class to define what attributes an event has, and other helpful functions like euqlity-checking. """ import calendar from . import utils class Event(object): def __init__(self, id='', # Unique ID for every event name='', # Event name description='...
makokaz/matsubo
cogs/utils/utils.py
<gh_stars>0 """Utils Simple utils python file for handy functions that are needed everywhere in the code. """ import asyncio import calendar import datetime import pytz # import builtins from functools import wraps def day_suffix(d:int) -> str: """Returns day-suffix 'st', 'nd', 'rd', 'th' for a day of a month....
makokaz/matsubo
cogs/event_listener.py
<reponame>makokaz/matsubo """Event Listener Cog Discord Bot Cog that scraps the web for events, and then posts them on subscribed channels. """ import os import discord import asyncio import datetime import pytz import typing from discord.ext import commands, tasks from itertools import cycle from apscheduler.schedu...
makokaz/matsubo
bot.py
"""Discord bot Scraps events and posts them onto discord. """ # import asyncio import discord from discord.ext import commands from cogs.utils.utils import getJSTtime import os # Bot setup BOT_TOKEN = os.getenv("BOT_TOKEN") bot = commands.Bot(command_prefix='.') @bot.event async def on_ready(): """Gets called w...
makokaz/matsubo
cogs/utils/database.py
"""Database wrapper Simple interface to save and load event data of a postgres database. """ import os import sys import psycopg2 import psycopg2.extras import datetime from .event import Event from . import utils # Setup database if os.getenv('DATABASE_URL'): # On Heroku, all fields are concatenated into one stri...
makokaz/matsubo
cogs/servercommands.py
<reponame>makokaz/matsubo """Server Commands Cog Simple discord bot cog that defines basic commands on a server for a bot: - managing roles - testing - fun activites - ... and more! """ import discord from discord.ext import commands from .utils.utils import * import traceback class ServerCommands(commands.Cog): ...
makokaz/matsubo
cogs/utils/event_scrapper.py
<reponame>makokaz/matsubo """Event scrapper Scraps events from pre-defined websites. """ import sys from bs4 import BeautifulSoup as soup from urllib.request import urlopen import datetime, pytz from dateutil.parser import parse as parse_date import calendar from .event import Event, mergeDuplicateEvents from . impor...
andmansim/Laberinto
inicio.py
<filename>inicio.py wall = ((0,1), (0,2), (0,3), (0,4), (1,1), (2,1), (2,3), (3,3), (4,0), (4,1), (4,2), (4,3)) # maze shape #maze1 = [" ","X","X","X","X"] #maze2 = [" ","X"," "," "," "] #maze3 = [" ","X"," ","X"," "] #maze4 = [" "," "," ","X"," "] #maze5 = ["X","X","X","X"," "] lab=[] def mazecreation(): ma...
kaikai581/leetcode-logistics
utilities/tree_test.py
#!/usr/bin/env python from collections import defaultdict # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def __init__(self): pass def mirror(self, roo...
adelenelai/classify_homologues
src/classify_homologues/__init__.py
<gh_stars>0 '''Classifying homologous series using RDKit.'''
adelenelai/classify_homologues
src/classify_homologues/nextgen_classify_homols.py
<reponame>adelenelai/classify_homologues<filename>src/classify_homologues/nextgen_classify_homols.py import os import sys import rdkit.Chem as Chem from utils import * from rdkit.Chem import AllChem import rdkit.Chem.rdchem as rdchem import rdkit.Chem.Draw as Draw import rdkit.Chem.Descriptors from rdkit.Chem import Pa...
adelenelai/classify_homologues
src/classify_homologues/utils.py
from rdkit import Chem from rdkit.Chem import AllChem import numpy as np from rdkit.Chem.Draw import rdMolDraw2D from io import BytesIO from itertools import compress try: import Image except ImportError: from PIL import Image def read_smiles_csv(path_to_smiles_csv): #sys.argv[1] '''Function to read in lis...
zf020114/CHPDet
src/DOTA_devkit/prepare_dota1_ms.py
<gh_stars>1-10 import os import os.path as osp from DOTA_devkit.DOTA2JSON import generate_json_labels from DOTA_devkit.DOTA2COCO import DOTA2COCOTrain, DOTA2COCOTest, wordname_15 from DOTA_devkit.ImgSplit_multi_process import splitbase as splitbase_trainval from DOTA_devkit.SplitOnlyImage_multi_process import \ sp...
zf020114/CHPDet
src/3show_json_anno.py
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 8 10:34:41 2019 @author: zf """ # -*- coding:utf-8 -*- from __future__ import print_function from pycocotools.coco import COCO import os, sys, zipfile import urllib.request import shutil import numpy as np import skimage.io as io i...
zf020114/CHPDet
src/DOTA_devkit/Rotatexml2DOTA.py
import json import os import os.path as osp import numpy as np import xmltodict import cv2 from dota_poly2rbox import rbox2poly_single def parse_ann_info(objects): bboxes, labels, bboxes_ignore, labels_ignore = [], [], [], [] # only one annotation if type(objects) != list: objects = [objects] ...
zf020114/CHPDet
src/r_nms_cpu.py
# -*- coding: utf-8 -*- """ Created on Mon Aug 12 10:15:36 2019 @author: admin """ #coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import cv2 def nms_rotate_cpu(boxes, scores, iou_threshold, max_output_size): keep = []...
zf020114/CHPDet
src/DOTA_devkit/demo.py
<reponame>zf020114/CHPDet<gh_stars>1-10 #!/usr/bin/env python # coding: utf-8 # In[1]: # get_ipython().run_line_magic('matplotlib', 'inline') import numpy as np import matplotlib.pyplot as plt import os from DOTA import DOTA import dota_utils as util import pylab pylab.rcParams['figure.figsize'] = (10.0, 10.0) # In[2]...
zf020114/CHPDet
src/lib/models/networks/orn/__init__.py
<reponame>zf020114/CHPDet from .modules.ORConv import ORConv2d from .functions import rotation_invariant_encoding,RotationInvariantPooling,RotationInvariantEncoding
zf020114/CHPDet
src/DataFunction.py
# -*- coding: utf-8 -*- """ Created on Thu Aug 29 08:04:59 2019 @author: zhangfeng 版本 10.31 """ from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import argparse import cv2 import numpy as np import datetime from lxml import etree import xml.etree.Ele...
zf020114/CHPDet
src/DOTA_devkit/prepare_hrsc2016.py
<reponame>zf020114/CHPDet<filename>src/DOTA_devkit/prepare_hrsc2016.py import os import os.path as osp from DOTA_devkit.HRSC2DOTA import generate_txt_labels from DOTA_devkit.DOTA2JSON import generate_json_labels def preprare_hrsc2016(data_dir): train_dir = osp.join(data_dir,'Train') test_dir = osp.join(data_di...
zf020114/CHPDet
src/DOTA_devkit/dota_poly2rbox.py
<reponame>zf020114/CHPDet import os import math import argparse import os.path as osp import numpy as np def cal_line_length(point1, point2): return math.sqrt(math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2)) def get_best_begin_point_single(coordinate): x1, y1, x2, y2, x3, y3, x4, y4 =...
zf020114/CHPDet
src/compute_iou_angle.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 15 15:39:49 2020 @author: zf """ from __future__ import absolute_import from __future__ import print_function from __future__ import division import os, sys import cv2 import numpy as np import shutil import sys sys.path.append('/home/zf/0tools') fr...
zf020114/CHPDet
src/DOTA_devkit/rotatexml_utils.py
<reponame>zf020114/CHPDet import os import os.path as osp import numpy as np # from ..bbox import rbox2poly_single def write_rotate_xml(output_floder,img_name,size,gsd,imagesource,gtbox_label,CLASSES):#size,gsd,imagesource#将检测结果表示为中科星图比赛格式的程序,这里用folder字段记录gsd voc_headstr = """\ <annotation> <folder>{...
zf020114/CHPDet
src/4rotate_xml2DOTAtxt.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 15 15:39:49 2020 @author: zf """ from __future__ import absolute_import from __future__ import print_function from __future__ import division import os,sys import cv2 import numpy as np import sys sys.path.append('/home/zf/0tools') from DataFunction...
zf020114/CHPDet
src/DOTA_devkit/HRSC2JSON.py
import json import os import os.path as osp import xmltodict def parse_ann_info(objects): bboxes, labels, bboxes_ignore, labels_ignore = [], [], [], [] # only one annotation if type(objects) != list: objects = [objects] for obj in objects: if obj['difficult'] == '0': bbox ...
zf020114/CHPDet
src/lib/models/networks/orn/functions/active_rotating_filter.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from .. import _C #import _C class _ActiveRotatingFilter(Function): @staticm...
zf020114/CHPDet
src/DOTA_devkit/DOTA2JSON.py
import json import os import os.path as osp import random from PIL import Image from dota_poly2rbox import poly2rbox_single_v2 def parse_ann_info(img_base_path, label_base_path, img_name): lab_path = osp.join(label_base_path, img_name+'.txt') bboxes, labels, bboxes_ignore, labels_ignore = [], [], [], [] ...
zf020114/CHPDet
src/0data_crop.py
<reponame>zf020114/CHPDet # -*- coding: utf-8 -*- """ Created on Thu Oct 10 18:22:36 2019 版本10.31 @author: admin """ import os import cv2 import numpy as np import DataFunction from timeit import default_timer as timer #voc路径 img_dir = 'E:/Dataset/HRSC2016/Train/AllImages'#r'E:\Dataset\HRSC2016FullDataSet\AllImages...
zf020114/CHPDet
src/lib/detectors/multi_pose.py
<gh_stars>1-10 from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np from progress.bar import Bar import time import torch import os try: from external.nms import soft_nms_39 except: print('NMS not imported! If you need it,' ...
zf020114/CHPDet
src/1make_json_anno.py
# coding=utf-8 import xml.etree.ElementTree as ET import os import json import numpy as np import DataFunction import cv2 from timeit import default_timer as timer from All_Class_NAME_LABEL import NAME_LABEL_MAP_HRSC,NAME_LABEL_MAP_USnavy_20,NAME_LABEL_MAP_ICDAR,NAME_LABEL_MAP_HRSC NAME_LABEL_MAP=NAME_LABEL_MAP_USnavy...
zf020114/CHPDet
src/All_Class_NAME_LABEL.py
# -*- coding: utf-8 -*- """ Created on Mon Nov 4 11:06:37 2019 @author: admin """ def get_label_name_map(NAME_LABEL_MAP): reverse_dict = {} for name, label in NAME_LABEL_MAP.items(): reverse_dict[label] = name return reverse_dict NAME_LABEL_MAP_ICDAR = {'1': 1} NAME_LABEL_MAP_USnavy = { ...