Skip to content

Commit

Permalink
setup pip
Browse files Browse the repository at this point in the history
  • Loading branch information
Yassine Benzakour committed May 13, 2024
1 parent 75b5cdc commit 80ba259
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 43 deletions.
2 changes: 1 addition & 1 deletion oslactionspotting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version_info__ = ('0', '1', '4')
__version_info__ = ('0', '1', '8')
__version__ = '.'.join(__version_info__)
__authors__ = ["Silvio Giancola", "Yassine Benzakour"]
__authors_username__ = "giancos"
Expand Down
29 changes: 3 additions & 26 deletions oslactionspotting/apis/inference.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
import os
import logging
from datetime import datetime
import time
import numpy as np
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter

import torch


import json


from oslspotting.core.utils.dali import get_repartition_gpu
from oslspotting.core.utils.eval import evaluate_e2e
from oslspotting.core.utils.lightning import CustomProgressBar
from oslspotting.datasets.builder import build_dataloader
from oslspotting.models import build_model
from oslactionspotting.core.utils.eval import evaluate_e2e
from oslactionspotting.core.utils.lightning import CustomProgressBar
from oslactionspotting.datasets.builder import build_dataloader
import pytorch_lightning as pl

from oslspotting.core.runner import infer_features, infer_game, infer_video


from pathlib import Path
from typing import Optional, Union

import numpy as np
import torch
import torch.nn as nn

def build_inferer(cfg, model):
"""Build a inferer from config dict.
Expand Down
1 change: 1 addition & 0 deletions oslactionspotting/core/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import numpy
3 changes: 1 addition & 2 deletions oslactionspotting/datasets/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from oslactionspotting.core.utils.io import load_json
from tools.parsing_jsons.parse_actionball import get_stride
from tools.parsing_jsons.parse_soccernet import get_num_frames, read_fps
from .utils import get_stride, get_num_frames, read_fps
from .transform import RandomGaussianNoise, RandomHorizontalFlipFLow, \
RandomOffsetFlow, SeedableRandomSquareCrop, ThreeCrop

Expand Down
20 changes: 17 additions & 3 deletions oslactionspotting/datasets/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import numpy as np
import torch
import math

def get_stride(src_fps, sample_fps):
sample_fps = sample_fps
if sample_fps <= 0:
stride = 1
else:
stride = int(src_fps / sample_fps)
return stride

def read_fps(fps,sample_fps):
stride = get_stride(fps,sample_fps)
est_out_fps = fps / stride
return est_out_fps

def get_num_frames(num_frames,fps, sample_fps):
return math.ceil(num_frames/get_stride(fps,sample_fps))

def rulesToCombineShifts(shift_from_last_event, shift_until_next_event, params):

Expand Down Expand Up @@ -54,9 +71,6 @@ def oneHotToShifts(onehot, params):

return Shifts

import random


def getNegativeIndexes(labels, params, chunk_size):

zero_one_labels = np.zeros(labels.shape)
Expand Down
1 change: 0 additions & 1 deletion oslactionspotting/models/backbones/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import torch
import torch
from tqdm import tqdm
import torchvision
import torch.nn as nn
import torch.nn.functional as F
Expand Down
5 changes: 0 additions & 5 deletions oslactionspotting/models/contextaware.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@

import __future__
from typing import Any

import numpy as np

import torch
Expand All @@ -13,7 +9,6 @@
import os

from oslactionspotting.datasets.utils import timestamps2long, batch2long
from SoccerNet.Downloader import getListGames

from oslactionspotting.models.utils import NMS, create_folders, get_json_data, predictions2json, predictions2json_runnerjson, zipResults

Expand Down
6 changes: 3 additions & 3 deletions oslactionspotting/models/learnablepooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
from oslspotting.core.runner import timestamp_half

from oslspotting.models.litebase import LiteBaseModel
from oslspotting.models.utils import create_folders, get_json_data, get_prediction_data, get_spot_from_NMS, zipResults

from oslactionspotting.models.litebase import LiteBaseModel
from oslactionspotting.models.utils import create_folders, get_json_data, get_prediction_data, get_spot_from_NMS, timestamp_half, zipResults

from .heads import build_head
from .backbones import build_backbone
Expand Down
3 changes: 1 addition & 2 deletions tools/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import signal
import logging
from datetime import datetime
import time
from mmengine.config import Config, DictAction
import numpy as np
Expand All @@ -12,7 +11,7 @@
from oslactionspotting.core.utils.default_args import get_default_args_dataset
from oslactionspotting.core.utils.eval import search_best_epoch
from oslactionspotting.core.utils.io import check_config
from oslactionspotting.datasets.builder import build_dataloader, build_dataset
from oslactionspotting.datasets.builder import build_dataset
from oslactionspotting.models.builder import build_model


Expand Down

0 comments on commit 80ba259

Please sign in to comment.