id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,285,200 | general.py | Jisencc_yolov5_dual_weighting/utils/segment/general.py | import cv2
import numpy as np
import torch
import torch.nn.functional as F
def crop_mask(masks, boxes):
"""
"Crop" predicted masks by zeroing out everything not in the predicted bbox.
Vectorized by Chong (thanks Chong).
Args:
- masks should be a size [n, h, w] tensor of masks
- boxes ... | 5,813 | Python | .py | 129 | 39.449612 | 110 | 0.60888 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,201 | dataloaders.py | Jisencc_yolov5_dual_weighting/utils/segment/dataloaders.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Dataloaders
"""
import os
import random
import cv2
import numpy as np
import torch
from torch.utils.data import DataLoader, distributed
from ..augmentations import augment_hsv, copy_paste, letterbox
from ..dataloaders import InfiniteDataLoader, LoadImagesAndLabels, ... | 13,836 | Python | .py | 291 | 33.261168 | 118 | 0.521031 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,202 | augmentations.py | Jisencc_yolov5_dual_weighting/utils/segment/augmentations.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Image augmentation functions
"""
import math
import random
import cv2
import numpy as np
from ..augmentations import box_candidates
from ..general import resample_segments, segment2box
def mixup(im, labels, segments, im2, labels2, segments2):
# Applies MixUp a... | 3,757 | Python | .py | 85 | 36.435294 | 114 | 0.575965 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,203 | plots.py | Jisencc_yolov5_dual_weighting/utils/segment/plots.py | import contextlib
import math
from pathlib import Path
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from .. import threaded
from ..general import xywh2xyxy
from ..plots import Annotator, colors
@threaded
def plot_images_and_masks(images, targets, masks, paths=None, ... | 6,386 | Python | .py | 129 | 37.248062 | 119 | 0.510652 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,204 | metrics.py | Jisencc_yolov5_dual_weighting/utils/segment/metrics.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Model validation metrics
"""
import numpy as np
from ..metrics import ap_per_class
def fitness(x):
# Model fitness as a weighted combination of metrics
w = [0.0, 0.0, 0.1, 0.9, 0.0, 0.0, 0.1, 0.9]
return (x[:, :8] * w).sum(1)
def ap_per_class_box_and_... | 5,460 | Python | .py | 179 | 20.938547 | 81 | 0.485714 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,205 | loss.py | Jisencc_yolov5_dual_weighting/utils/segment/loss.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..general import xywh2xyxy
from ..loss import FocalLoss, smooth_BCE
from ..metrics import bbox_iou
from ..torch_utils import de_parallel
from .general import crop_mask
class ComputeLoss:
# Compute losses
def __init__(self, model, autobal... | 8,591 | Python | .py | 159 | 41.371069 | 117 | 0.517131 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,206 | __init__.py | Jisencc_yolov5_dual_weighting/utils/loggers/__init__.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from pathlib import Path
import pkg_resources as pkg
import torch
from utils.general import LOGGER, colorstr, cv2
from utils.loggers.clearml.clearml_utils import ClearmlLogger
from utils.loggers.wandb.wandb_utils import Wa... | 16,483 | Python | .py | 336 | 38.029762 | 123 | 0.587676 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,207 | wandb_utils.py | Jisencc_yolov5_dual_weighting/utils/loggers/wandb/wandb_utils.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
# WARNING ⚠� wandb is deprecated and will be removed in future release.
# See supported integrations at https://github.com/ultralytics/yolov5#integrations
import logging
import os
import sys
from contextlib import contextmanager
from pathlib import Path
from utils.g... | 8,253 | Python | .py | 164 | 37.780488 | 124 | 0.594169 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,208 | comet_utils.py | Jisencc_yolov5_dual_weighting/utils/loggers/comet/comet_utils.py | import logging
import os
from urllib.parse import urlparse
try:
import comet_ml
except (ModuleNotFoundError, ImportError):
comet_ml = None
import yaml
logger = logging.getLogger(__name__)
COMET_PREFIX = 'comet://'
COMET_MODEL_NAME = os.getenv('COMET_MODEL_NAME', 'yolov5')
COMET_DEFAULT_CHECKPOINT_FILENAME =... | 4,751 | Python | .py | 115 | 33.747826 | 104 | 0.67181 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,209 | __init__.py | Jisencc_yolov5_dual_weighting/utils/loggers/comet/__init__.py | import glob
import json
import logging
import os
import sys
from pathlib import Path
logger = logging.getLogger(__name__)
FILE = Path(__file__).resolve()
ROOT = FILE.parents[3] # YOLOv5 root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ROOT to PATH
try:
import comet_ml
# Pr... | 18,934 | Python | .py | 407 | 34.87715 | 118 | 0.582591 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,210 | hpo.py | Jisencc_yolov5_dual_weighting/utils/loggers/comet/hpo.py | import argparse
import json
import logging
import os
import sys
from pathlib import Path
import comet_ml
logger = logging.getLogger(__name__)
FILE = Path(__file__).resolve()
ROOT = FILE.parents[3] # YOLOv5 root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ROOT to PATH
from train im... | 6,653 | Python | .py | 97 | 63.371134 | 120 | 0.697475 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,211 | hpo.py | Jisencc_yolov5_dual_weighting/utils/loggers/clearml/hpo.py | from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
from clearml.automation import HyperParameterOptimizer, UniformParameterRange
from clearml.automation.optuna import OptimizerOptuna
task = Task.init(project_name='Hyper-Parameter Optimization',
... | 5,271 | Python | .py | 80 | 60.05 | 112 | 0.739734 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,212 | clearml_utils.py | Jisencc_yolov5_dual_weighting/utils/loggers/clearml/clearml_utils.py | """Main Logger class for ClearML experiment tracking."""
import glob
import re
from pathlib import Path
import numpy as np
import yaml
from ultralytics.utils.plotting import Annotator, colors
try:
import clearml
from clearml import Dataset, Task
assert hasattr(clearml, '__version__') # verify package im... | 8,048 | Python | .py | 138 | 45.789855 | 142 | 0.614204 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,213 | resume.py | Jisencc_yolov5_dual_weighting/utils/aws/resume.py | # Resume all interrupted trainings in yolov5/ dir including DDP trainings
# Usage: $ python utils/aws/resume.py
import os
import sys
from pathlib import Path
import torch
import yaml
FILE = Path(__file__).resolve()
ROOT = FILE.parents[2] # YOLOv5 root directory
if str(ROOT) not in sys.path:
sys.path.append(str(... | 1,198 | Python | .py | 32 | 33.1875 | 116 | 0.647668 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,214 | predict.py | Jisencc_yolov5_dual_weighting/segment/predict.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Run YOLOv5 segmentation inference on images, videos, directories, streams, etc.
Usage - sources:
$ python segment/predict.py --weights yolov5s-seg.pt --source 0 # webcam
... | 15,787 | Python | .py | 252 | 48.896825 | 123 | 0.557993 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,215 | tutorial.ipynb | Jisencc_yolov5_dual_weighting/segment/tutorial.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "t6MPjfT5NrKQ"
},
"source": [
"<div align=\"center\">\n",
"\n",
" <a href=\"https://ultralytics.com/yolov5\" target=\"_blank\">\n",
" <img width=\"1024\", src=\"https://raw.githubusercon... | 43,437 | Python | .py | 595 | 63.532773 | 849 | 0.486929 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,216 | val.py | Jisencc_yolov5_dual_weighting/segment/val.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Validate a trained YOLOv5 segment model on a segment dataset
Usage:
$ bash data/scripts/get_coco.sh --val --segments # download COCO-segments val split (1G, 5000 images)
$ python segment/val.py --weights yolov5s-seg.pt --data coco.yaml --img 640 # validate C... | 23,993 | Python | .py | 417 | 46.333333 | 122 | 0.587415 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,217 | train.py | Jisencc_yolov5_dual_weighting/segment/train.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Train a YOLOv5 segment model on a segment dataset
Models and datasets download automatically from the latest YOLOv5 release.
Usage - Single-GPU training:
$ python segment/train.py --data coco128-seg.yaml --weights yolov5s-seg.pt --img 640 # from pretrained (recom... | 34,745 | Python | .py | 596 | 46.394295 | 165 | 0.572288 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,218 | predict.py | Jisencc_yolov5_dual_weighting/classify/predict.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Run YOLOv5 classification inference on images, videos, directories, globs, YouTube, webcam, streams, etc.
Usage - sources:
$ python classify/predict.py --weights yolov5s-cls.pt --source 0 # webcam
... | 11,774 | Python | .py | 197 | 46.045685 | 124 | 0.550186 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,219 | val.py | Jisencc_yolov5_dual_weighting/classify/val.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Validate a trained YOLOv5 classification model on a classification dataset
Usage:
$ bash data/scripts/get_imagenet.sh --val # download ImageNet val split (6.3G, 50000 images)
$ python classify/val.py --weights yolov5m-cls.pt --data ../datasets/imagenet --img ... | 8,084 | Python | .py | 146 | 44.705479 | 120 | 0.594516 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,220 | train.py | Jisencc_yolov5_dual_weighting/classify/train.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Train a YOLOv5 classifier model on a classification dataset
Usage - Single-GPU training:
$ python classify/train.py --model yolov5s-cls.pt --data imagenette160 --epochs 5 --img 224
Usage - Multi-GPU DDP training:
$ python -m torch.distributed.run --nproc_per_... | 16,395 | Python | .py | 286 | 46.192308 | 170 | 0.600174 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,221 | setup.py | matthias-mayr_SkiROS2_skill_learning_demo/setup.py | ## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['skiros2_skill_learning_demo'],
package_dir={'': 'src'},
)
setup(**setup... | 327 | Python | .py | 9 | 34.111111 | 61 | 0.765079 | matthias-mayr/SkiROS2_skill_learning_demo | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,222 | learning.py | matthias-mayr_SkiROS2_skill_learning_demo/src/learning.py | #!/usr/bin/env python3
import math
import numpy as np
import time
import sys
import signal
import rospy
import textwrap
from skiros2_skill.ros.skill_layer_interface import SkillLayerInterface
from skiros2_common.core.world_element import Element
from skiros2_world_model.ros.world_model_interface import WorldModelInte... | 7,929 | Python | .py | 163 | 38.797546 | 160 | 0.640474 | matthias-mayr/SkiROS2_skill_learning_demo | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,223 | compound_skills.py | matthias-mayr_SkiROS2_skill_learning_demo/src/skiros2_skill_learning_demo/compound_skills.py | from skiros2_skill.core.skill import SkillDescription, SkillBase, ParallelFs, SerialStar
from skiros2_common.core.params import ParamTypes
from skiros2_common.core.world_element import Element
#################################################################################
# Descriptions
#############################... | 6,392 | Python | .py | 95 | 59 | 270 | 0.629606 | matthias-mayr/SkiROS2_skill_learning_demo | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,224 | primitive_skills.py | matthias-mayr_SkiROS2_skill_learning_demo/src/skiros2_skill_learning_demo/primitive_skills.py | from skiros2_skill.core.skill import SkillDescription
from skiros2_common.core.conditions import ConditionHasProperty
from skiros2_common.core.params import ParamTypes
from skiros2_common.core.world_element import Element
from skiros2_common.core.primitive import PrimitiveBase
from skiros2_std_skills.action_client_prim... | 11,871 | Python | .py | 246 | 39.98374 | 131 | 0.649067 | matthias-mayr/SkiROS2_skill_learning_demo | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,225 | train.py | davidjaw_Domain-adaptation-object-detection-with-YOLOv8/train.py | from ultralytics.models import YOLO
from ultralytics.models.yolo.detect.train import DetectionTrainer
from ultralytics.data.utils import check_det_dataset
from ultralytics.utils import LOGGER, RANK, TQDM, colorstr, emojis, clean_url
import ultralytics.utils.callbacks.tensorboard as tb_module
import numpy as np
import t... | 27,350 | Python | .py | 515 | 34.658252 | 123 | 0.578832 | davidjaw/Domain-adaptation-object-detection-with-YOLOv8 | 8 | 1 | 1 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,226 | vis.py | davidjaw_Domain-adaptation-object-detection-with-YOLOv8/scripts/vis.py | import os
from utils import visualize, get_img_label_path
import cv2
import torch
import torchvision
import numpy as np
img_paths, label_paths = get_img_label_path('G:/dataset/ACDC/YOLO/train/fog')
for i, img_path in enumerate(img_paths):
img = cv2.imread(img_path)
labels = []
with open(label_paths[i], '... | 446 | Python | .py | 14 | 28 | 77 | 0.691589 | davidjaw/Domain-adaptation-object-detection-with-YOLOv8 | 8 | 1 | 1 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,227 | dataset_preprocessing.py | davidjaw_Domain-adaptation-object-detection-with-YOLOv8/scripts/dataset_preprocessing.py | import json
import os
import torch
from torchvision.ops import box_convert
import shutil
import yaml
from multiprocessing import Pool
class LabelHandler:
def __init__(self, train_d, val_d):
assert train_d is not None and val_d is not None, 'data, train_d, val_d must be provided.'
tool_dict = {
... | 8,007 | Python | .py | 170 | 37.264706 | 103 | 0.564427 | davidjaw/Domain-adaptation-object-detection-with-YOLOv8 | 8 | 1 | 1 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,228 | utils.py | davidjaw_Domain-adaptation-object-detection-with-YOLOv8/scripts/utils.py | import numpy as np
import os
import cv2
def load_setup(yaml_path='config.yaml'):
import yaml
with open(yaml_path, 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
# determine whether os is windows or linux
if os.name == 'nt':
config = config['windows']
else:
config ... | 10,566 | Python | .py | 235 | 37.655319 | 121 | 0.608188 | davidjaw/Domain-adaptation-object-detection-with-YOLOv8 | 8 | 1 | 1 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,229 | endpoints.py | kartFr_Auto-Animation-Reuploader/src/endpoints.py | github_repo_latest = "https://api.github.com/repos/kartFr/Auto-Animation-Reuploader/releases/latest"
asset_delivery = "https://assetdelivery.roblox.com/v1/asset/?id="
asset_info = "https://develop.roblox.com/v1/assets?assetIds="
authenticated = "https://users.roblox.com/v1/users/authenticated"
def getPublishUrl(assetT... | 714 | Python | .py | 16 | 38.625 | 100 | 0.674785 | kartFr/Auto-Animation-Reuploader | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,230 | updater.py | kartFr_Auto-Animation-Reuploader/src/updater.py | from io import BytesIO
from zipfile import ZipFile
import requests
import subprocess
if __name__ == '__main__':
downloadRequest = requests.get("https://github.com/kartFr/Auto-Animation-Reuploader/releases/latest/download/AnimationReuploader.zip").content
downloadData = BytesIO(downloadRequest)
fileNames =... | 1,004 | Python | .py | 20 | 43.05 | 159 | 0.712074 | kartFr/Auto-Animation-Reuploader | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,231 | main.py | kartFr_Auto-Animation-Reuploader/src/main.py | #
# This program reuploads animations to roblox.
#
# Copyright (C) 2024 kartFr
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | 11,525 | Python | .py | 272 | 33.330882 | 190 | 0.633261 | kartFr/Auto-Animation-Reuploader | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,232 | setup.py | weecology_MillionTrees/setup.py | import setuptools
import os
import sys
here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(here, 'milliontrees'))
from version import __version__
print(f'Version {__version__}')
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptool... | 1,273 | Python | .py | 42 | 23.547619 | 74 | 0.610793 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,233 | DeepForest.py | weecology_MillionTrees/DeepForest.py | import os
import sys
import argparse
if os.path.basename(os.getcwd()) == 'examples':
sys.path.append("../")
from milliontrees import get_dataset
from milliontrees.common.data_loaders import get_train_loader
from deepforest.main import deepforest
from pytorch_lightning.loggers import CometLogger
def parse_args():... | 1,659 | Python | .py | 43 | 33.27907 | 98 | 0.682045 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,234 | conf.py | weecology_MillionTrees/docs/conf.py | # Configuration file for the Sphinx documentation builder.
import os
import sys
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
sys.path.insert(0, os.path.join(curr_path, '..'))
sys.path.insert(0, os.path.abspath('..'))
# For the full list of built-in configuration values, see the documenta... | 1,304 | Python | .py | 28 | 44.892857 | 87 | 0.652964 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,235 | Gaungzhou2022.py | weecology_MillionTrees/docs/Gaungzhou2022.py | import os
import pandas as pd
from deepforest.utilities import read_file
import json
# Define the directory containing the JSON files
json_dir = "/orange/ewhite/DeepForest/Guangzhou2022/GZIndividualTree_Anno"
# Initialize an empty list to store data
data = []
# Iterate over all JSON files in the directory
for filena... | 1,798 | Python | .py | 40 | 36.325 | 93 | 0.62551 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,236 | baseline_boxes.ipynb | weecology_MillionTrees/docs/examples/baseline_boxes.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evaluating baseline performance"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this notebook, we illustrate the performance of the baseline box model against the official training split."
]
... | 506,134 | Python | .py | 463 | 1,086.589633 | 484,970 | 0.948488 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,237 | Datasets.ipynb | weecology_MillionTrees/docs/examples/Datasets.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting started with MillionTrees datasets"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['TreePoin... | 10,103 | Python | .py | 306 | 27.937908 | 428 | 0.584606 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,238 | get_dataset.py | weecology_MillionTrees/milliontrees/get_dataset.py | from typing import Optional
import milliontrees
def get_dataset(dataset: str,
version: Optional[str] = None,
unlabeled: bool = False,
**dataset_kwargs):
"""Returns the appropriate milliontrees dataset class.
Input:
dataset (str): Name of th... | 2,637 | Python | .py | 50 | 39.12 | 112 | 0.634384 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,239 | __init__.py | weecology_MillionTrees/milliontrees/__init__.py | from .version import __version__
from .get_dataset import get_dataset
benchmark_datasets = [
'TreePoints',
'TreeBoxes',
'TreePolygons',
]
additional_datasets = []
supported_datasets = benchmark_datasets + additional_datasets
unlabeled_datasets = [
'NEON',
]
unlabeled_splits = [
... | 398 | Python | .py | 15 | 22.533333 | 76 | 0.699732 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,240 | download_datasets.py | weecology_MillionTrees/milliontrees/download_datasets.py | import os, sys
import argparse
import milliontrees
def main():
"""Downloads the latest versions of all specified datasets, if they do not
already exist."""
parser = argparse.ArgumentParser()
parser.add_argument(
'--root_dir',
required=True,
help=
'The direc... | 1,744 | Python | .py | 44 | 29.522727 | 215 | 0.609134 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,241 | version.py | weecology_MillionTrees/milliontrees/version.py | # Adapted from https://github.com/snap-stanford/ogb/blob/master/ogb/version.py
import os
import logging
from threading import Thread
__version__ = '0.0.0-alpha'
try:
os.environ['OUTDATED_IGNORE'] = '1'
from outdated import check_outdated # noqa
except ImportError:
check_outdated = None
... | 754 | Python | .py | 22 | 27.272727 | 79 | 0.647632 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,242 | data_loaders.py | weecology_MillionTrees/milliontrees/common/data_loaders.py | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.sampler import WeightedRandomSampler, SubsetRandomSampler
from milliontrees.common.utils import get_counts, split_into_groups
from milliontrees.datasets.milliontrees_dataset import MillionTreesDataset
def get_train_loader(loader,
... | 7,697 | Python | .py | 149 | 35.95302 | 169 | 0.569656 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,243 | utils.py | weecology_MillionTrees/milliontrees/common/utils.py | import torch
import numpy as np
from torch.utils.data import Subset
from pandas.api.types import CategoricalDtype
def minimum(numbers, empty_val=0.):
if isinstance(numbers, torch.Tensor):
if numbers.numel() == 0:
return torch.tensor(empty_val, device=numbers.device)
else:
r... | 4,976 | Python | .py | 131 | 28.259542 | 92 | 0.590956 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,244 | grouper.py | weecology_MillionTrees/milliontrees/common/grouper.py | import copy
import pdb
from typing import Dict, List, Union
import numpy as np
import torch
from milliontrees.common.utils import get_counts
from milliontrees.datasets.milliontrees_dataset import MillionTreesDataset, MillionTreesSubset
import warnings
class Grouper:
"""Groupers group data points toge... | 9,201 | Python | .py | 189 | 34.058201 | 141 | 0.545648 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,245 | all_metrics.py | weecology_MillionTrees/milliontrees/common/metrics/all_metrics.py | import copy
import numpy as np
import torch
import torch.nn.functional as F
from torchvision.ops.boxes import box_iou
from torchvision.models.detection._utils import Matcher
from torchvision.ops import nms, box_convert
from milliontrees.common.metrics.metric import Metric, ElementwiseMetric, MultiTaskMetric
from mill... | 15,865 | Python | .py | 347 | 35.642651 | 103 | 0.609614 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,246 | loss.py | weecology_MillionTrees/milliontrees/common/metrics/loss.py | import torch
from milliontrees.common.utils import avg_over_groups, maximum
from milliontrees.common.metrics.metric import ElementwiseMetric, Metric, MultiTaskMetric
class Loss(Metric):
def __init__(self, loss_fn, name=None):
self.loss_fn = loss_fn
if name is None:
name = 'loss'
... | 3,027 | Python | .py | 76 | 30.723684 | 89 | 0.60969 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,247 | metric.py | weecology_MillionTrees/milliontrees/common/metrics/metric.py | import numpy as np
from milliontrees.common.utils import avg_over_groups, get_counts, numel
import torch
class Metric:
"""Parent class for metrics."""
def __init__(self, name):
self._name = name
def _compute(self, y_pred, y_true):
"""Helper function for computing the metric. Subclasses s... | 10,334 | Python | .py | 221 | 34.886878 | 109 | 0.587867 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,248 | TreePolygons.py | weecology_MillionTrees/milliontrees/datasets/TreePolygons.py | from datetime import datetime
from pathlib import Path
import os
from PIL import Image, ImageDraw
import pandas as pd
import numpy as np
import torch
from shapely import from_wkt
from milliontrees.datasets.milliontrees_dataset import MillionTreesDataset
from milliontrees.common.grouper import CombinatorialGrouper
from... | 8,052 | Python | .py | 176 | 35.164773 | 225 | 0.60212 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,249 | TreePoints.py | weecology_MillionTrees/milliontrees/datasets/TreePoints.py | from datetime import datetime
from pathlib import Path
import os
from PIL import Image
import pandas as pd
import numpy as np
import torch
from milliontrees.datasets.milliontrees_dataset import MillionTreesDataset
from milliontrees.common.grouper import CombinatorialGrouper
from milliontrees.common.metrics.all_metric... | 6,314 | Python | .py | 147 | 32.292517 | 225 | 0.586443 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,250 | TreeBoxes.py | weecology_MillionTrees/milliontrees/datasets/TreeBoxes.py | from datetime import datetime
from pathlib import Path
import os
import pandas as pd
import numpy as np
import torch
from milliontrees.datasets.milliontrees_dataset import MillionTreesDataset
from milliontrees.common.grouper import CombinatorialGrouper
from milliontrees.common.metrics.all_metrics import Det... | 7,295 | Python | .py | 162 | 33.771605 | 193 | 0.587209 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,251 | milliontrees_dataset.py | weecology_MillionTrees/milliontrees/datasets/milliontrees_dataset.py | import os
import time
import torch
import numpy as np
import albumentations as A
from albumentations.pytorch import ToTensorV2
class MillionTreesDataset:
"""Shared dataset class for all MillionTrees datasets.
Each data point in the dataset is an (x, y, metadata) tuple, where:
- x is the input features
... | 20,320 | Python | .py | 441 | 35.226757 | 131 | 0.593856 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,252 | download_utils.py | weecology_MillionTrees/milliontrees/datasets/download_utils.py | """
This file contains utility functions for downloading datasets.
The code in this file is taken from the torchvision package,
specifically, https://github.com/pytorch/vision/blob/master/torchvision/datasets/utils.py.
We package it here to avoid users having to install the rest of torchvision.
It is licensed unde... | 12,843 | Python | .py | 276 | 36.51087 | 110 | 0.619109 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,253 | TreeBoxesUnlabeled.py | weecology_MillionTrees/milliontrees/datasets/unlabeled/TreeBoxesUnlabeled.py | from datetime import datetime
from pathlib import Path
import os
from PIL import Image
import pandas as pd
import numpy as np
import torch
import json
from milliontrees.datasets.unlabeled.milliontrees_unlabeled_dataset import milliontreesUnlabeledDataset
from milliontrees.common.grouper import CombinatorialGrouper
fr... | 5,154 | Python | .py | 127 | 29.598425 | 155 | 0.559576 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,254 | TreePointsUnlabeled.py | weecology_MillionTrees/milliontrees/datasets/unlabeled/TreePointsUnlabeled.py | from datetime import datetime
from pathlib import Path
import os
from PIL import Image
import pandas as pd
import numpy as np
import torch
import json
from milliontrees.datasets.unlabeled.milliontrees_unlabeled_dataset import milliontreesUnlabeledDataset
from milliontrees.common.grouper import Combinatoria... | 5,303 | Python | .py | 127 | 29.606299 | 156 | 0.545809 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,255 | TreePolygonsUnlabeled.py | weecology_MillionTrees/milliontrees/datasets/unlabeled/TreePolygonsUnlabeled.py | from datetime import datetime
from pathlib import Path
import os
from PIL import Image
import pandas as pd
import numpy as np
import torch
import json
from milliontrees.datasets.unlabeled.milliontrees_unlabeled_dataset import milliontreesUnlabeledDataset
from milliontrees.common.grouper import CombinatorialGrouper
fr... | 5,157 | Python | .py | 127 | 29.622047 | 155 | 0.55984 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,256 | CHM.py | weecology_MillionTrees/data_prep/CHM.py | #CHM height module. Given a x,y location and a pool of CHM images, find the matching location and extract the crown level CHM measurement
import glob
import numpy as np
from utilities import find_sensor_path
import rasterstats
import geopandas as gpd
import pandas as pd
import traceback
def non_zero_99_quantile(x):
... | 4,946 | Python | .py | 111 | 34.414414 | 144 | 0.617367 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,257 | NEON_mining.py | weecology_MillionTrees/data_prep/NEON_mining.py | import glob
import random
import rasterio
from rasterio.windows import Window
def crop_random_image(glob_path, save_directory):
# Search for image files using glob
image_files = glob.glob(glob_path)
if not image_files:
print("No image files found.")
return
# Select a random image file... | 1,218 | Python | .py | 32 | 32.40625 | 61 | 0.685641 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,258 | ForestGEO.py | weecology_MillionTrees/data_prep/ForestGEO.py | import geopandas as gpd
# def ForestGEO():
# """Point data from within the NEON sites"""
# OSBS = gpd.read_file("/orange/idtrees-collab/megaplot/OSBS_megaplot.shp")
# SERC = gpd.read_file("/orange/idtrees-collab/megaplot/SERC_megaplot.shp")
# HARV = gpd.read_file("/orange/idtrees-collab/megaplot/HARV_megaplo... | 386 | Python | .py | 8 | 47.125 | 78 | 0.716931 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,259 | Hickman2021.py | weecology_MillionTrees/data_prep/Hickman2021.py | from deepforest.preprocess import split_raster, read_file
from deepforest.visualize import plot_results
import pandas as pd
import geopandas as gpd
import rasterio
import numpy as np
import random
import os
import cv2
def clean_up_rgb():
rgb = "/orange/ewhite/DeepForest/Hickman2021/RCD105_MA14_21_orthomosaic_20141... | 3,867 | Python | .py | 87 | 38.873563 | 165 | 0.697847 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,260 | Wagner.py | weecology_MillionTrees/data_prep/Wagner.py | import os
import geopandas as gpd
from shapely.geometry import box
from deepforest.utilities import read_file
import pandas as pd
import rasterio as rio
from rasterio.warp import calculate_default_transform, reproject, Resampling
# Define paths
geopackage_dir = "/orange/ewhite/DeepForest/Wagner_Australia/Crowns (manu... | 5,451 | Python | .py | 117 | 32.196581 | 138 | 0.556689 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,261 | Firoze2023.py | weecology_MillionTrees/data_prep/Firoze2023.py | import os
import json
import pandas as pd
def extract_bounding_boxes_from_labelme(folder_path):
data = []
for filename in os.listdir(folder_path):
if filename.endswith('.json'):
json_path = os.path.join(folder_path, filename)
with open(json_path, 'r') as file:
l... | 1,501 | Python | .py | 30 | 38.9 | 113 | 0.610371 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,262 | collect_tasks.py | weecology_MillionTrees/data_prep/collect_tasks.py | # Collect individual datasets into boxes, polygon and point datasets
import pandas as pd
import os
import shutil
import geopandas as gpd
import zipfile
from deepforest.visualize import plot_results
from deepforest.utilities import read_file
import cv2
TreeBoxes = [
"/orange/ewhite/DeepForest/Ryoungseob_2023/train_... | 13,934 | Python | .py | 206 | 64.373786 | 145 | 0.782644 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,263 | OliveTrees_spain.py | weecology_MillionTrees/data_prep/OliveTrees_spain.py | import os
import json
import pandas as pd
import geopandas as gpd
from deepforest import utilities
def extract_annotations(json_path, image_dir):
with open(json_path) as f:
data = json.load(f)
annotations = []
for key, value in data.items():
filename = value['filename']
regions... | 1,956 | Python | .py | 41 | 42.243902 | 107 | 0.702105 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,264 | NeonBenchmark.py | weecology_MillionTrees/data_prep/NeonBenchmark.py | import glob
import os
import pandas as pd
from deepforest.utilities import read_file
# Define the base path
BASE_PATH = "/orange/ewhite/b.weinstein/NeonTreeEvaluation/hand_annotations/crops"
# Load all CSV files in the specified directory
csv_files = glob.glob(os.path.join(BASE_PATH, "*.csv"))
csv_list = []
for csv_... | 1,382 | Python | .py | 31 | 42.451613 | 105 | 0.774627 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,265 | UrbanLondon.py | weecology_MillionTrees/data_prep/UrbanLondon.py | import geopandas as gpd
from deepforest.utilities import read_file
import rasterio as rio
import os
from shapely.geometry import box
import pandas as pd
train_crowns = gpd.read_file("/orange/ewhite/DeepForest/UrbanLondon/crowns/tiles_0.25m_160_20_0_train_crowns.shp")
test_crowns = gpd.read_file("/orange/ewhite/DeepFor... | 1,741 | Python | .py | 30 | 53.633333 | 117 | 0.733058 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,266 | Beloiu2023.py | weecology_MillionTrees/data_prep/Beloiu2023.py | import random
import glob
import os
import pandas as pd
import shutil
import rasterio as rio
import xml.etree.ElementTree as ET
from deepforest.utilities import crop_raster, read_file
from shapely.geometry import Point, box
def read_xml_Beloiu(path):
tree = ET.parse(path)
root = tree.getroot()
# Initiali... | 3,150 | Python | .py | 83 | 31.26506 | 182 | 0.643773 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,267 | Ryoungseob2023.py | weecology_MillionTrees/data_prep/Ryoungseob2023.py | import glob
import pandas as pd
from deepforest.utilities import read_file
def Ryoungseob_2023():
xmls = glob.glob("/orange/ewhite/DeepForest/Ryoungseob_2023/train_datasets/annotations/*.xml")
#Load and format xmls
annotation_list = []
for xml_path in xmls:
try:
annotation = rea... | 940 | Python | .py | 22 | 36.545455 | 150 | 0.689352 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,268 | Jansen2023.py | weecology_MillionTrees/data_prep/Jansen2023.py | import glob
import os
import pandas as pd
from deepforest.utilities import read_file
from deepforest.preprocess import split_raster
import geopandas as gpd
import rasterio as rio
from rasterio.plot import show
from matplotlib import pyplot as plt
from shapely.geometry import box
import shutil
def Jansen_2023():
sh... | 2,264 | Python | .py | 51 | 38.098039 | 139 | 0.680455 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,269 | SiDroneForest.py | weecology_MillionTrees/data_prep/SiDroneForest.py | import glob
import os
import geopandas as gpd
import rasterio
from rasterio.warp import calculate_default_transform, reproject, Resampling
from shapely.geometry import box
import pandas as pd
import shutil
from deepforest.utilities import read_file, crop_raster
def Siberia_polygons():
shps = glob.glob("/blue/ewhit... | 4,398 | Python | .py | 96 | 34.072917 | 158 | 0.590695 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,270 | destroy_geo.py | weecology_MillionTrees/data_prep/destroy_geo.py | import rasterio
import geopandas
rgb_path = "/Users/benweinstein/Downloads/2022_HARV_7_731000_4713000_image.tif"
# Read RGB image
src = rasterio.open(rgb_path)
print("The input crs is: ", src.crs)
# Read shapefile
shp_path = "/Users/benweinstein/Downloads/sample.shp"
gdf = geopandas.read_file(shp_path)
print("The sh... | 1,706 | Python | .py | 39 | 39.948718 | 127 | 0.73301 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,271 | eval_wrapper.py | weecology_MillionTrees/data_prep/eval_wrapper.py | # Evaluation module
"""The goal of the evaluation module is to allow evalution metrics for each dataset"""
import glob
import pandas as pd
import os
def box_wrapper(m):
eval_csvs = {
#"Radogoshi_Sweden":"/blue/ewhite/DeepForest/Radogoshi_Sweden/images/test.csv",
#"NeonTreeEvaluation":"/orange/idtrees-colla... | 1,707 | Python | .py | 39 | 37.615385 | 111 | 0.685039 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,272 | Alejandro_Chile.py | weecology_MillionTrees/data_prep/Alejandro_Chile.py | import os
import geopandas as gpd
from deepforest import utilities
import pandas as pd
import rasterio
from PIL import Image
# Directory containing the shapefiles and tif files
directory = "/orange/ewhite/DeepForest/Alejandro_Chile/alejandro"
# List to store all the GeoDataFrames
gdfs = []
# Iterate over all files i... | 3,622 | Python | .py | 79 | 38.506329 | 123 | 0.669139 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,273 | HemmingSchroeder.py | weecology_MillionTrees/data_prep/HemmingSchroeder.py | import geopandas as gpd
import glob
import pandas as pd
from utilities import *
from deepforest.utilities import crop_raster, geo_to_image_coordinates
import rasterio as rio
def HemmingSchroeder():
"""Polygon annotations over TEAK NEON sites"""
# Read the polygon annotations from the shapefile
annotat... | 2,865 | Python | .py | 51 | 46.352941 | 132 | 0.683692 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,274 | WRI.py | weecology_MillionTrees/data_prep/WRI.py | import os
import pandas as pd
from deepforest import utilities
from deepforest.preprocess import split_raster
from PIL import Image
# Define the root directory
root_dir = "/orange/ewhite/DeepForest/WRI/WRI-labels-opensource"
crop_dir = "/orange/ewhite/DeepForest/WRI/WRI-labels-opensource/crops"
# Initialize an empty l... | 2,132 | Python | .py | 40 | 47.525 | 122 | 0.699854 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,275 | ArcGISRestServer.py | weecology_MillionTrees/data_prep/ArcGISRestServer.py | # Download from ArcGIS Rest Service
import requests
import os
import sys
import time
#"usda":"https://gis.apfo.usda.gov/arcgis/rest/services/NAIP/USDA_CONUS_PRIME/ImageServer"
sites = {
"calgary": "https://gis.calgary.ca/arcgis/rest/services/pub_Orthophotos/CurrentOrthophoto/ImageServer/exportImage?bbox=-7403.92%... | 2,777 | Python | .py | 32 | 82.4375 | 477 | 0.780817 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,276 | Tonga.py | weecology_MillionTrees/data_prep/Tonga.py | import geopandas as gpd
from deepforest.utilities import read_file
from deepforest.preprocess import split_raster
from deepforest.visualize import plot_results
import rasterio as rio
from rasterio import warp
import os
from matplotlib import pyplot as plt
gdf = gpd.read_file("/orange/ewhite/DeepForest/Tonga/Kolovai-Tr... | 1,215 | Python | .py | 26 | 42.5 | 128 | 0.739204 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,277 | Araujo_2020.py | weecology_MillionTrees/data_prep/Araujo_2020.py | from deepforest import main
from deepforest.utilities import read_file
from deepforest.preprocess import split_raster
from deepforest.visualize import plot_results
import os
import geopandas as gpd
import pandas as pd
import rasterio as rio
from matplotlib import pyplot as plt
from shapely.geometry import box
gdf = gp... | 1,611 | Python | .py | 28 | 54.785714 | 166 | 0.752688 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,278 | Velasquez-Camacho.py | weecology_MillionTrees/data_prep/Velasquez-Camacho.py | import glob
import pandas as pd
from deepforest.utilities import read_file
import os
import rasterio
from rasterio.enums import Resampling
import numpy as np
from PIL import Image
def Velasquez2023():
xmls = glob.glob("/orange/ewhite/DeepForest/Velasquez_urban_trees/tree_canopies/nueva_carpeta/*.xml")
tif_fil... | 1,914 | Python | .py | 41 | 39.804878 | 162 | 0.677784 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,279 | ReForestTree.py | weecology_MillionTrees/data_prep/ReForestTree.py | import pandas as pd
from deepforest.utilities import read_file
def ReForestTree():
"""This dataset used deepforest to generate predictions which were cleaned, no test data can be used"""
annotations = pd.read_csv("/orange/ewhite/DeepForest/ReForestTree/mapping/final_dataset.csv")
annotations["image_path"] =... | 1,072 | Python | .py | 17 | 58.823529 | 117 | 0.722433 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,280 | utilities.py | weecology_MillionTrees/data_prep/utilities.py | import argparse
import yaml
import json
import pandas as pd
import glob
import geopandas as gpd
import os
import re
import rasterio
import math
import numpy as np
from deepforest.utilities import xml_to_annotations
import warnings
import shapely
# Utilities Module
def read_config(config_path):
"""Read config yaml ... | 14,062 | Python | .py | 319 | 34.090909 | 215 | 0.611107 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,281 | Ventura2022.py | weecology_MillionTrees/data_prep/Ventura2022.py | import glob
import pandas as pd
import os
from deepforest.utilities import read_file
import shutil
def Ventura2022():
all_csvs = glob.glob("/blue/ewhite/DeepForest/Ventura_2022/urban-tree-detection-data/csv/*.csv")
train_images = pd.read_csv("/blue/ewhite/DeepForest/Ventura_2022/urban-tree-detection-data/train... | 2,273 | Python | .py | 36 | 57.75 | 162 | 0.718354 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,282 | NEON_points.py | weecology_MillionTrees/data_prep/NEON_points.py | # NEON Point Locations
import geopandas as gpd
import pandas as pd
from deepforest.utilities import crop_raster, read_file
from utilities import find_sensor_path
from deepforest.visualize import plot_results
from matplotlib import pyplot as plt
import glob
import os
points = gpd.read_file("/orange/idtrees-collab/Deep... | 2,259 | Python | .py | 52 | 39.269231 | 172 | 0.715982 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,283 | justdiggit.py | weecology_MillionTrees/data_prep/justdiggit.py | import json
import pandas as pd
from deepforest.utilities import read_file
from deepforest.visualize import plot_results
from matplotlib import pyplot as plt
with open("/orange/ewhite/DeepForest/justdiggit-drone/label_sample/Annotations_trees_only.json") as jsonfile:
data = json.load(jsonfile)
ids = [x["id... | 1,515 | Python | .py | 28 | 50.714286 | 116 | 0.726415 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,284 | Cloutier2023.py | weecology_MillionTrees/data_prep/Cloutier2023.py | import glob
import pandas as pd
from preprocess_polygons import split_raster_with_polygons
import geopandas as gpd
from utilities import read_file
from deepforest.visualize import plot_predictions
import cv2
import os
def Cloutier2023():
# Zone 3 is test, Zone 1 and 2 is train. Intentionally vary window size.
... | 2,500 | Python | .py | 42 | 53.261905 | 208 | 0.725185 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,285 | Radogoshi_Sweden.py | weecology_MillionTrees/data_prep/Radogoshi_Sweden.py | import os
import pandas as pd
from deepforest.utilities import read_file
import numpy as np
import xmltodict
def xml_to_annotations(xml_path, image_dir):
"""
Load annotations from xml format (e.g. RectLabel editor) and convert
them into retinanet annotations format.
Args:
xml_path (str): Path ... | 3,172 | Python | .py | 81 | 31.197531 | 119 | 0.602946 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,286 | individual_urban_tree_crown_detection.py | weecology_MillionTrees/data_prep/individual_urban_tree_crown_detection.py | import os
import pandas as pd
from deepforest.utilities import read_file
# Directory containing the txt files
directory = '/orange/ewhite/DeepForest/individual_urban_tree_crown_detection/bbox_txt'
# Initialize an empty list to store data
data = []
# Loop through all txt files in the directory
for filename in os.list... | 1,427 | Python | .py | 32 | 39.65625 | 106 | 0.703838 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,287 | NEON_trees.py | weecology_MillionTrees/data_prep/NEON_trees.py | import glob
import geopandas as gpd
from deepforest.utilities import shapefile_to_annotations
from deepforest.preprocess import split_raster
from shapely.geometry import Point
import os
import pandas as pd
import yaml
import argparse
import math
import numpy as np
import re
from utilities import crop_raster, geo_to_im... | 7,351 | Python | .py | 167 | 36.706587 | 136 | 0.650451 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,288 | TreeFormer.py | weecology_MillionTrees/data_prep/TreeFormer.py | import os
import glob
import shutil
import pandas as pd
from scipy.io import loadmat
def Treeformer():
def convert_mat(path):
f = loadmat(x)
points = f["image_info"][0][0][0][0][0]
df = pd.DataFrame(points,columns=["x","y"])
df["label"] = "Tree"
df["source"] = "Amirkolaee et... | 2,197 | Python | .py | 48 | 39.583333 | 99 | 0.663534 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,289 | NeonTreeEvaluation.py | weecology_MillionTrees/data_prep/NeonTreeEvaluation.py | import glob
import os
import shutil
import pandas as pd
from deepforest.utilities import read_file
BENCHMARK_PATH = "/orange/idtrees-collab/NeonTreeEvaluation/"
tifs = glob.glob(BENCHMARK_PATH + "evaluation/RGB/*.tif")
xmls = [os.path.splitext(os.path.basename(x))[0] for x in tifs]
xmls = [os.path.join(BENCHMARK_PATH... | 1,222 | Python | .py | 25 | 46.08 | 155 | 0.762783 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,290 | evaluate.py | weecology_MillionTrees/data_prep/evaluate.py | # Evaluation wrapper
import warnings
warnings.simplefilter(action='ignore')
import evaluate
from deepforest import main
# Current backbone
m = main.deepforest()
m.config["batch_size"] = 24
m.config["workers"] = 0
m.use_release()
# Box recall
current_backbone = evaluate.box_wrapper(m)
print(current_backbone)
current_b... | 530 | Python | .py | 18 | 28.333333 | 67 | 0.805882 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,291 | Troles_bamberg.py | weecology_MillionTrees/data_prep/Troles_bamberg.py | import pandas as pd
from deepforest.utilities import xml_to_annotations
from deepforest import get_data
import glob
import json
import shapely.geometry
eval_set = "/orange/ewhite/DeepForest/Troles_Bamberg/coco2048/annotations/instances_tree_eval2023.json"
train_set = "/orange/ewhite/DeepForest/Troles_Bamberg/coco2048/... | 3,374 | Python | .py | 71 | 43.126761 | 128 | 0.737115 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,292 | cut_unlabeled.py | weecology_MillionTrees/data_prep/cut_unlabeled.py | from deepforest.preprocess import split_raster
import glob
import rasterio as rio
# Load images from folder
#files = glob.glob("/Users/benweinstein/Downloads/OneDrive_1_2-7-2024/*.tif")
files = ["/Users/benweinstein/Downloads/Plot13Ortho.tif"]
for f in files:
# Open raster, select first three bands and scale to 0 ... | 759 | Python | .py | 20 | 32.2 | 77 | 0.644022 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,293 | bamberg_mini.py | weecology_MillionTrees/data_prep/bamberg_mini.py | import pandas as pd
import os
import shutil
import zipfile
df = pd.read_csv("/orange/ewhite/DeepForest/Troles_Bamberg/coco2048/annotations/annotations.csv")
# Extract tile names from the image filenames
df['tile_name'] = df['image_path'].apply(lambda x: '_'.join(os.path.basename(x).split('_')[:-1]))
# Create a new d... | 1,631 | Python | .py | 31 | 49.16129 | 114 | 0.747487 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,294 | AutoArborist.py | weecology_MillionTrees/data_prep/AutoArborist.py | from torchdata.datapipes.iter import FileLister, FileOpener
from PIL import Image
import io
import numpy as np
from deepforest import main
from matplotlib import pyplot as plt
datapipe1 = FileLister("/Users/benweinstein/Downloads/charlottesville", "*")
datapipe2 = FileOpener(datapipe1, mode="b")
tfrecord_loader_dp = i... | 994 | Python | .py | 27 | 33.62963 | 88 | 0.755208 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,295 | preprocess_polygons.py | weecology_MillionTrees/data_prep/preprocess_polygons.py | # Deepforest Preprocessing model
"""The preprocessing module is used to reshape data into format suitable for
training or prediction.
For example cutting large tiles into smaller images.
"""
import os
import numpy as np
import pandas as pd
import slidingwindow
from PIL import Image
import torch
import warnings
import ... | 11,145 | Python | .py | 227 | 40.237885 | 276 | 0.660186 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,296 | select_tiles_for_labelstudio.py | weecology_MillionTrees/data_prep/select_tiles_for_labelstudio.py | import os
import random
import shutil
from deepforest.preprocess import split_raster
import glob
import tempfile
# Get tmpdir
tmpdir = tempfile.gettempdir()
# Define the input and output directories
output_dir = '/blue/ewhite/b.weinstein/MillionTrees/images_to_annotate'
# Get a list of all image files
#image_files ... | 1,139 | Python | .py | 24 | 45.708333 | 139 | 0.791892 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,297 | test_TreePolygons.py | weecology_MillionTrees/tests/test_TreePolygons.py | from milliontrees.datasets.TreePolygons import TreePolygonsDataset
import pytest
import os
import torchvision.transforms.v2 as transforms
# Check if running on hipergator
if os.path.exists("/orange"):
on_hipergator = True
else:
on_hipergator = False
# Test structure without real annotation data to ensure form... | 2,311 | Python | .py | 58 | 33.741379 | 101 | 0.695516 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,298 | conftest.py | weecology_MillionTrees/tests/conftest.py | import pytest
import os
import tempfile
import shutil
import pandas as pd
import numpy as np
from PIL import Image
"""
The goal of this module is to create a reproducible example of how datasets are structured. Each has an images folder, and multiple train/test splits.
"""
@pytest.fixture(scope="session")
def dataset... | 5,692 | Python | .py | 133 | 37.293233 | 162 | 0.655503 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,299 | test_milliontrees.py | weecology_MillionTrees/tests/test_milliontrees.py | import pytest
def test_milliontrees_load():
import milliontrees # Check if the module is successfully imported
| 117 | Python | .py | 3 | 36.333333 | 71 | 0.80531 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |