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
neural_graph_evolution
neural_graph_evolution-master/agent/agent.py
# ----------------------------------------------------------------------------- # @brief: # In this function, we define the base agent. # The base agent should be responsible for building the policy network, # fetch the io placeholders / tensors, and set up the variable list # @author: # cod...
22,426
41.395085
86
py
neural_graph_evolution
neural_graph_evolution-master/agent/__init__.py
0
0
0
py
neural_graph_evolution
neural_graph_evolution-master/agent/pruning_agent.py
# ------------------------------------------------------------------------------ # @brief: # The optimization agent is responsible for doing the updates. # @author: # modified from the code of kvfran, modified by Tingwu Wang # -----------------------------------------------------------------------------...
14,957
37.255754
86
py
neural_graph_evolution
neural_graph_evolution-master/environments/asset_generator.py
# ----------------------------------------------------------------------------- # @brief: # generate the xml files for each different sub-tasks of one master task # @author: # Tingwu Wang, Aug. 30th, 2017 # ----------------------------------------------------------------------------- import argparse im...
1,798
32.314815
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/init_path.py
../tool/init_path.py
20
20
20
py
neural_graph_evolution
neural_graph_evolution-master/environments/centipede_generator.py
# ----------------------------------------------------------------------------- # @brief: # generate the centipedes # @author: # Tingwu Wang, Sept. 1st, 2017 # ----------------------------------------------------------------------------- import numpy as np MUJOCO_XML_HEAD = ''' <mujoco model="centiped...
7,395
36.353535
163
py
neural_graph_evolution
neural_graph_evolution-master/environments/__init__.py
0
0
0
py
neural_graph_evolution
neural_graph_evolution-master/environments/reacher_generator.py
# ----------------------------------------------------------------------------- # @brief: # generate the reacher # @author: # Tingwu Wang, Sept. 3rd, 2017 # ----------------------------------------------------------------------------- MUJOCO_XML_HEAD = ''' <mujoco model="modified_reacher"> <compiler...
4,800
40.034188
156
py
neural_graph_evolution
neural_graph_evolution-master/environments/register.py
# ----------------------------------------------------------------------------- # @brief: # register the environments here # @author: # Tingwu Wang, July 3rd, 2017 # ----------------------------------------------------------------------------- import pdb from gym.envs.registration import register impor...
9,120
33.161049
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/snake_generator.py
# ----------------------------------------------------------------------------- # @brief: # generate the snakes # @author: # Tingwu Wang, Sept. 1st, 2017 # ----------------------------------------------------------------------------- MUJOCO_XML_HEAD = ''' <mujoco model="swimmer"> <compiler angle="de...
3,940
35.155963
163
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/snake_env.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # The snake environments. # @author: # Tingwu (Wilson) Wang, Aug. 30nd, 2017 # ----------------------------------------------------------------------------- import numpy as np from gym impor...
5,418
24.804762
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/fish_env.py
# ----------------------------------------------------------------------------- # @brief: # The fish environments. # @author: # Yuhao Zhou Feb 4th, 2018 # ----------------------------------------------------------------------------- import pdb import numpy as np from gim import utils from gym.envs.mujo...
384
26.5
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/reacher_env.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # The reacher task # @author: # Tingwu (Wilson) Wang, July 22nd, 2017 # ----------------------------------------------------------------------------- import pdb import numpy as np from gym i...
8,795
23.433333
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/antS.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # The slim ant environments. # @author: # Tingwu (Wilson) Wang, Aug. 30nd, 2017 # ----------------------------------------------------------------------------- import numpy as np from gym im...
2,175
34.672131
92
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/centipede_env.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # The Centipede environments. # @author: # Tingwu (Wilson) Wang, Aug. 30nd, 2017 # ----------------------------------------------------------------------------- import pdb import numpy as np ...
7,631
27.477612
83
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/invpendulum_env.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # The snake environments. # @author: # Tingwu (Wilson) Wang, Aug. 30nd, 2017 # ----------------------------------------------------------------------------- import numpy as np from gym impor...
3,853
26.333333
79
py
neural_graph_evolution
neural_graph_evolution-master/environments/transfer_env/__init__.py
0
0
0
py
neural_graph_evolution
neural_graph_evolution-master/environments/multitask_env/walkers.py
#!/usr/bin/env python2 # ----------------------------------------------------------------------------- # @brief: # Several Walkers # @author: # Tingwu (Wilson) Wang, Nov. 22nd, 2017 # ----------------------------------------------------------------------------- import numpy as np from gym import utils ...
15,916
30.770459
96
py
neural_graph_evolution
neural_graph_evolution-master/environments/multitask_env/__init__.py
0
0
0
py
BamBirds
BamBirds-master/main.py
#!/usr/bin/env python3 import planner.src.main.python.rebound as rebound import vision.src.main.python.sciencebirds as vision import level_selection.src.main.python.prediction as level_selection import src.main.python.automated_execution as automated_execution import evaluation if __name__ == '__main__': import a...
1,825
35.52
129
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/linearModel.py
import pandas as pd import pickle import os import sklearn.linear_model as sklLM from sklearn import metrics from sklearn2pmml.pipeline import PMMLPipeline __all__ = ["linear_model", "train_linear_model", "query_linear_model", "linear_model_to_java_code", "evaluate_linear_model"] __current_working__dir = os.path.dir...
4,299
38.814815
156
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/main.py
import argparse import copy import os from . import simulate from . import learning __dir_path__ = os.path.dirname(os.path.abspath(__file__)) bambird_folder = os.path.abspath(os.path.join(__dir_path__, '..','..','..','..', '..')) testing_data_folder = os.path.abspath(os.path.join(bambird_folder, 'data','testing')) de...
7,534
52.06338
173
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/decisionTreeRg.py
import pickle import os import sklearn.tree as sklTree from sklearn2pmml import sklearn2pmml from sklearn2pmml.pipeline import PMMLPipeline __all__ = ["train_regressor"] __current_working__dir = os.path.dirname(os.path.abspath(__file__)) tr_regressor_output = os.path.join(__current_working__dir,'tr_regressor.pkl') ...
968
32.413793
131
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/evaluate.py
import numpy as np import pandas as pd import math from sklearn import metrics __all__ = ["evaluate_prediction_table", "evaluate_prediction_metrics", "evaluate_prediction_classifier", "calculate_information_values"] """ Comparison of classifier performance. :param scores -> classifier predictions """ def evaluat...
5,312
42.54918
136
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/simulate.py
#!/usr/bin/env python3 import collections import copy import csv import math import os import random import time from enum import Enum import numpy as np import pandas as pd from sklearn import metrics from . import query __current_working__dir = os.path.dirname(os.path.abspath(__file__)) demo_level = [] demo_roun...
22,393
36.261231
215
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/decisionTreeCl.py
import pickle import os import sklearn.tree as sklTree from sklearn2pmml import sklearn2pmml from sklearn2pmml.pipeline import PMMLPipeline __all__ = ["train_classifier", "tree_to_java_code"] __current_working__dir = os.path.dirname(os.path.abspath(__file__)) tr_classifier_output = os.path.join(__current_working__di...
2,683
41.603175
141
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/learning_dataPrep.py
import math import pandas as pd import os __all__ = ["read_input", "numerical_transform_strategies", "get_weighted_strategies"] """" Main function for construction and evaluation of the regression based decision tree. :param input_folder -> folder with feature input :param debug -> verbose outputs for debug...
3,282
40.556962
161
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/learning.py
import matplotlib.pyplot as plt import pandas as pd import pickle import os import sklearn.tree as sklTree import sklearn.model_selection as sklModel from sklearn.linear_model import LogisticRegression from . import learning_dataPrep as dataPrep from . import decisionTreeCl from . import decisionTreeRg from . impor...
16,059
56.562724
203
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/__init__.py
from . import learning, simulate from .main import create_argparser, train_models, simulate_level_selection
108
35.333333
74
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/randomForestRg.py
import pickle import os from sklearn.ensemble import RandomForestRegressor from . import randomForestCl from sklearn2pmml.pipeline import PMMLPipeline __all__ = ["random_forest", "train_random_forest", "query_random_forest"] __current_working__dir = os.path.dirname(os.path.abspath(__file__)) rf_regressor_output = o...
2,012
34.946429
141
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/query.py
import pickle import os from . import learning_dataPrep as dp __all__ = ["query_predictions", "query_classifier", "query_regressor"] __dir_path__ = os.path.dirname(os.path.abspath(__file__)) tr_classifier_output = os.path.join(__dir_path__,'tr_classifier.pkl') rf_classifier_output = os.path.join(__dir_path__,'rf_cla...
4,320
35.310924
117
py
BamBirds
BamBirds-master/level_selection/src/main/python/prediction/randomForestCl.py
import pickle import os from sklearn.ensemble import RandomForestClassifier import sklearn.tree as sklTree from sklearn2pmml.pipeline import PMMLPipeline from sklearn2pmml import sklearn2pmml __all__ = ["train_rf_classifier", "query_rf_classifier", "forest_to_java_code"] __current_working__dir = os.path.dirname(os.p...
4,390
43.806122
119
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/generate_data.py
from . import settings import os import planner.src.main.python.rebound as rebound import numpy as np import math import logging import time import itertools import random import csv fieldnames = ["file", "num_results", "time_first (s)", "time_last (s)", "time_max (s)", "edge_length", "consistency_check_length", "vari...
7,077
48.84507
371
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/settings.py
import os from planner.src.main.python.rebound.settings import ABType __dir_path__ = os.path.dirname(os.path.abspath(__file__)) __resources_dir__ = os.path.join(__dir_path__, "../../resources") __scenes_dir__ = os.path.join(__resources_dir__, "scenes") generator_default = "stop" scene_files = [ os.path.join(__sc...
2,920
49.362069
119
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/__init__.py
0
0
0
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/test_state.py
import unittest import os __dir_path__ = os.path.dirname(os.path.abspath(__file__)) __resources_dir__ = os.path.join(__dir_path__, "../../resources") __scenes_dir__ = os.path.join(__resources_dir__, "scenes") scene_files = [ os.path.join(__scenes_dir__, "scene_15.png"), os.path.join(__scenes_dir__, "scene_16....
462
21.047619
65
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/test_running.py
import unittest import os import numpy as np import math import logging import time import itertools import random import planner.src.main.python.rebound as rebound from . import settings class TestRunning(unittest.TestCase): @unittest.skip("Outdated") def test_running_df(self): print("--- test_runnin...
4,155
35.13913
288
py
BamBirds
BamBirds-master/planner/src/test/python/rebound/test_utils.py
import unittest import os import planner.src.main.python.rebound as rebound import numpy as np import math class TestUtils(unittest.TestCase): def test_bounce_equal_for_equal_wall_angles(self): print("--- bounce_equal_for_equal_wall_angles ---") P = [5,10] rg_start = [40,50] v_star...
13,175
44.434483
120
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/main.py
import logging from .state import State from . import search, settings, utils from PIL import Image import os import numpy as np log = logging.getLogger("rebound") generator_default = "stop" def run(img_file: str, start_point: tuple, entry_edge: int, angle_interval: list, velocity: float, target: tuple, search_metho...
9,663
41.951111
433
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/settings.py
from typing import Final from enum import Enum import math FLY: Final[int] = 0 BOUNCE: Final[int] = 1 SLIDE: Final[int] = 2 GOAL: Final[int] = 3 class ABType(Enum): """Enum for the object types in Angry Birds """ Background = 0 Ground = 1 Hill = 2 Sling = 3 RedBird = 4 YellowBird = 5 ...
1,402
16.987179
75
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/state.py
import logging import math import random import copy from matplotlib import pyplot as plt import numpy as np from . import settings, utils log = logging.getLogger("rebound.State") class State(object): """Defines a state in the simulation Arguments: turn {State} -- Last State where the direction chang...
28,215
39.136558
191
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/utils.py
import logging import math import copy import numpy as np from . import settings import PIL.Image as Image log = logging.getLogger("rebound.utils") def cw(i): """The index of the next edge clockwise Arguments: i {int} -- edge Returns: int -- new edge """ return (i-1) % 4 def c...
44,913
32.025
168
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/__init__.py
from .state import State from .utils import * from .main import run, main from .search import * import logging import argparse import ast import os logging.basicConfig(level=logging.DEBUG, filename="logs/rebound.log", filemode="a", format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') def create_argparser(pa...
4,976
80.590164
351
py
BamBirds
BamBirds-master/planner/src/main/python/rebound/search.py
import logging from math import dist from queue import Queue, PriorityQueue from . import settings, utils from .state import State from dataclasses import dataclass, field from typing import Iterator from PIL import Image import numpy as np from operator import itemgetter log = logging.getLogger("rebound.search") def...
14,918
37.550388
290
py
BamBirds
BamBirds-master/src/main/python/automated_execution.py
#!/usr/bin/env python3 import os import subprocess import time import numpy as np import copy import argparse import platform # Modify to your own satisfaction/ needs learning_starting_levels = 8 learning_last_levels = 12 # current max: 12 learning_rounds = 5 learning_folder = os.path.join('data', 'learning') testi...
5,420
44.554622
193
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/__init__.py
from .vision import *
22
10.5
21
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/vision.py
from . import watershed as w from .polygon_operations import A_Star as a from .polygon_operations import Polygon as p import cv2 as cv import numpy as np import argparse import random as rng import matplotlib.pyplot as plt import math from .watershed import DiscreteCurve_2 as dc def calc_dist(vertex1, vertex2): ...
2,755
33.024691
116
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/erosion/testscript.py
from PIL import Image import os import numpy as np import ntpath ground_truth_file = "/home/nomis/Documents/AIBIRDS/Doc/analysis/pixel_diff/ground_truth_130721_standard_framerate.csv" result_file = "/home/nomis/Documents/AIBIRDS/Doc/analysis/pixel_diff/ground_truth_130721_standard_framerate_dependence_result.csv" comp...
8,069
45.37931
306
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/erosion/dilate.py
import os import cv2 as cv import ntpath import numpy as np from PIL import Image import testscript dilate_folder = "/home/nomis/Documents/AIBIRDS/Doc/dil_results/" dilate_path1 = "" dilate_path2 = "" def check_for_existing_results_file(res_file_path): if os.path.isfile(res_file_path): with open(res_file_...
6,022
45.689922
218
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/feature_extraction/BOW.py
import pickle from sklearn.cluster import KMeans import cv2 as cv import vision_watershed as w import DiscreteCurve_2 as dc import SIFT as s import numpy as np import matplotlib.pylab as plab import matplotlib.pyplot as plt image = cv.imread('/home/rocketqueen/sciencebirdsframework/screenshots/8.png') gray_image = cv...
3,173
28.943396
121
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/feature_extraction/SIFT.py
import cv2 as cv import matplotlib.pyplot as plt import vision_watershed as w import DiscreteCurve_2 as dc def get_sift(object): # object is the cropped object in grayscale # sift sift = cv.SIFT_create(contrastThreshold=0.04, sigma=0.8) keypoints, descriptors = sift.detectAndCompute(object, None) ...
1,928
27.791045
108
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/feature_extraction/NaiveBayes.py
from sklearn import preprocessing from sklearn.naive_bayes import GaussianNB, MultinomialNB from sklearn.feature_extraction.text import TfidfVectorizer import pandas as pd import numpy as np from sklearn.pipeline import make_pipeline import BOW as b class NaiveBayes: def __init__(self, _features, _labels): ...
3,185
39.846154
116
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/feature_extraction/__init__.py
0
0
0
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/watershed_dist_transform.py
from __future__ import print_function import cv2 as cv import numpy as np import argparse import random as rng import matplotlib.pyplot as plt rng.seed(12345) if __name__ == "__main__": image = cv.imread('/home/rocketqueen/sciencebirdsframework/screenshots/8.png') # image = cv.imread('/home/rocketqueen/Bil...
3,567
28.983193
86
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/Representation.py
import cv2 as cv2 import numpy as np def checkRep(b, g, r): if (b == g).all() and (b == r).all(): print("Gray") elif np.all(b == 0) or np.all(r == 0) or np.all(g == 0): print('One Color') else: print("Colored") if __name__ == '__main__': img = cv2.imread('/home/rocketqueen/sc...
732
22.645161
82
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/DiscreteCurve_2.py
from __future__ import print_function import cv2 as cv import numpy as np import argparse import random as rng import matplotlib.pyplot as plt import math from ..polygon_operations import A_Star as a import vision as v from ..polygon_operations import Polygon as p from . import vision_watershed as w rng.seed(12345) #...
5,232
29.074713
117
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/watershed.py
from __future__ import print_function import cv2 as cv import numpy as np import argparse import random as rng import matplotlib.pyplot as plt rng.seed(12345) if __name__ == "__main__": image = cv.imread('tmp/sb_image_701632605.png') # image = cv.imread('/home/rocketqueen/Bilder/water_coins.jpg') crop_...
3,327
28.714286
86
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/vision_watershed.py
from __future__ import print_function import cv2 as cv import numpy as np import argparse import random as rng rng.seed(12345) class Watershed: def __init__(self, image): self.crop_img = image[120:394, 70:700] # scale_percent = 125 # calculate the 50 percent of original dimensions ...
2,939
30.956522
90
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/watershed/__init__.py
from .vision_watershed import Watershed
39
39
39
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/polygon_operations/Polygon.py
import math from . import Intersect as inter import numpy as np # Here you can set all parameters # function refine() REFINE_ANGLE_MARGIN = 50 # function is_rect() RECT_DIAGONAL_MARGIN = 0.9 # function is_circle_2() CIRCLE_DST_MARGIN = 0.8 def latex2poly(latex): poly = latex.replace('--', ',') poly = pol...
14,462
35.98977
1,344
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/polygon_operations/A_Star.py
from . import Polygon as p from . import SplitPolygon as sp import math def is_goal(polygons_list: list) -> bool: for polygon in polygons_list: if not polygon.is_primitive(): return False return True def calc_heuristic(polygons_list: list) -> int: heuristic = 0 for polygon in pol...
3,044
35.686747
118
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/polygon_operations/SplitPolygon.py
from . import Polygon as p import math # Parameters # for function cut_polygon() COST_STRAIGHT = 1 COST_STEEP = 1 SLOPE_MARGIN = 0.5 # for function split_polygon() CLOSEST_NUM = 3 def calc_heuristic(polygon, primitive): # number of lines in polygon N = len(polygon.vertices) n = len(primitive.vertices) ...
5,397
32.116564
300
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/polygon_operations/Intersect.py
# This code is implemented using this tutorial: # https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/ class Point: def __init__(self, a, b): self.a = a self.b = b def on_segment(x, y, z): if ((y.a <= max(x.a, z.a)) and (y.a >= min(x.a, z.a)) and (y.b <= max(x...
1,080
19.788462
77
py
BamBirds
BamBirds-master/vision/src/main/python/sciencebirds/polygon_operations/__init__.py
0
0
0
py
TREMBA
TREMBA-master/DataLoader.py
import torch import torch.nn as nn import torchvision.datasets as dset import torch.utils.data import torchvision.transforms as transforms import os import json import numpy as np from torch.utils.data import Dataset, DataLoader def imagenet(state): if 'defense' in state and state['defense']: mean = n...
1,142
29.891892
67
py
TREMBA
TREMBA-master/attack.py
import argparse import torchvision.models as models import os import json import DataLoader from utils import * from FCN import * from Normalize import Normalize, Permute from imagenet_model.Resnet import resnet152_denoise, resnet101_denoise def EmbedBA(function, encoder, decoder, image, label, config, latent=None): ...
7,438
36.570707
185
py
TREMBA
TREMBA-master/utils.py
import torch.nn as nn import torch import numpy as np class MarginLoss(nn.Module): def __init__(self, margin=1.0, target=False): super(MarginLoss, self).__init__() self.margin = margin self.target = target def forward(self, logits, label): if not self.target: one...
3,786
35.413462
117
py
TREMBA
TREMBA-master/Normalize.py
import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, mean, std): super(Normalize, self).__init__() self.mean = mean self.std = std def forward(self, input): size = input.size() x = input.clone() for i in range(size[1]): ...
606
20.678571
56
py
TREMBA
TREMBA-master/FCN.py
# -*- coding: utf-8 -*- import torch import torch.nn as nn class Imagenet_Encoder(nn.Module): def __init__(self): super().__init__() self.conv1_1 = nn.Sequential( nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), ...
4,477
32.924242
107
py
TREMBA
TREMBA-master/train_generator.py
import argparse import os import json import torch import torch.nn as nn import torch.nn.functional as F from Normalize import Normalize, Permute import DataLoader import numpy as np from FCN import * from utils import * import torchvision.models as models import copy from imagenet_model.Resnet import * if __name__ ==...
5,548
36.748299
136
py
TREMBA
TREMBA-master/imagenet_model/Resnet.py
import torch.nn as nn import torch import math def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation) def ...
10,508
35.113402
108
py
DeepSatData
DeepSatData-main/dataset/__init__.py
0
0
0
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/extract_images_for_labels.py
""" Given a set of S2 tiles and a labelled_dense lable map, extract crops of images matching the location of labels """ import argparse import pandas as pd import rasterio import numpy as np import os from glob import glob import pickle if __name__ == "__main__" and __package__ is None: from sys import path fro...
8,590
40.105263
169
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/find_parcel_dimensions.py
import argparse import pandas as pd import numpy as np import matplotlib.pyplot as plt from shapely import geometry import os from glob import glob from multiprocessing import Pool if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir path.insert(0, dir(d...
5,985
39.445946
121
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/extract_images_for_parcel_labels.py
""" Given a set of S2 tiles and a labelled_dense lable map, extract crops of images matching the location of labels """ import argparse import pandas as pd import rasterio import numpy as np import os from glob import glob import pickle if __name__ == "__main__" and __package__ is None: from sys import path fro...
5,689
34.786164
119
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/extract_labels_raster.py
import argparse import pandas as pd import numpy as np from shapely import geometry import os from glob import glob from multiprocessing import Pool if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir path.insert(0, dir(dir(path[0]))) __package__ = ...
12,439
42.957597
136
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/__init__.py
0
0
0
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/make_image_timeseries_for_parcel_labels.py
""" For a set of extracted image crops and a labelled_dense label map, make a timeseries of all positions matched with labels """ import argparse import pandas as pd import numpy as np import os import shutil import pickle if __name__ == "__main__" and __package__ is None: from sys import path from os.path impo...
6,805
35.202128
129
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/extract_parcel_ground_truths.py
import argparse import pandas as pd import numpy as np from shapely import geometry import os from glob import glob from multiprocessing import Pool if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir path.insert(0, dir(dir(path[0]))) __package__ = ...
13,449
43.389439
136
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/make_image_timeseries_for_labels.py
""" For a set of extracted image crops and a labelled_dense label map, make a timeseries of all positions matched with labels """ import argparse import pandas as pd import numpy as np import os import shutil import pickle if __name__ == "__main__" and __package__ is None: from sys import path from os.path impo...
6,723
35.150538
169
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/SS/extract_images_for_parcel_labels.py
""" Given a set of S2 tiles and a labelled_dense lable map, extract crops of images matching the location of labels """ import argparse import pandas as pd import rasterio import numpy as np import os from glob import glob import pickle if __name__ == "__main__" and __package__ is None: from sys import path fro...
8,998
37.95671
128
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/SS/extract_parcel_labels_raster.py
import argparse import pandas as pd import numpy as np from shapely import geometry import os from glob import glob from multiprocessing import Pool if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir path.insert(0, dir(dir(path[0]))) __package__ = ...
18,582
38.122105
135
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/SS/__init__.py
0
0
0
py
DeepSatData
DeepSatData-main/dataset/labelled_dense/SS/make_image_timeseries_for_parcel_labels.py
""" For a set of extracted image crops and a labelled_dense label map, make a timeseries of all positions matched with labels """ import argparse import pandas as pd import numpy as np import os import shutil import pickle if __name__ == "__main__" and __package__ is None: from sys import path from os.path impo...
8,698
37.321586
129
py
DeepSatData
DeepSatData-main/dataset/France_RPG/RPG2DF.py
import argparse import shapefile from shapely import geometry import pandas as pd import os def main(): args = parser.parse_args() rpg_file = os.path.join(args.rpg_dir, 'PARCELLES_GRAPHIQUES') sf = shapefile.Reader(rpg_file) year = args.rpg_dir.split("-")[-1] # print(year) data = [] for...
1,807
30.719298
103
py
DeepSatData
DeepSatData-main/dataset/France_RPG/exploreRPG_labels.py
0
0
0
py
DeepSatData
DeepSatData-main/dataset/unlabelled/extract_images.py
""" Given a directory of Sentinel tiles extract crops of images """ import argparse import pandas as pd import rasterio import numpy as np import os from glob import glob import pickle if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir path.insert(0, d...
6,313
35.49711
119
py
DeepSatData
DeepSatData-main/dataset/unlabelled/make_image_timeseries.py
""" For a set of extracted image crops, make a timeseries for all locations """ import argparse import pandas as pd import numpy as np import os import shutil import pickle from multiprocessing import Pool if __name__ == "__main__" and __package__ is None: from sys import path from os.path import dirname as dir...
6,021
36.17284
120
py
DeepSatData
DeepSatData-main/dataset/unlabelled/__init__.py
0
0
0
py
DeepSatData
DeepSatData-main/utils/geospatial_data_utils.py
import matplotlib.pyplot as plt import numpy as np from shapely import geometry from shapely.geometry import Polygon from pyproj import Proj, transform import re from simplification.cutil import simplify_coords from sentinelsat import geojson_to_wkt class GeoTransform: def __init__(self, intr, outtr, loc2loc=Fal...
8,344
28.487633
124
py
DeepSatData
DeepSatData-main/utils/multiprocessing_utils.py
from multiprocessing import Pool def flatten_list(l): return [item for sublist in l for item in sublist] def run_pool(x, f, num_cores, split=False): if not split: x = split_num_segments(x, num_cores) print(len(x)) # x = [[x_, i] for i, x_ in enumerate(x)] pool = Pool(num_cores) res =...
1,176
25.155556
80
py
DeepSatData
DeepSatData-main/utils/data_utils.py
import re import os import zipfile def unzip_all(dir_name, extension=".zip"): for item in os.listdir(dir_name): if item.endswith(extension): file_name = os.path.join(dir_name, item) zip_ref = zipfile.ZipFile(file_name) zip_ref.extractall(dir_name) zip_ref.cl...
494
22.571429
52
py
DeepSatData
DeepSatData-main/utils/sentinel_products_utils.py
import os from glob import glob import pandas as pd import rasterio def get_S2prod_info(imdirs): data = [] for imdir in imdirs: imname = "%s_%s" % (imdir.split("/")[-2].split("_")[-3], imdir.split("/")[-4].split("_")[-5]) f = rasterio.open("%s/%s_B02.jp2" % (imdir, imname)) tile_transf...
1,920
40.76087
123
py
DeepSatData
DeepSatData-main/utils/__init__.py
0
0
0
py
DeepSatData
DeepSatData-main/utils/date_utils.py
import datetime import os from glob import glob import pandas as pd def get_doy(date): Y = date[:4] m = date[4:6] d = date[6:] date = "%s.%s.%s" % (Y, m, d) dt = datetime.datetime.strptime(date, '%Y.%m.%d') return dt.timetuple().tm_yday def get_date(day): """ :param day: day of the y...
2,077
22.348315
71
py
DeepSatData
DeepSatData-main/download/sentinelsat_download_tileid.py
# spatial data processing pipelines import argparse import pandas as pd from sentinelsat import SentinelAPI # , read_geojson, geojson_to_wkt import os from glob import glob from collections import OrderedDict # USER INPUT -----------------------------------------------------------------------------------------------...
2,015
38.529412
123
py
DeepSatData
DeepSatData-main/download/__init__.py
0
0
0
py
deepnl
deepnl-master/setup.py
try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension from Cython.Build import cythonize import numpy as np import glob def readme(): with open('README.rst') as f: text = f.read() return text extensions = [ Extension('deepnl/words', ...
2,309
27.875
70
py
deepnl
deepnl-master/bin/toIOB.py
#!/usr/bin/python """ Upgrade to new IOB convention: Inside, Outside, Begin. """ # O I -> O B # I B -> I B # I I -> I I # I O -> I O from __future__ import print_function import sys import getopt def usage(): print('usage:', sys.argv[0], '[-hr] < inFile ') print(' -r revert to old convention.') sys.ex...
1,253
20.62069
75
py
deepnl
deepnl-master/bin/knn.py
#! /usr/bin/env python """ Show the knn words in the embeddings to a given word. Usage: ./knn.py embeddings vocabulary Options: -h, --help : display this help and exit """ ## Required # # sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev libatl...
8,288
30.044944
141
py