repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/tests/__init__.py
tests/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/tests/test_video_model.py
tests/test_video_model.py
import unittest class TestVideoModel(unittest.TestCase): def test_transformers_backbone(self): import torch from video_transformers import VideoModel config = { "backbone": { "name": "TransformersBackbone", "framework": {"name": "transformers",...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/tests/run_code_style.py
tests/run_code_style.py
import sys from tests.utils import shell, validate_and_exit if __name__ == "__main__": arg = sys.argv[1] if arg == "check": sts_flake = shell("flake8 . --config setup.cfg --select=E9,F63,F7,F82") sts_isort = shell("isort . --check --settings pyproject.toml") sts_black = shell("black ....
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/tests/test_auto_backbone.py
tests/test_auto_backbone.py
import unittest class TestAutoBackbone(unittest.TestCase): def test_transformers_backbone(self): import torch from video_transformers import AutoBackbone config = { "framework": {"name": "transformers"}, "type": "2d_backbone", "model_name": "microsoft/...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/tests/test_backbone.py
tests/test_backbone.py
import unittest class TestBackbone(unittest.TestCase): def test_transformers_backbone(self): import torch from video_transformers.backbones.transformers import TransformersBackbone config = {"model_name": "microsoft/cvt-13"} batch_size = 2 backbone = TransformersBackbone...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/modeling.py
video_transformers/modeling.py
import json import os from pathlib import Path from typing import Dict, List, Optional, Union import torch from huggingface_hub.constants import PYTORCH_WEIGHTS_NAME from huggingface_hub.file_download import hf_hub_download from huggingface_hub.hub_mixin import PyTorchModelHubMixin from torch import nn import video_t...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/tracking.py
video_transformers/tracking.py
import os from typing import Optional, Union from accelerate.logging import get_logger from accelerate.tracking import GeneralTracker, is_tensorboard_available from video_transformers.utils.imports import check_requirements, is_layer_available, is_neptune_available from video_transformers.utils.logger import _flatten...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/templates.py
video_transformers/templates.py
from pathlib import Path from typing import Any, Dict, List def generate_labels_table(labels: List[str]) -> str: str_1 = """ | Labels | | :-- | """ str_2 = "\n".join(["| " + label + " |" for label in labels]) return str_1 + str_2 def generate_dict_to_table(_dict: Dict[str, Any]) -> str: if not _dict...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/trainer.py
video_transformers/trainer.py
from pathlib import Path from typing import Dict, List, Union import numpy as np import torch from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.tracking import GeneralTracker from torch.optim.lr_scheduler import _LRScheduler from tqdm.auto import tqdm import video_transforme...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/schedulers.py
video_transformers/schedulers.py
import torch def get_multistep_scheduler_with_warmup( optimizer: torch.optim.Optimizer, max_epochs: int = 12, warmup_epochs: float = 0.1 ): """ Torch multistep learning rate scheduler with warmup. Decrease the learning rate at milestones by a factor of 0.1. Milestones are chosen as 7/10 and 9/10 o...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/__init__.py
video_transformers/__init__.py
from video_transformers.auto.backbone import AutoBackbone from video_transformers.auto.head import AutoHead from video_transformers.auto.neck import AutoNeck from video_transformers.modeling import TimeDistributed, VideoModel __version__ = "0.0.9"
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/necks.py
video_transformers/necks.py
import math from typing import Dict import torch from torch import nn from video_transformers.utils.extra import class_to_config class BaseNeck(nn.Module): @property def config(self) -> Dict: return class_to_config(self) class LSTMNeck(BaseNeck): """ (BxTxF) ↓ LSTM ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/predict.py
video_transformers/predict.py
from collections import defaultdict from typing import List import pytorchvideo.data import torch import torch.utils.data from iopath.common.file_io import g_pathmgr from video_transformers.data import VideoPreprocessor from video_transformers.pytorchvideo_wrapper.data.labeled_video_paths import LabeledVideoDataset, ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/heads.py
video_transformers/heads.py
from typing import Dict import torch from torch import nn from video_transformers.utils.extra import class_to_config class LinearHead(nn.Module): """ (BxF) ↓ Dropout ↓ Linear """ def __init__(self, hidden_size: int, num_classes: int, dropout_p: float = 0.0): super(Lin...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/data.py
video_transformers/data.py
from typing import Dict, Tuple import pytorchvideo.data import torch import torch.utils.data from accelerate.logging import get_logger from pytorchvideo.transforms import ( ApplyTransformToKey, Normalize, RandomShortSideScale, ShortSideScale, UniformTemporalSubsample, ) from torch.utils.data import...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/tasks/__init__.py
video_transformers/tasks/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/tasks/single_label_classification.py
video_transformers/tasks/single_label_classification.py
from typing import Any, List import evaluate import torch from video_transformers.tasks.base import TaskMixin class Combine: # place holder for evaluate.combine till https://github.com/huggingface/evaluate/issues/234 fixed def __init__(self, metrics: List[str]): self.metrics = [evaluate.load(metric)...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/tasks/base.py
video_transformers/tasks/base.py
class TaskMixin: def training_step(self, batch): raise NotImplementedError() def on_training_epoch_end(self): raise NotImplementedError() def validation_step(self, batch): raise NotImplementedError() def on_validation_epoch_end(self): raise NotImplementedError() @...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/hfhub_wrapper/__init__.py
video_transformers/hfhub_wrapper/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/hfhub_wrapper/hub_mixin.py
video_transformers/hfhub_wrapper/hub_mixin.py
import os import tempfile from pathlib import Path from typing import List, Optional, Union from huggingface_hub import hf_api from huggingface_hub.hf_api import HfApi, HfFolder from huggingface_hub.repository import Repository from video_transformers.templates import export_hf_model_card def push_to_hub( self,...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/file.py
video_transformers/utils/file.py
import glob import os import re import urllib.request import zipfile from pathlib import Path def increment_path(path, exist_ok=True, sep=""): # Increment path, i.e. runs/exp --> runs/exp{sep}0, runs/exp{sep}1 etc. path = Path(path) # os-agnostic if (path.exists() and exist_ok) or (not path.exists()): ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/imports.py
video_transformers/utils/imports.py
import importlib def is_neptune_available(): return importlib.util.find_spec("neptune") is not None def is_layer_available(): return importlib.util.find_spec("layer") is not None def check_requirements(package_names): """ Raise error if module is not installed. """ missing_packages = [] ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/logger.py
video_transformers/utils/logger.py
from argparse import Namespace from typing import Any, Dict, Generator, List, MutableMapping, Optional import numpy as np from torch import Tensor # modified from lightning/src/pytorch_lightning/utilities/logger.py def _flatten_dict(params: Dict[Any, Any], delimiter: str = "/") -> Dict[str, Any]: """Flatten hie...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/extra.py
video_transformers/utils/extra.py
from typing import Any, Tuple def class_to_config( class_, allowed_types: Tuple[Any] = (int, float, str, dict, list, tuple, bool), ignored_attrs: Tuple[str] = ("config", "dump_patches", "training"), # ignore nn.Module attributes ): """ Converts a class attributes into a config dict. Args: ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/__init__.py
video_transformers/utils/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/utils/torch.py
video_transformers/utils/torch.py
from typing import List from torch import nn def unfreeze_last_n_stages(stages: List[nn.Module], n: int): if n == -1: # dont freeze if -1 return num_stages = len(stages) num_stages_to_freeze = num_stages - n for i, stage in enumerate(stages): if i >= num_stages_to_freeze: ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/pytorchvideo_wrapper/__init__.py
video_transformers/pytorchvideo_wrapper/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/pytorchvideo_wrapper/data/labeled_video_dataset.py
video_transformers/pytorchvideo_wrapper/data/labeled_video_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Modified from https://github.com/facebookresearch/pytorchvideo/blob/9180d6d57cb9e15100ec9df3a049cf8d1121b302/pytorchvideo/data/labeled_video_dataset.py from __future__ import annotations import gc import logging from collections import default...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/pytorchvideo_wrapper/data/labeled_video_paths.py
video_transformers/pytorchvideo_wrapper/data/labeled_video_paths.py
# modified from https://github.com/facebookresearch/pytorchvideo/blob/main/pytorchvideo/data/labeled_video_paths.py # and https://github.com/facebookresearch/pytorchvideo/blob/main/pytorchvideo/data/labeled_video_dataset.py from __future__ import annotations import logging import os import pathlib from collections im...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/pytorchvideo_wrapper/data/__init__.py
video_transformers/pytorchvideo_wrapper/data/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/backbones/transformers.py
video_transformers/backbones/transformers.py
from typing import Dict from video_transformers.backbones.base import Backbone from video_transformers.utils.torch import unfreeze_last_n_stages as unfreeze_last_n_stages_torch models_2d = ["convnext", "levit", "cvt", "clip", "swin", "vit", "deit", "beit", "resnet"] models_3d = ["videomae", "timesformer"] class Tra...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/backbones/timm.py
video_transformers/backbones/timm.py
from typing import Tuple from torch import nn from video_transformers.backbones.base import Backbone from video_transformers.modeling import Identity from video_transformers.utils.torch import unfreeze_last_n_stages as unfreeze_last_n_stages_torch class TimmBackbone(Backbone): def __init__(self, model_name: str...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/backbones/__init__.py
video_transformers/backbones/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/backbones/base.py
video_transformers/backbones/base.py
import inspect from typing import Dict from torch import nn from video_transformers.utils.extra import class_to_config from video_transformers.utils.torch import get_num_total_params, get_num_trainable_params class Backbone(nn.Module): def __init__( self, ): super(Backbone, self).__init__() ...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/deployment/__init__.py
video_transformers/deployment/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/deployment/gradio.py
video_transformers/deployment/gradio.py
from pathlib import Path from typing import List from video_transformers.templates import generate_gradio_app def export_gradio_app( model, examples: List[str], author_username: str = None, export_dir: str = "runs/exports/", export_filename: str = "app.py", ) -> str: Path(export_dir).mkdir(pa...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/deployment/onnx.py
video_transformers/deployment/onnx.py
import tempfile from pathlib import Path from typing import Optional import torch from video_transformers.utils.imports import check_requirements def export( model, quantize: bool = False, opset_version: int = 12, export_dir: str = "runs/exports/", export_filename: str = "model.onnx", ): """...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/auto/backbone.py
video_transformers/auto/backbone.py
from typing import Dict, Union from video_transformers.backbones.base import Backbone from video_transformers.modeling import TimeDistributed class AutoBackbone: """ AutoBackbone is a class that automatically instantiates a video model backbone from a config. """ @classmethod def from_config(cls...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/auto/neck.py
video_transformers/auto/neck.py
from typing import Dict from video_transformers.necks import BaseNeck class AutoNeck: """ AutoNeck is a class that automatically instantiates a video model neck from a config. """ @classmethod def from_config(cls, config: Dict) -> BaseNeck: neck_class_name = config.get("name") i...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/auto/__init__.py
video_transformers/auto/__init__.py
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
fcakyon/video-transformers
https://github.com/fcakyon/video-transformers/blob/8ada60b5a01964d813f11cd491d1bc22653e7303/video_transformers/auto/head.py
video_transformers/auto/head.py
from typing import Dict class AutoHead: """ AutoHead is a class that automatically instantiates a video model head from a config. """ @classmethod def from_config(cls, config: Dict): head_class_name = config.get("name") if head_class_name == "LinearHead": from video_tr...
python
MIT
8ada60b5a01964d813f11cd491d1bc22653e7303
2026-01-05T07:10:31.263453Z
false
AIZOOTech/object-detection-anchors
https://github.com/AIZOOTech/object-detection-anchors/blob/c4f995655e4ada213ea472e87be89307feaefe36/example.py
example.py
import glob import xml.etree.ElementTree as ET import numpy as np import matplotlib.pyplot as plt from kmeans import kmeans, avg_iou # ANNOTATIONS_PATH = "./data/pascalvoc07-annotations" ANNOTATIONS_PATH = "./data/widerface-annotations" CLUSTERS = 25 BBOX_NORMALIZE = True def show_cluster(data, cluster, max_points=2...
python
MIT
c4f995655e4ada213ea472e87be89307feaefe36
2026-01-05T07:10:29.796063Z
false
AIZOOTech/object-detection-anchors
https://github.com/AIZOOTech/object-detection-anchors/blob/c4f995655e4ada213ea472e87be89307feaefe36/kmeans.py
kmeans.py
import numpy as np def iou(boxes, clusters): """ Calculates the Intersection over Union (IoU) between N boxes and K clusters. :param boxes: numpy array of shape (n, 2) where n is the number of box, shifted to the origin (i. e. width and height) :param clusters: numpy array of shape (k, 2) where k is t...
python
MIT
c4f995655e4ada213ea472e87be89307feaefe36
2026-01-05T07:10:29.796063Z
false
AIZOOTech/object-detection-anchors
https://github.com/AIZOOTech/object-detection-anchors/blob/c4f995655e4ada213ea472e87be89307feaefe36/tests/test_rectangles.py
tests/test_rectangles.py
from unittest import TestCase import numpy as np from kmeans import kmeans class TestBasic(TestCase): def gen_shape(self, width, height, amount): boxes = np.empty((amount, 2)) for i in range(0, amount): x0 = np.random.randint(100, 1000) y0 = np.random.randint(100, 1000) ...
python
MIT
c4f995655e4ada213ea472e87be89307feaefe36
2026-01-05T07:10:29.796063Z
false
AIZOOTech/object-detection-anchors
https://github.com/AIZOOTech/object-detection-anchors/blob/c4f995655e4ada213ea472e87be89307feaefe36/tests/test_voc2007.py
tests/test_voc2007.py
import glob import xml.etree.ElementTree as ET from unittest import TestCase import numpy as np from kmeans import kmeans, avg_iou ANNOTATIONS_PATH = "Annotations" class TestVoc2007(TestCase): def __load_dataset(self): dataset = [] for xml_file in glob.glob("{}/*xml".format(ANNOTATIONS_PATH)): ...
python
MIT
c4f995655e4ada213ea472e87be89307feaefe36
2026-01-05T07:10:29.796063Z
false
AIZOOTech/object-detection-anchors
https://github.com/AIZOOTech/object-detection-anchors/blob/c4f995655e4ada213ea472e87be89307feaefe36/tests/test_basic.py
tests/test_basic.py
from unittest import TestCase import numpy as np from kmeans import iou, avg_iou, kmeans class TestBasic(TestCase): def test_iou_100(self): self.assertEqual(iou([200, 200], np.array([[200, 200]])), 1.) def test_iou_50(self): self.assertEqual(iou([200, 200], np.array([[100, 200]])), .5) ...
python
MIT
c4f995655e4ada213ea472e87be89307feaefe36
2026-01-05T07:10:29.796063Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/transformers_utils.py
transformers_utils.py
import os import collections import re import shutil import tempfile import gc from copy import deepcopy import torch from transformers.utils import logging from transformers.pytorch_utils import id_tensor_storage from transformers.modeling_utils import ( set_initialized_submodules, expand_device_map, _...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/merge_moe_lora.py
merge_moe_lora.py
import transformers from transformers import AutoModelForCausalLM, AutoTokenizer, AutoModel from camelidae.configuration_camelidae import CamelidaeConfig from camelidae.modeling_camelidae import LlamaForCausalLM from peft import PeftModel import torch def merge_lora_to_base_model(): from transformers_utils im...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/utils.py
utils.py
import dataclasses import logging import math import os import io import sys import time import json from typing import Optional, Sequence, Union import openai import tqdm from openai import openai_object import copy StrOrOpenAIObject = Union[str, openai_object.OpenAIObject] openai_org = os.getenv("OPENAI_ORG") if o...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/train_moe.py
train_moe.py
# Copyright 2023 Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/train_qlora.py
train_qlora.py
# Copyright 2023 Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/camelidae/modeling_camelidae.py
camelidae/modeling_camelidae.py
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
true
wuhy68/Parameter-Efficient-MoE
https://github.com/wuhy68/Parameter-Efficient-MoE/blob/5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21/camelidae/configuration_camelidae.py
camelidae/configuration_camelidae.py
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
python
Apache-2.0
5e9b10be7fb55eb9a5e2c4df18e8bbaa09465a21
2026-01-05T07:10:32.628587Z
false
niwanbernardo/excluir-email-outlook
https://github.com/niwanbernardo/excluir-email-outlook/blob/a592b104414aad8240569ebb41e349657293504d/excluir_emails_spam_outlook.py
excluir_emails_spam_outlook.py
import win32com.client from win32com.client import Dispatch import traceback def excluir_emails(remetentes_para_excluir): try: # Conectando ao Outlook outlook = Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder(6) # 6 representa a Caixa de Entrada ...
python
MIT
a592b104414aad8240569ebb41e349657293504d
2026-01-05T07:10:34.382370Z
false
niwanbernardo/excluir-email-outlook
https://github.com/niwanbernardo/excluir-email-outlook/blob/a592b104414aad8240569ebb41e349657293504d/recuperar_emails_spam_outlook.py
recuperar_emails_spam_outlook.py
import win32com.client from win32com.client import Dispatch import traceback def recuperar_emails(remetentes_para_recuperar): try: # Conectando ao Outlook outlook = Dispatch("Outlook.Application").GetNamespace("MAPI") # Acessando a pasta de Itens Excluídos (3 representa "Deleted It...
python
MIT
a592b104414aad8240569ebb41e349657293504d
2026-01-05T07:10:34.382370Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/__init__.py
src/__init__.py
""" CVPR 2015 CNN for Person Re-Identification PyTorch Implementation - Educational Refactoring 基于 CVPR 2015 论文《An Improved Deep Learning Architecture for Person Re-Identification》 的 PyTorch 现代化实现,面向教学和学习。 """ __version__ = "2.0.0" __author__ = "Ning Ding (Original), Refactored by AI" __license__ = "MIT" from src im...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/scripts/train.py
src/scripts/train.py
""" Training script for Person Re-Identification 训练脚本 Usage: reid-train --config config/cuhk03.yaml Or directly: python -m src.scripts.train --config config/cuhk03.yaml """ import argparse from pathlib import Path import yaml import torch import pytorch_lightning as pl from pytorch_lightning.callbacks im...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/scripts/__init__.py
src/scripts/__init__.py
""" Training and evaluation scripts for Person Re-Identification 用于人员重识别的训练和评估脚本 """ __all__ = ["train"]
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/models/__init__.py
src/models/__init__.py
""" Models module for Person Re-Identification 模型模块 包含 Siamese CNN 及其变体实现 """ from .layers import ( CrossInputNeighborhoodDifferences, PatchSummaryConv, TiedConvBlock, ) from .siamese_cnn import SiameseCNN, create_siamese_cnn from .lightning_module import ReIDLightningModule, ContrastiveLoss, PolynomialLR...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/models/lightning_module.py
src/models/lightning_module.py
""" PyTorch Lightning Module for Person Re-Identification 人员重识别 PyTorch Lightning 模块 将模型、损失函数、优化器等封装到 Lightning 模块中, 简化训练、验证和测试流程 """ import torch import torch.nn as nn import torch.nn.functional as F import pytorch_lightning as pl from typing import Dict, Any, Optional, Tuple from torch.optim import Optimizer from t...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/models/layers.py
src/models/layers.py
""" Custom layers for Person Re-Identification 自定义层实现 包含 CVPR 2015 论文中的 Cross-Input Neighborhood Differences 层等创新结构 """ import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple class CrossInputNeighborhoodDifferences(nn.Module): """ Cross-Input Neighborhood Differences Lay...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/models/siamese_cnn.py
src/models/siamese_cnn.py
""" Siamese CNN for Person Re-Identification 用于人员重识别的孪生卷积神经网络 实现 CVPR 2015 论文: "An Improved Deep Learning Architecture for Person Re-Identification" 网络结构: 1. Tied Convolution Layers (权重共享) 2. Cross-Input Neighborhood Differences (交叉输入邻域差异) 3. Patch Summary Features (图块摘要特征) 4. Across-Patch Features (跨图块特征) 5. Fully C...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/utils/logger.py
src/utils/logger.py
""" Logging utilities 日志工具 """ import logging import sys from pathlib import Path from typing import Optional from rich.logging import RichHandler from rich.console import Console def setup_logger( name: str = "reid", log_file: Optional[str] = None, level: int = logging.INFO, use_rich: bool = True, )...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/utils/__init__.py
src/utils/__init__.py
""" Utilities module 工具模块 """ from .logger import setup_logger, get_logger from .visualization import plot_cmc_curve, plot_training_curves __all__ = [ "setup_logger", "get_logger", "plot_cmc_curve", "plot_training_curves", ]
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/utils/visualization.py
src/utils/visualization.py
""" Visualization utilities 可视化工具 """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np from pathlib import Path from typing import Optional, List def plot_cmc_curve( cmc: np.ndarray, save_path: Optional[str] = None, title: str = "CMC Curve", max_rank: int = 50, ): """绘制 CM...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/training/__init__.py
src/training/__init__.py
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/config/__init__.py
src/config/__init__.py
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/data/market1501_dataset.py
src/data/market1501_dataset.py
""" Market-1501 Dataset for Person Re-Identification Market-1501 人员重识别数据集 Market-1501 是一个大规模的 ReID 数据集,包含从 6 个摄像头收集的数据。 Dataset Structure / 数据集结构: bounding_box_train/ - 训练集图像 bounding_box_test/ - Gallery 图像 query/ - Query 图像 Filename Format / 文件命名格式: XXXX_cY_sZ_NNNNNN.jpg - XXXX:...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/data/base_dataset.py
src/data/base_dataset.py
""" Base dataset class for Person Re-Identification 人员重识别数据集基类 提供统一的数据集接口和通用功能 """ from abc import ABC, abstractmethod from typing import Optional, Tuple, Dict, Any, Literal, List from pathlib import Path import numpy as np import torch from torch.utils.data import Dataset import albumentations as A class BaseReIDD...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/data/cuhk03_dataset.py
src/data/cuhk03_dataset.py
""" CUHK03 Dataset for Person Re-Identification CUHK03 人员重识别数据集 CUHK03 是最经典的 ReID 数据集之一,包含 1467 个身份,每个身份有多个视角的图像。 Dataset Structure / 数据集结构: - 原始文件: cuhk-03.mat (MATLAB格式) - 处理后: cuhk-03.hdf5 (按 identity 组织) - 索引文件: cuhk-03-index.hdf5 (train/val/test split) Reference: Li et al., "DeepReID: Deep Filte...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/data/__init__.py
src/data/__init__.py
""" Data processing module for Person Re-Identification 数据处理模块 包含数据集类、数据增强和数据加载工具 """ from .base_dataset import BaseReIDDataset, PairSamplingStrategy from .cuhk03_dataset import CUHK03Dataset from .market1501_dataset import Market1501Dataset from .transforms import ( get_train_transforms, get_val_transforms, ...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/data/transforms.py
src/data/transforms.py
""" Data augmentation and transformation utilities 数据增强和转换工具 使用 Albumentations 库提供高性能的数据增强 """ from typing import Dict, Any, Optional import albumentations as A from albumentations.pytorch import ToTensorV2 import cv2 def get_train_transforms( image_size: tuple[int, int] = (160, 60), shift_limit: float = 0....
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/evaluation/metrics.py
src/evaluation/metrics.py
""" Evaluation metrics for Person Re-Identification 人员重识别评估指标 实现 CMC (Cumulative Matching Characteristic) 和 mAP (mean Average Precision) """ import numpy as np import torch from typing import Tuple, List, Optional from sklearn.metrics import average_precision_score def compute_distance_matrix( query_features: t...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/src/evaluation/__init__.py
src/evaluation/__init__.py
""" Evaluation module 评估模块 """ from .metrics import ( compute_distance_matrix, compute_cmc, compute_map, evaluate_reid, ) __all__ = [ "compute_distance_matrix", "compute_cmc", "compute_map", "evaluate_reid", ]
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/tests/test_identity_mapping_fix.py
tests/test_identity_mapping_fix.py
""" Test to verify the person ID mapping bug fix 验证 Person ID 映射 Bug 修复的测试 """ import numpy as np import torch def test_identity_mapping(): """ 测试 identity_list 映射是否正确工作 """ print("Testing identity mapping bug fix...") print("=" * 60) # 模拟 CUHK03 场景: person IDs 是打乱的 0-1359 print("\n1. CU...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/legacy/CUHK03/main.py
legacy/CUHK03/main.py
# -*- coding: utf-8 -*- # -------------------------------------------------------- # Implementation-CVPR2015-CNN-for-ReID # Copyright (c) 2017 Ning Ding # Licensed under The MIT License [see LICENSE for details] # Written by Ning Ding # -------------------------------------------------------- import os import sys impo...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/legacy/market1501/model_for_market1501.py
legacy/market1501/model_for_market1501.py
# -*- coding: utf-8 -*- import numpy as np np.random.seed(1217) import h5py import tensorflow as tf tf.python.control_flow_ops = tf from PIL import Image from keras import backend as K from keras.models import Model from keras.layers import Input,Dense,Convolution2D,Activation,MaxPooling2D,Flatten,merge from keras.regu...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
Ning-Ding/Implementation-CVPR2015-CNN-for-ReID
https://github.com/Ning-Ding/Implementation-CVPR2015-CNN-for-ReID/blob/8d0a2882f7158c4b99e3c1d4d0e14c515b07a838/legacy/market1501/make_hdf5_for_market1501.py
legacy/market1501/make_hdf5_for_market1501.py
# -*- coding: utf-8 -*- import os import h5py import numpy as np from PIL import Image def make_positive_index_market1501(train_or_test = 'train',user_name = 'ubuntu'): f = h5py.File('market1501_positive_index.h5') path_list = get_image_path_list(train_or_test = train_or_test, system_user_name = user_name) ...
python
MIT
8d0a2882f7158c4b99e3c1d4d0e14c515b07a838
2026-01-05T07:10:35.093069Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/gunicorn_settings.py
gunicorn_settings.py
bind = "0.0.0.0:8000" workers = 2 pythonpath = '/app/config' forwarded_allow_ips = '*'
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/manage.py
src/manage.py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportE...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/views.py
src/shots/views.py
import json from django import forms from django.http import HttpResponse, JsonResponse from django.shortcuts import render, redirect, get_object_or_404 from shots.models import ScreenShot from django.forms import ModelForm from django.views.decorators.http import require_http_methods from django.views.decorators.http ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/admin.py
src/shots/admin.py
from django.contrib import admin from .models import ScreenShot def reset_status(modeladmin, request, queryset): queryset.update(status=ScreenShot.NEW) def reset_status_to_failed(modeladmin, request, queryset): queryset.update(status=ScreenShot.FAILURE) reset_status.short_description = "Reset status to NEW ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/models.py
src/shots/models.py
from django.db.models import JSONField from django.db import models import uuid from django.conf import settings from django.core import validators from shots.validators import validate_hostname_dns from django.shortcuts import reverse class ScreenShot(models.Model): NEW = 'N' PENDING = 'P' SUCCESS = 'S'...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/validators.py
src/shots/validators.py
from django.core.exceptions import ValidationError import socket from urllib.parse import urlparse def validate_hostname_dns(value): domain = urlparse(value).netloc.split(':')[0] if len(domain) == 0: raise ValidationError(f"Domain name is required") try: socket.gethostbyname(domain) ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/__init__.py
src/shots/__init__.py
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/tests.py
src/shots/tests.py
from django.test import TestCase import json from django.urls import reverse from shots.models import ScreenShot from django.http import HttpResponse, JsonResponse class TestScreenShotAPI(TestCase): def setUp(self) -> None: self.api_url = reverse('api-screenshot') def do_post(self, data) -> JsonResp...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/apps.py
src/shots/apps.py
from django.apps import AppConfig class ShotsConfig(AppConfig): name = 'shots'
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/screenshot_driver.py
src/shots/screenshot_driver.py
from time import sleep import os from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.common.exceptions import NoSuchElementException, WebDriverException, TimeoutException from django.conf import settings from sentry_sdk import capture_exception from PIL import Image impor...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/templatetags/__init__.py
src/shots/templatetags/__init__.py
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/__init__.py
src/shots/management/__init__.py
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/commands/screenshot_worker.py
src/shots/management/commands/screenshot_worker.py
from django.core.management.base import BaseCommand, CommandError from selenium import webdriver from time import sleep from shots.models import ScreenShot from django.conf import settings class Command(BaseCommand): help = 'Run the screenshot worker' def handle(self, *args, **options): while Tru...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/commands/upload_to_bucket.py
src/shots/management/commands/upload_to_bucket.py
import glob from time import sleep from pathlib import Path import boto3 from django.core.management.base import BaseCommand, CommandError from django.conf import settings import sys import signal # https://www.simplecto.com/using-django-and-boto3-with-scaleway-object-storage/ class Command(BaseCommand): help = '...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/commands/screenshot_worker_ff.py
src/shots/management/commands/screenshot_worker_ff.py
import requests from django.core.files import File from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from time import sleep from shots.models import ScreenShot import random from django.core.cache import cache from django.core.cache import caches from shots.screenshot_d...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/commands/__init__.py
src/shots/management/commands/__init__.py
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/management/commands/cleanup_7day_old.py
src/shots/management/commands/cleanup_7day_old.py
from datetime import timedelta from time import sleep from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from shots.models import ScreenShot class Command(BaseCommand): help = 'Remove screenshots mor than 7 days old' def handle(self, *args, **options): ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/migrations/0018_screenshot_dpi.py
src/shots/migrations/0018_screenshot_dpi.py
# Generated by Django 3.0.3 on 2020-03-08 02:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shots', '0017_screenshot_sleep_seconds'), ] operations = [ migrations.AddField( model_name='screenshot', name='dpi',...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/migrations/0019_auto_20200315_1818.py
src/shots/migrations/0019_auto_20200315_1818.py
# Generated by Django 3.0.3 on 2020-03-15 18:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shots', '0018_screenshot_dpi'), ] operations = [ migrations.AddField( model_name='screenshot', name='description', ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/migrations/0010_auto_20200209_2152.py
src/shots/migrations/0010_auto_20200209_2152.py
# Generated by Django 3.0.2 on 2020-02-09 21:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shots', '0009_auto_20200209_1605'), ] operations = [ migrations.AddField( model_name='screenshot', name='base64_full...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/migrations/0017_screenshot_sleep_seconds.py
src/shots/migrations/0017_screenshot_sleep_seconds.py
# Generated by Django 3.0.3 on 2020-03-07 23:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shots', '0016_auto_20200228_1053'), ] operations = [ migrations.AddField( model_name='screenshot', name='sleep_secon...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false
simplecto/screenshots
https://github.com/simplecto/screenshots/blob/7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b/src/shots/migrations/0022_remove_screenshot_image_binary.py
src/shots/migrations/0022_remove_screenshot_image_binary.py
# Generated by Django 3.0.3 on 2020-03-21 18:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('shots', '0021_screenshot_file'), ] operations = [ migrations.RemoveField( model_name='screenshot', name='image_binary', ...
python
MIT
7171ef6fbb9a67bc68a2cc5d70671fd7cc78415b
2026-01-05T07:10:39.014827Z
false