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,287,900 | transformer.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/transformer.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""Transformer modules."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import constant_, xavier_uniform_
from .conv import Conv
from .utils import _get_clones, inverse_sigmoid, multi_scale_deformable_attn_pytorch
__all__... | 17,910 | Python | .py | 348 | 42.850575 | 122 | 0.632521 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,901 | attention.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/attention.py | import torch
from torch import nn, Tensor, LongTensor
from typing import Tuple, Optional
__all__ = [
"GAM_Attention",
]
# GAM Attention Start
def channel_shuffle(x, groups=2): ##shuffle channel
# RESHAPE----->transpose------->Flatten
B, C, H, W = x.size()
out = x.view(B, groups, C // groups, H, W)... | 1,776 | Python | .py | 45 | 31.8 | 82 | 0.584642 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,902 | conv.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/conv.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""Convolution modules."""
import math
import numpy as np
import torch
import torch.nn as nn
__all__ = (
"Conv",
"Conv2",
"LightConv",
"DWConv",
"DWConvTranspose2d",
"ConvTranspose",
"Focus",
"GhostConv",
"ChannelAttention",
"SpatialAt... | 12,722 | Python | .py | 262 | 40.461832 | 120 | 0.61369 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,903 | block.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/block.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""Block modules."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from .conv import Conv, DWConv, GhostConv, LightConv, RepConv
from .transformer import TransformerBlock
__all__ = (
"DFL",
"HGBlock",
"HGStem",
"SPP",
"SPPF",
"C1"... | 20,553 | Python | .py | 438 | 39.148402 | 120 | 0.583213 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,904 | utils.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/utils.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""Module utils."""
import copy
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import uniform_
__all__ = "multi_scale_deformable_attn_pytorch", "inverse_sigmoid"
def _get_clones(module, n):
"""Create... | 3,197 | Python | .py | 70 | 40.228571 | 107 | 0.655848 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,905 | __init__.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/__init__.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""
Ultralytics modules.
Example:
Visualize a module with Netron.
```python
from ultralytics.nn.modules import *
import torch
import os
x = torch.ones(1, 128, 40, 40)
m = Conv(128, 128)
f = f'{m._get_name()}.onnx'
torch.onnx.export(m, x, f)... | 2,217 | Python | .py | 126 | 13.063492 | 82 | 0.621764 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,906 | head.py | arojsubedi_Improved-YOLOv8s/ultralytics/nn/modules/head.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""Model head modules."""
import math
import torch
import torch.nn as nn
from torch.nn.init import constant_, xavier_uniform_
from ultralytics.utils.tal import TORCH_1_10, dist2bbox, dist2rbox, make_anchors
from .block import DFL, Proto, ContrastiveHead, BNContrastiveHead
fr... | 21,728 | Python | .py | 405 | 44.162963 | 120 | 0.598324 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,907 | auth.py | arojsubedi_Improved-YOLOv8s/ultralytics/hub/auth.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import requests
from ultralytics.hub.utils import HUB_API_ROOT, HUB_WEB_ROOT, PREFIX, request_with_credentials
from ultralytics.utils import LOGGER, SETTINGS, emojis, is_colab
API_KEY_URL = f"{HUB_WEB_ROOT}/settings?tab=api+keys"
class Auth:
"""
Manages authenticat... | 5,370 | Python | .py | 114 | 36.578947 | 116 | 0.615017 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,908 | utils.py | arojsubedi_Improved-YOLOv8s/ultralytics/hub/utils.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import os
import platform
import random
import sys
import threading
import time
from pathlib import Path
import requests
from ultralytics.utils import (
ENVIRONMENT,
LOGGER,
ONLINE,
RANK,
SETTINGS,
TESTS_RUNNING,
TQDM,
TryExcept,
__version... | 9,736 | Python | .py | 211 | 36.725118 | 120 | 0.60744 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,909 | __init__.py | arojsubedi_Improved-YOLOv8s/ultralytics/hub/__init__.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import requests
from ultralytics.data.utils import HUBDatasetStats
from ultralytics.hub.auth import Auth
from ultralytics.hub.utils import HUB_API_ROOT, HUB_WEB_ROOT, PREFIX
from ultralytics.utils import LOGGER, SETTINGS, checks
def login(api_key: str = None, save=True) -> ... | 5,035 | Python | .py | 97 | 45.597938 | 120 | 0.677603 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,910 | session.py | arojsubedi_Improved-YOLOv8s/ultralytics/hub/session.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import threading
import time
from http import HTTPStatus
from pathlib import Path
import requests
from ultralytics.hub.utils import HUB_WEB_ROOT, HELP_MSG, PREFIX, TQDM
from ultralytics.utils import LOGGER, SETTINGS, __version__, checks, emojis, is_colab
from ultralytics.uti... | 14,226 | Python | .py | 288 | 37.451389 | 118 | 0.593818 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,911 | distance_calculation.py | arojsubedi_Improved-YOLOv8s/ultralytics/solutions/distance_calculation.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import math
import cv2
from ultralytics.utils.checks import check_imshow
from ultralytics.utils.plotting import Annotator, colors
class DistanceCalculation:
"""A class to calculate distance between two objects in real-time video stream based on their tracks."""
de... | 6,334 | Python | .py | 145 | 33.386207 | 111 | 0.599707 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,912 | speed_estimation.py | arojsubedi_Improved-YOLOv8s/ultralytics/solutions/speed_estimation.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from collections import defaultdict
from time import time
import cv2
import numpy as np
from ultralytics.utils.checks import check_imshow
from ultralytics.utils.plotting import Annotator, colors
class SpeedEstimator:
"""A class to estimation speed of objects in real-ti... | 6,714 | Python | .py | 156 | 33.333333 | 118 | 0.599141 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,913 | object_counter.py | arojsubedi_Improved-YOLOv8s/ultralytics/solutions/object_counter.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from collections import defaultdict
import cv2
from ultralytics.utils.checks import check_imshow, check_requirements
from ultralytics.utils.plotting import Annotator, colors
check_requirements("shapely>=2.0.0")
from shapely.geometry import LineString, Point, Polygon
clas... | 10,474 | Python | .py | 227 | 34.317181 | 117 | 0.585146 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,914 | ai_gym.py | arojsubedi_Improved-YOLOv8s/ultralytics/solutions/ai_gym.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import cv2
from ultralytics.utils.checks import check_imshow
from ultralytics.utils.plotting import Annotator
class AIGym:
"""A class to manage the gym steps of people in a real-time video stream based on their poses."""
def __init__(self):
"""Initializes t... | 6,029 | Python | .py | 134 | 31.873134 | 114 | 0.540794 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,915 | heatmap.py | arojsubedi_Improved-YOLOv8s/ultralytics/solutions/heatmap.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from collections import defaultdict
import cv2
import numpy as np
from ultralytics.utils.checks import check_imshow, check_requirements
from ultralytics.utils.plotting import Annotator
check_requirements("shapely>=2.0.0")
from shapely.geometry import LineString, Point, Pol... | 10,928 | Python | .py | 231 | 35.060606 | 119 | 0.565042 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,916 | bot_sort.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/bot_sort.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from collections import deque
import numpy as np
from .basetrack import TrackState
from .byte_tracker import BYTETracker, STrack
from .utils import matching
from .utils.gmc import GMC
from .utils.kalman_filter import KalmanFilterXYWH
class BOTrack(STrack):
"""
An e... | 8,601 | Python | .py | 165 | 43.545455 | 120 | 0.662302 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,917 | track.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/track.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from functools import partial
from pathlib import Path
import torch
from ultralytics.utils import IterableSimpleNamespace, yaml_load
from ultralytics.utils.checks import check_yaml
from .bot_sort import BOTSORT
from .byte_tracker import BYTETracker
# A mapping of tracker ty... | 3,091 | Python | .py | 63 | 42.857143 | 115 | 0.698471 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,918 | byte_tracker.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/byte_tracker.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import numpy as np
from .basetrack import BaseTrack, TrackState
from .utils import matching
from .utils.kalman_filter import KalmanFilterXYAH
from ..utils.ops import xywh2ltwh
from ..utils import LOGGER
class STrack(BaseTrack):
"""
Single object tracking representat... | 18,871 | Python | .py | 387 | 39.242894 | 120 | 0.633907 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,919 | __init__.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/__init__.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
from .bot_sort import BOTSORT
from .byte_tracker import BYTETracker
from .track import register_tracker
__all__ = "register_tracker", "BOTSORT", "BYTETracker" # allow simpler import
| 227 | Python | .py | 5 | 44 | 78 | 0.777273 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,920 | basetrack.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/basetrack.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
"""This module defines the base classes and structures for object tracking in YOLO."""
from collections import OrderedDict
import numpy as np
class TrackState:
"""
Enumeration class representing the possible states of an object being tracked.
Attributes:
... | 3,675 | Python | .py | 85 | 35.788235 | 93 | 0.667787 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,921 | matching.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/utils/matching.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import numpy as np
import scipy
from scipy.spatial.distance import cdist
from ultralytics.utils.metrics import bbox_ioa, batch_probiou
try:
import lap # for linear_assignment
assert lap.__version__ # verify package is not directory
except (ImportError, AssertionEr... | 5,404 | Python | .py | 110 | 41.654545 | 114 | 0.657615 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,922 | kalman_filter.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/utils/kalman_filter.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import numpy as np
import scipy.linalg
class KalmanFilterXYAH:
"""
For bytetrack. A simple Kalman filter for tracking bounding boxes in image space.
The 8-dimensional state space (x, y, a, h, vx, vy, va, vh) contains the bounding box center position (x, y), aspe... | 15,168 | Python | .py | 298 | 40.483221 | 121 | 0.615073 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,923 | gmc.py | arojsubedi_Improved-YOLOv8s/ultralytics/trackers/utils/gmc.py | # Ultralytics YOLO 🚀, AGPL-3.0 license
import copy
import cv2
import numpy as np
from ultralytics.utils import LOGGER
class GMC:
"""
Generalized Motion Compensation (GMC) class for tracking and object detection in video frames.
This class provides methods for tracking and detecting objects based on... | 13,658 | Python | .py | 288 | 36.152778 | 119 | 0.589846 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,924 | Dockerfile-python | arojsubedi_Improved-YOLOv8s/docker/Dockerfile-python | # Ultralytics YOLO 🚀, AGPL-3.0 license
# Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments
# Use the official Python 3.10 slim-bookworm as base image
FROM python:3.10-slim-bookworm
... | 2,547 | Python | .pyt | 40 | 62.025 | 143 | 0.744485 | arojsubedi/Improved-YOLOv8s | 8 | 5 | 0 | AGPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,925 | track.py | SBY7219_Yolov5_DeepSort_Replicate/track.py | # limit the number of cpus used by high performance libraries
import os
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
import sys
sys.path.insert(0, './yolov5')
from yol... | 12,612 | Python | .py | 230 | 42.904348 | 140 | 0.565363 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,926 | json_delete.py | SBY7219_Yolov5_DeepSort_Replicate/json_delete.py | import json
def delete_track_id(json_file, track_id):
# 读取json文件
with open(json_file, 'r') as f:
data = json.load(f)
# 遍历json文件的每一个元素
for frame in list(data['frames'].keys()):
for obj in list(data['frames'][frame]['cv_annotation'].keys()):
# 检查"track_id"是否等于输入的整数
... | 824 | Python | .py | 17 | 35.176471 | 125 | 0.621083 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,927 | txt2json.py | SBY7219_Yolov5_DeepSort_Replicate/txt2json.py | import json
def parse_line(line):
"""将一行文本转换为数据字典"""
parts = line.strip().split()
frame_id, track_id, x, y, width, height = map(int, parts[:6])
return {
'frame_id': frame_id,
'track_id': track_id,
'bbox': [x, y, x + width, y + height] # 转换为对角坐标格式
}
def convert_... | 2,860 | Python | .py | 59 | 33.694915 | 122 | 0.598457 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,928 | json_logger.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/json_logger.py | """
References:
https://medium.com/analytics-vidhya/creating-a-custom-logging-mechanism-for-real-time-object-detection-using-tdd-4ca2cfcd0a2f
"""
import json
from os import makedirs
from os.path import exists, join
from datetime import datetime
class JsonMeta(object):
HOURS = 3
MINUTES = 59
SECONDS = ... | 11,762 | Python | .py | 314 | 27.347134 | 129 | 0.563846 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,929 | io.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/io.py | import os
from typing import Dict
import numpy as np
# from utils.log import get_logger
def write_results(filename, results, data_type):
if data_type == 'mot':
save_format = '{frame},{id},{x1},{y1},{w},{h},-1,-1,-1,-1\n'
elif data_type == 'kitti':
save_format = '{frame} {id} pedestrian 0 0 -1... | 4,357 | Python | .py | 111 | 30.423423 | 121 | 0.493491 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,930 | evaluation.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/evaluation.py | import os
import numpy as np
import copy
import motmetrics as mm
mm.lap.default_solver = 'lap'
from utils.io import read_results, unzip_objs
class Evaluator(object):
def __init__(self, data_root, seq_name, data_type):
self.data_root = data_root
self.seq_name = seq_name
self.data_type = da... | 3,532 | Python | .py | 80 | 35.1125 | 112 | 0.619131 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,931 | draw.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/draw.py | import numpy as np
import cv2
palette = (2 ** 11 - 1, 2 ** 15 - 1, 2 ** 20 - 1)
def compute_color_for_labels(label):
"""
Simple function that adds fixed color depending on the class
"""
color = [int((p * (label ** 2 - label + 1)) % 255) for p in palette]
return tuple(color)
def draw_boxes(img, ... | 1,125 | Python | .py | 28 | 33.607143 | 95 | 0.577594 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,932 | asserts.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/asserts.py | from os import environ
def assert_in(file, files_to_check):
if file not in files_to_check:
raise AssertionError("{} does not exist in the list".format(str(file)))
return True
def assert_in_env(check_list: list):
for item in check_list:
assert_in(item, environ.keys())
return True
| 316 | Python | .py | 9 | 30.111111 | 79 | 0.693069 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,933 | log.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/log.py | import logging
def get_logger(name='root'):
formatter = logging.Formatter(
# fmt='%(asctime)s [%(levelname)s]: %(filename)s(%(funcName)s:%(lineno)s) >> %(message)s')
fmt='%(asctime)s [%(levelname)s]: %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
handler = logging.StreamHandler()
handler.setF... | 463 | Python | .py | 11 | 36.545455 | 98 | 0.661435 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,934 | tools.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/tools.py | from functools import wraps
from time import time
def is_video(ext: str):
"""
Returns true if ext exists in
allowed_exts for video files.
Args:
ext:
Returns:
"""
allowed_exts = ('.mp4', '.webm', '.ogg', '.avi', '.wmv', '.mkv', '.3gp')
return any((ext.endswith(x) for x in al... | 734 | Python | .py | 28 | 19.821429 | 90 | 0.541007 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,935 | parser.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/utils/parser.py | import os
import yaml
from easydict import EasyDict as edict
class YamlParser(edict):
"""
This is yaml parser based on EasyDict.
"""
def __init__(self, cfg_dict=None, config_file=None):
if cfg_dict is None:
cfg_dict = {}
if config_file is not None:
assert(os.p... | 1,076 | Python | .py | 29 | 29.62069 | 68 | 0.619324 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,936 | __init__.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/__init__.py | from .deep_sort import DeepSort
__all__ = ['DeepSort', 'build_tracker']
def build_tracker(cfg, use_cuda):
return DeepSort(cfg.DEEPSORT.REID_CKPT,
max_dist=cfg.DEEPSORT.MAX_DIST, min_confidence=cfg.DEEPSORT.MIN_CONFIDENCE,
nms_max_overlap=cfg.DEEPSORT.NMS_MAX_OVERLAP, max_iou_di... | 500 | Python | .py | 7 | 60 | 126 | 0.694737 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,937 | deep_sort.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep_sort.py | import numpy as np
import torch
from .deep.feature_extractor import Extractor
from .sort.nn_matching import NearestNeighborDistanceMetric
from .sort.detection import Detection
from .sort.tracker import Tracker
__all__ = ['DeepSort']
class DeepSort(object):
def __init__(self, model_path, max_dist=0.2, min_confi... | 3,990 | Python | .py | 99 | 31.161616 | 143 | 0.573974 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,938 | test.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/test.py | import torch
import torch.backends.cudnn as cudnn
import torchvision
import argparse
import os
from model import Net
parser = argparse.ArgumentParser(description="Train on market1501")
parser.add_argument("--data-dir", default='data', type=str)
parser.add_argument("--no-cuda", action="store_true")
parser.add_argumen... | 2,464 | Python | .py | 69 | 32.57971 | 77 | 0.721477 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,939 | train.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/train.py | import argparse
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.backends.cudnn as cudnn
import torchvision
from model import Net
parser = argparse.ArgumentParser(description="Train on market1501")
parser.add_argument("--data-dir", default='data', type=str)
parser.ad... | 6,315 | Python | .py | 174 | 30.477011 | 96 | 0.636274 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,940 | original_model.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/original_model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, c_in, c_out, is_downsample=False):
super(BasicBlock, self).__init__()
self.is_downsample = is_downsample
if is_downsample:
self.conv1 = nn.Conv2d(
... | 3,339 | Python | .py | 100 | 23.57 | 78 | 0.515799 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,941 | feature_extractor.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/feature_extractor.py | import torch
import torchvision.transforms as transforms
import numpy as np
import cv2
import logging
from .model import Net
class Extractor(object):
def __init__(self, model_path, use_cuda=True):
self.net = Net(reid=True)
self.device = "cuda" if torch.cuda.is_available() and use_cuda else "cpu"
... | 1,770 | Python | .py | 46 | 30.26087 | 84 | 0.594406 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,942 | model.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, c_in, c_out, is_downsample=False):
super(BasicBlock, self).__init__()
self.is_downsample = is_downsample
if is_downsample:
self.conv1 = nn.Conv2d(
... | 3,316 | Python | .py | 99 | 23.757576 | 78 | 0.516682 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,943 | evaluate.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/deep/evaluate.py | import torch
features = torch.load("features.pth")
qf = features["qf"]
ql = features["ql"]
gf = features["gf"]
gl = features["gl"]
scores = qf.mm(gf.t())
res = scores.topk(5, dim=1)[1][:, 0]
top1correct = gl[res].eq(ql).sum().item()
print("Acc top1:{:.3f}".format(top1correct / ql.size(0)))
| 294 | Python | .py | 10 | 28.1 | 57 | 0.658363 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,944 | iou_matching.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/iou_matching.py | # vim: expandtab:ts=4:sw=4
from __future__ import absolute_import
import numpy as np
from . import linear_assignment
def iou(bbox, candidates):
"""Computer intersection over union.
Parameters
----------
bbox : ndarray
A bounding box in format `(top left x, top left y, width, height)`.
can... | 2,843 | Python | .py | 68 | 34.911765 | 80 | 0.635277 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,945 | track.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/track.py | # vim: expandtab:ts=4:sw=4
class TrackState:
"""
Enumeration type for the single target track state. Newly created tracks are
classified as `tentative` until enough evidence has been collected. Then,
the track state is changed to `confirmed`. Tracks that are no longer alive
are classified as `dele... | 5,410 | Python | .py | 151 | 27.582781 | 89 | 0.611175 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,946 | preprocessing.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/preprocessing.py | # vim: expandtab:ts=4:sw=4
import numpy as np
import cv2
def non_max_suppression(boxes, max_bbox_overlap, scores=None):
"""Suppress overlapping detections.
Original code from [1]_ has been adapted to include confidence score.
.. [1] http://www.pyimagesearch.com/2015/02/16/
faster-non-maximum-... | 1,914 | Python | .py | 55 | 27.672727 | 80 | 0.571972 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,947 | nn_matching.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/nn_matching.py | # vim: expandtab:ts=4:sw=4
import numpy as np
def _pdist(a, b):
"""Compute pair-wise squared distance between points in `a` and `b`.
Parameters
----------
a : array_like
An NxM matrix of N samples of dimensionality M.
b : array_like
An LxM matrix of L samples of dimensionality M.
... | 5,447 | Python | .py | 142 | 30.964789 | 78 | 0.616852 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,948 | kalman_filter.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/kalman_filter.py | # vim: expandtab:ts=4:sw=4
import numpy as np
import scipy.linalg
"""
Table for the 0.95 quantile of the chi-square distribution with N degrees of
freedom (contains values for N=1, ..., 9). Taken from MATLAB/Octave's chi2inv
function and used as Mahalanobis gating threshold.
"""
chi2inv95 = {
1: 3.8415,
2: 5.... | 7,959 | Python | .py | 189 | 32.444444 | 89 | 0.598422 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,949 | tracker.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/tracker.py | # vim: expandtab:ts=4:sw=4
from __future__ import absolute_import
import numpy as np
from . import kalman_filter
from . import linear_assignment
from . import iou_matching
from .track import Track
class Tracker:
"""
This is the multi-target tracker.
Parameters
----------
metric : nn_matching.Neare... | 7,085 | Python | .py | 152 | 37.388158 | 98 | 0.643239 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,950 | linear_assignment.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/linear_assignment.py | # vim: expandtab:ts=4:sw=4
from __future__ import absolute_import
import numpy as np
from scipy.optimize import linear_sum_assignment
from . import kalman_filter
INFTY_COST = 1e+5
def min_cost_matching(
distance_metric, max_distance, tracks, detections, track_indices=None,
detection_indices=None):
... | 7,801 | Python | .py | 167 | 39.287425 | 93 | 0.678914 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,951 | detection.py | SBY7219_Yolov5_DeepSort_Replicate/deep_sort_pytorch/deep_sort/sort/detection.py | # vim: expandtab:ts=4:sw=4
import numpy as np
class Detection(object):
"""
This class represents a bounding box detection in a single image.
Parameters
----------
tlwh : array_like
Bounding box in format `(x, y, w, h)`.
confidence : float
Detector confidence score.
feature... | 1,435 | Python | .py | 41 | 27.95122 | 79 | 0.602453 | SBY7219/Yolov5_DeepSort_Replicate | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,952 | hubconf.py | JSchlensok_VespaG/hubconf.py | from vespag.utils import DEFAULT_MODEL_PARAMETERS, load_model
from vespag.utils.type_hinting import EmbeddingType
dependencies = ["torch"]
def v2(embedding_type: EmbeddingType):
params = DEFAULT_MODEL_PARAMETERS
params["embedding_type"] = embedding_type
return load_model(**params)
| 296 | Python | .py | 7 | 39.285714 | 61 | 0.787456 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,953 | __main__.py | JSchlensok_VespaG/vespag/__main__.py | from pathlib import Path
from typing import Annotated, Optional
import typer
from .data.embeddings import generate_embeddings
from .eval import eval
from .predict import generate_predictions
from .training.train import train as run_training
from .utils.type_hinting import EmbeddingType
app = typer.Typer()
app.add_t... | 5,114 | Python | .py | 165 | 23.4 | 125 | 0.592263 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,954 | embeddings.py | JSchlensok_VespaG/vespag/data/embeddings.py | import re
from pathlib import Path
from typing import Annotated, Union
import h5py
import rich.progress as progress
import torch
import typer
from Bio import SeqIO
from transformers import AutoModel, AutoTokenizer, T5EncoderModel, T5Tokenizer
from vespag.utils import get_device
from vespag.utils.type_hinting import E... | 5,035 | Python | .py | 132 | 27.69697 | 88 | 0.575143 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,955 | gemme.py | JSchlensok_VespaG/vespag/data/gemme.py | from pathlib import Path
from typing import Annotated
import h5py
import pandas as pd
import typer
from rich import progress
app = typer.Typer()
def store_gemme_as_h5(gemme_folder: Path, output_file: Path) -> None:
with h5py.File(output_file, "w") as hdf:
for file in progress.track(
list(gem... | 1,115 | Python | .py | 30 | 31.966667 | 86 | 0.672558 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,956 | eval.py | JSchlensok_VespaG/vespag/eval/eval.py | import warnings
from pathlib import Path
from typing import Annotated
import polars as pl
import typer
import yaml
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from tqdm.rich import tqdm
from vespag.predict import generate_predictions
from vespag.utils import download, setup_logge... | 5,935 | Python | .py | 166 | 27.86747 | 124 | 0.610184 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,957 | cnn.py | JSchlensok_VespaG/vespag/models/cnn.py | import torch
from jaxtyping import Float
from .utils import construct_fnn
"""
batch_size x L x 1536
- transform ->
batch_size x 1536 x L x 1
"""
class MinimalCNN(torch.nn.Module):
"""
1D convolution followed by two dense layers, akin to biotrainer's offering
Attributes:
input_dim: Size of the in... | 4,808 | Python | .py | 119 | 31.327731 | 120 | 0.619119 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,958 | utils.py | JSchlensok_VespaG/vespag/models/utils.py | from copy import deepcopy
import torch
def construct_fnn(
hidden_layer_sizes: list[int],
input_dim: int = 1024,
output_dim: int = 20,
activation_function: torch.nn.Module = torch.nn.LeakyReLU,
output_activation_function: torch.nn.Module = None,
dropout_rate: float = None,
):
layer_sizes =... | 1,238 | Python | .py | 33 | 31.575758 | 74 | 0.675879 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,959 | __init__.py | JSchlensok_VespaG/vespag/models/__init__.py | from .cnn import CombinedCNN, MinimalCNN
from .fnn import FNN
__all__ = ["FNN", "MinimalCNN", "CombinedCNN"]
| 110 | Python | .py | 3 | 35.333333 | 46 | 0.726415 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,960 | fnn.py | JSchlensok_VespaG/vespag/models/fnn.py | import torch
from jaxtyping import Float
from .utils import construct_fnn
class FNN(torch.nn.Module):
"""
Fully-connected neural network with arbitrary hidden layers and activation functions
Attributes:
input_dim: Size of the input vectors (e.g. 1024 for ProtT5 embeddings, 2560 for ESM2 embeddin... | 1,914 | Python | .py | 43 | 35.813953 | 119 | 0.64485 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,961 | predict.py | JSchlensok_VespaG/vespag/predict/predict.py | import csv
import os
import warnings
from pathlib import Path
import h5py
import numpy as np
import rich.progress as progress
import torch
from Bio import SeqIO
from tqdm.rich import tqdm
from vespag.data.embeddings import Embedder
from vespag.utils import (
AMINO_ACIDS,
DEFAULT_MODEL_PARAMETERS,
SAV,
... | 6,250 | Python | .py | 159 | 28.383648 | 88 | 0.575613 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,962 | proteingym.py | JSchlensok_VespaG/vespag/utils/proteingym.py | INFO_COLUMNS = ["DMS_id", "UniProt_ID", "taxon", "coarse_selection_type"]
PROTEINGYM_CHANGED_FILENAMES = {
"A0A140D2T1_ZIKV_Sourisseau_growth_2019": "A0A140D2T1_ZIKV_Sourisseau_2019.csv",
"A4_HUMAN_Seuma_2021": "A4_HUMAN_Seuma_2022.csv",
"A4D664_9INFA_Soh_CCL141_2019": "A4D664_9INFA_Soh_2019.csv",
"CAP... | 1,872 | Python | .py | 27 | 64.740741 | 95 | 0.730477 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,963 | eval.py | JSchlensok_VespaG/vespag/utils/eval.py | from typing import Sequence
import pingouin as pg
def bootstrap_mean(data: Sequence[float]) -> dict[str, float]:
ci, dist = pg.compute_bootci(
data,
func="mean",
method="norm",
n_boot=1000,
decimals=3,
seed=42,
return_dist=True,
)
mean = data.mean()... | 454 | Python | .py | 15 | 23.933333 | 87 | 0.604598 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,964 | type_hinting.py | JSchlensok_VespaG/vespag/utils/type_hinting.py | from enum import Enum
class PrecisionType(str, Enum):
half = "half"
float = "float"
class Architecture(str, Enum):
fnn = "fnn"
cnn = "cnn"
combined = "combined"
mean = "mean"
class EmbeddingType(str, Enum):
esm2 = "esm2"
prott5 = "prott5"
| 277 | Python | .py | 12 | 18.916667 | 31 | 0.640927 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,965 | utils.py | JSchlensok_VespaG/vespag/utils/utils.py | from __future__ import annotations
import logging
import math
import zipfile
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import requests
import rich.progress as progress
import torch
import torch.multiprocessing as mp
from rich.logging import RichHandler
from vespag.mod... | 5,254 | Python | .py | 136 | 32.639706 | 120 | 0.677553 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,966 | __init__.py | JSchlensok_VespaG/vespag/utils/__init__.py | from .mutations import *
from .utils import *
__all__ = [
"AMINO_ACIDS",
"compute_mutation_score",
"DEFAULT_MODEL_PARAMETERS",
"download",
"GEMME_ALPHABET",
"get_device" "get_embedding_dim",
"get_precision",
"load_model",
"mask_non_mutations",
"Mutation",
"read_gemme_table",... | 433 | Python | .py | 21 | 16.333333 | 37 | 0.608273 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,967 | mutations.py | JSchlensok_VespaG/vespag/utils/mutations.py | from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import Union
import polars as pl
import rich
import torch
from jaxtyping import Float
from .utils import GEMME_ALPHABET, normalize_score, transform_score
@dataclass
class SA... | 3,293 | Python | .py | 99 | 26.656566 | 109 | 0.637828 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,968 | style.py | JSchlensok_VespaG/vespag/utils/plotting/style.py | # Main colors
PINK = "#DC267F"
BLUE = "#785EF0"
YELLOW = "#FFB000"
# Grey shades
CHARCOAL = "#232023"
IRON = "#322D31"
GRAPHITE = "#594D5B"
GRAY = "#808080"
COIN = "#9897A9"
# Auxiliary colors
MALIBU = "#648FFF"
ORANGE = "#FE6100"
METHOD_COLORS = {
"VespaG": PINK,
"GEMME": BLUE,
"VESPA": YELLOW,
"Tra... | 983 | Python | .py | 45 | 18.911111 | 39 | 0.613319 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,969 | utils.py | JSchlensok_VespaG/vespag/utils/plotting/utils.py | from typing import Union
import matplotlib as mpl
def label_bars(
ax: mpl.axes.Axes, digits: int = 3, fontsize: Union[str, int] = "small"
) -> None:
for c in ax.containers:
ax.bar_label(
c,
fmt=f"%.{digits}f",
label_type="center",
fontsize=fontsize,
... | 615 | Python | .py | 19 | 24.736842 | 75 | 0.581356 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,970 | seaborn_plotting.py | JSchlensok_VespaG/vespag/utils/plotting/seaborn_plotting.py | import functools as ft
from dataclasses import dataclass
from typing import Union
import polars as pl
import seaborn as sns
# Copyright (c) 2023 Christopher Prohm
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... | 3,120 | Python | .py | 68 | 40.794118 | 80 | 0.719921 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,971 | __init__.py | JSchlensok_VespaG/vespag/utils/plotting/__init__.py | from .seaborn_plotting import SeabornPlotting
from .style import (
BARLABEL_FONTSIZE,
BARPLOT_KEYWORDS,
HEIGHT,
METHOD_COLORS,
MILLIMETER,
MULTILINE_LABELS,
PANEL_LABEL_FONTSIZE,
WIDTH,
XTICK_FONTSIZE,
)
from .utils import label_bars
__all__ = [
"BARLABEL_FONTSIZE",
"BARPLOT... | 515 | Python | .py | 26 | 15.692308 | 45 | 0.668033 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,972 | trainer.py | JSchlensok_VespaG/vespag/training/trainer.py | import logging
import shutil
from pathlib import Path
import rich.progress as progress
import torch
import torch.multiprocessing as mp
import wandb
from vespag.utils import save_async
class Trainer:
def __init__(
self,
run: str,
model: torch.nn.Module,
device: torch.device,
... | 9,584 | Python | .py | 242 | 27.136364 | 104 | 0.544145 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,973 | train.py | JSchlensok_VespaG/vespag/training/train.py | import gc
import logging
import os
from pathlib import Path
import rich.progress as progress
import torch
import torch.multiprocessing as mp
import torch.optim.lr_scheduler
import wandb
from dvc.api import params_show
from vespag.utils import get_device, get_precision, load_model_from_config, setup_logger
from .data... | 7,784 | Python | .py | 199 | 29.743719 | 161 | 0.605183 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,974 | dataset.py | JSchlensok_VespaG/vespag/training/dataset.py | from pathlib import Path
import h5py
import numpy as np
import polars as pl
import rich.progress as progress
import torch
from jaxtyping import Float
from vespag.utils.type_hinting import PrecisionType
class PerResidueDataset(torch.utils.data.Dataset):
def __init__(
self,
embedding_file: Path,
... | 2,949 | Python | .py | 82 | 25.04878 | 87 | 0.564731 | JSchlensok/VespaG | 8 | 3 | 5 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,975 | build-macos.py | cwhelchel_hunterlog/build-macos.py | import os
import py2app
import shutil
from distutils.core import setup
def tree(src):
return [(root, map(lambda f: os.path.join(root, f), files))
for (root, dirs, files) in os.walk(os.path.normpath(src))]
if os.path.exists('build'):
shutil.rmtree('build')
if os.path.exists('dist/index.app'):
sh... | 829 | Python | .py | 30 | 23.833333 | 66 | 0.662453 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,976 | bands.py | cwhelchel_hunterlog/src/bands.py | '''
This file contains data about the Ham radio bands.
Import Bands for the main enum values, import bandNames for a string of names
import bandLimits for the band edges (not currently configurable). Import
get_band(freq) for a method to take a freq and return a BAND enum.
'''
from enum import Enum
import logging as... | 2,346 | Python | .py | 75 | 25.986667 | 77 | 0.620735 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,977 | api.py | cwhelchel_hunterlog/src/api.py | import json
import time
import webview
import logging as L
import datetime
import threading
from datetime import timedelta
from db.db import DataBase
from db.models.activators import Activator, ActivatorSchema
from db.models.parks import ParkSchema
from db.models.qsos import QsoSchema
from db.models.spot_comments impo... | 18,592 | Python | .py | 454 | 31.101322 | 79 | 0.588369 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,978 | index.py | cwhelchel_hunterlog/src/index.py | import os
import threading
import webview
import logging
import platform
import argparse
from api import JsApi
# put filename='index.log' for deployment
logging.basicConfig(filename='index.log',
encoding='utf-8',
format='%(asctime)s = %(levelname)-7.7s [%(name)s]: %(message)s',... | 4,493 | Python | .py | 122 | 29.852459 | 98 | 0.623326 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,979 | upgrades.py | cwhelchel_hunterlog/src/upgrades.py | from alembic_src import versions
import logging as L
# not having this in the file seemed to mess up logging to index.log
# in index.py. alembic issue?
logging = L.getLogger("upgrades")
def do_upgrade():
logging.info('upgrading to head')
versions.upgrade()
def get_version(verbose: bool = False):
loggin... | 394 | Python | .py | 11 | 32.909091 | 68 | 0.759259 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,980 | cat_interface.py | cwhelchel_hunterlog/src/cat/cat_interface.py | """
K6GTE, CAT interface abstraction
Email: [email protected]
GPL V3
"""
import logging
import socket
import xmlrpc.client
if __name__ == "__main__":
print("I'm not the program you are looking for.")
logger = logging.getLogger("cat")
class CAT:
"""CAT control rigctld or flrig"""
def __init__(se... | 13,883 | Python | .py | 374 | 25.890374 | 87 | 0.542749 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,981 | omnirig_interface.py | cwhelchel_hunterlog/src/cat/omnirig_interface.py | """
KK7JXG simple omnirig CAT control
email:[email protected]
GPL V3
"""
# pyright: ignore[reportOptionalMemberAccess]
import logging
import win32com.client as win32 # pylint: disable=import-error
class OmniRigClient:
"""OmniRig CAT control"""
def __init__(self, rig: int) -> None:
"""
... | 3,317 | Python | .py | 93 | 25.311828 | 96 | 0.564328 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,982 | db.py | cwhelchel_hunterlog/src/db/db.py | import re
from typing import List
import logging as L
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from bands import Bands
from db.models.qsos import Qso
from db.models.activators import Activator, ActivatorSchema
from db.model... | 12,397 | Python | .py | 289 | 33.49481 | 121 | 0.612769 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,983 | utc.py | cwhelchel_hunterlog/src/db/utc.py | from sqlalchemy.sql import expression
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.types import DateTime
class utcnow(expression.FunctionElement):
type = DateTime()
inherit_cache = True
@compiles(utcnow, 'postgresql')
def pg_utcnow(element, compiler, **kw):
return "TIMEZONE('utc', CURREN... | 530 | Python | .py | 15 | 32.466667 | 47 | 0.763314 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,984 | loc_query.py | cwhelchel_hunterlog/src/db/loc_query.py | import sqlalchemy as sa
from sqlalchemy.orm import scoped_session
from db.models.location import Location, LocationSchema
from db.models.parks import Park
from db.models.qsos import Qso
import logging as L
logging = L.getLogger('location_query')
class LocationQuery:
'''Internal DB queries stored here.'''
... | 2,481 | Python | .py | 58 | 32.931034 | 79 | 0.610557 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,985 | qso_query.py | cwhelchel_hunterlog/src/db/qso_query.py | from datetime import datetime
import logging
from typing import List
import sqlalchemy as sa
from sqlalchemy.orm import scoped_session
from db.models.qsos import Qso
from bands import Bands, get_band, bandLimits, bandNames
class QsoQuery:
'''Store Queries for the QSO table here.'''
def __init__(self, sessio... | 4,720 | Python | .py | 127 | 26.937008 | 78 | 0.543883 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,986 | spot_query.py | cwhelchel_hunterlog/src/db/spot_query.py | import datetime
from typing import Callable
import sqlalchemy as sa
from sqlalchemy.orm import scoped_session
import re
import logging as L
from db.models.spot_comments import SpotComment
from db.models.spots import Spot
logging = L.getLogger("spot_query")
class SpotQuery:
def __init__(self,
se... | 3,687 | Python | .py | 100 | 27.18 | 79 | 0.567749 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,987 | __init__.py | cwhelchel_hunterlog/src/db/__init__.py | from .models.qsos import *
from .models.spot_comments import *
from .models.spots import *
from .models.user_config import *
from db.db import DataBase
| 153 | Python | .py | 5 | 29.4 | 35 | 0.795918 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,988 | park_query.py | cwhelchel_hunterlog/src/db/park_query.py | import logging
import sqlalchemy as sa
from sqlalchemy.orm import scoped_session
from db.models.parks import Park, ParkSchema
class ParkQuery:
def __init__(self, session: scoped_session):
self.session = session
def get_park(self, park: str) -> Park:
return self.session.query(Park) \
... | 5,118 | Python | .py | 120 | 31.925 | 79 | 0.587503 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,989 | user_config.py | cwhelchel_hunterlog/src/db/models/user_config.py | from enum import Enum
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class UserConfig(Base):
__tablename__ = "config"
id = sa.Column(sa.Integer, p... | 1,455 | Python | .py | 38 | 33.157895 | 63 | 0.683239 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,990 | qsos.py | cwhelchel_hunterlog/src/db/models/qsos.py | import datetime
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from db.models.spots import Spot
from db.utc import utcnow
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class Qso(Base):
__tablenam... | 4,848 | Python | .py | 114 | 34.570175 | 122 | 0.598345 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,991 | location.py | cwhelchel_hunterlog/src/db/models/location.py | import sqlalchemy as sa
import marshmallow as ma
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class Location(Base):
__tablename__ = "locations"
# maps to JSON type for ... | 1,060 | Python | .py | 27 | 34.62963 | 75 | 0.72434 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,992 | parks.py | cwhelchel_hunterlog/src/db/models/parks.py | import sqlalchemy as sa
import marshmallow as ma
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from db.utc import utcnow
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class Park(Base):
__tablename__ = "parks"
id = ... | 2,039 | Python | .py | 51 | 34.333333 | 75 | 0.694992 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,993 | activators.py | cwhelchel_hunterlog/src/db/models/activators.py | import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class Activator(Base):
__tablename__ = "activators"
activator_id = sa.Column(sa.Integer, primary_ke... | 1,021 | Python | .py | 26 | 33.961538 | 72 | 0.70618 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,994 | spot_comments.py | cwhelchel_hunterlog/src/db/models/spot_comments.py | import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class SpotComment(Base):
__tablename__ = "comments"
spotId = sa.Column(sa.Integer, primary_key=Tru... | 937 | Python | .py | 24 | 34.458333 | 79 | 0.72093 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,995 | spots.py | cwhelchel_hunterlog/src/db/models/spots.py | import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
Base = declarative_base()
engine = sa.create_engine("sqlite:///spots.db")
class Spot(Base):
__tablename__ = "spots"
spotId = sa.Column(sa.Integer, primary_key=True)
acti... | 1,980 | Python | .py | 47 | 37.297872 | 79 | 0.700156 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,996 | callsigns.py | cwhelchel_hunterlog/src/utils/callsigns.py |
def get_basecall(callsign: str) -> str:
'''
Get the base component of a given callsign (ie. the callsign without '/P'
suffixes or country prefixes ie 'W4/').
'''
if callsign is None:
return ""
if "/" in callsign:
basecall = max(
callsign.split("/")[0],
c... | 422 | Python | .py | 15 | 20.866667 | 77 | 0.558025 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,997 | distance.py | cwhelchel_hunterlog/src/utils/distance.py | '''
This file is basically taken directly from augratin project. thx
'''
from math import radians, sin, cos, asin, sqrt, atan2, pi
class Distance:
@staticmethod
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance in kilometers between two points
on the earth ... | 2,858 | Python | .py | 77 | 28.545455 | 79 | 0.562184 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,998 | adif.py | cwhelchel_hunterlog/src/utils/adif.py |
import datetime
import logging as L
import os
import socket
import bands
import adif_io
import re
from db.db import DataBase
from db.models.qsos import Qso
from db.models.user_config import UserConfig
from version import __version__
logging = L.getLogger("adif_log")
BACKUP_LOG_FN = "hunter.adi"
class AdifLog():
... | 6,143 | Python | .py | 131 | 35.625954 | 79 | 0.556854 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |
2,287,999 | __init__.py | cwhelchel_hunterlog/src/pota/__init__.py | from .pota import Api as PotaApi
from .stats import PotaStats | 61 | Python | .py | 2 | 30 | 32 | 0.833333 | cwhelchel/hunterlog | 8 | 0 | 4 | GPL-3.0 | 9/5/2024, 10:48:18 PM (Europe/Amsterdam) |