opensportslib 0.1.1.dev1__tar.gz → 0.1.1.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. {opensportslib-0.1.1.dev1/opensportslib.egg-info → opensportslib-0.1.1.dev3}/PKG-INFO +3 -12
  2. opensportslib-0.1.1.dev3/opensportslib/cli.py +22 -0
  3. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/data.py +11 -2
  4. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/classification_dataset.py +21 -3
  5. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/backbones/builder.py +31 -7
  6. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/tracking.py +1 -2
  7. opensportslib-0.1.1.dev3/opensportslib/setup/setup.py +151 -0
  8. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3/opensportslib.egg-info}/PKG-INFO +3 -12
  9. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib.egg-info/SOURCES.txt +3 -0
  10. opensportslib-0.1.1.dev3/opensportslib.egg-info/entry_points.txt +2 -0
  11. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib.egg-info/requires.txt +2 -13
  12. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/pyproject.toml +5 -4
  13. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/LICENSE +0 -0
  14. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/LICENSE-COMMERCIAL +0 -0
  15. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/MANIFEST.in +0 -0
  16. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/README.md +0 -0
  17. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/examples/quickstart/basic_classification.py +0 -0
  18. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/examples/quickstart/basic_localization.py +0 -0
  19. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/__init__.py +0 -0
  20. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/apis/__init__.py +0 -0
  21. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/apis/classification.py +0 -0
  22. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/apis/localization.py +0 -0
  23. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/classification.yaml +0 -0
  24. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/localization-e2e-ocv.yaml +0 -0
  25. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/localization-json_calf_resnetpca512.yaml +0 -0
  26. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/localization-json_netvlad++_resnetpca512.yaml +0 -0
  27. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/localization.yaml +0 -0
  28. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/sngar-frames.yaml +0 -0
  29. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/config/sngar-tracking.yaml +0 -0
  30. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/__init__.py +0 -0
  31. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/__init__.py +0 -0
  32. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/builder.py +0 -0
  33. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/calf.py +0 -0
  34. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/ce.py +0 -0
  35. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/combine.py +0 -0
  36. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/loss/nll.py +0 -0
  37. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/optimizer/__init__.py +0 -0
  38. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/optimizer/builder.py +0 -0
  39. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/sampler/weighted_sampler.py +0 -0
  40. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/scheduler/__init__.py +0 -0
  41. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/scheduler/builder.py +0 -0
  42. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/trainer/__init__.py +0 -0
  43. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/trainer/classification_trainer.py +0 -0
  44. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/trainer/localization_trainer.py +0 -0
  45. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/checkpoint.py +0 -0
  46. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/config.py +0 -0
  47. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/ddp.py +0 -0
  48. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/default_args.py +0 -0
  49. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/lightning.py +0 -0
  50. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/load_annotations.py +0 -0
  51. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/seed.py +0 -0
  52. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/video_processing.py +0 -0
  53. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/core/utils/wandb.py +0 -0
  54. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/__init__.py +0 -0
  55. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/builder.py +0 -0
  56. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/localization_dataset.py +0 -0
  57. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/utils/__init__.py +0 -0
  58. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/datasets/utils/tracking.py +0 -0
  59. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/metrics/classification_metric.py +0 -0
  60. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/metrics/localization_metric.py +0 -0
  61. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/__init__.py +0 -0
  62. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/contextaware.py +0 -0
  63. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/e2e.py +0 -0
  64. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/learnablepooling.py +0 -0
  65. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/vars.py +0 -0
  66. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/video.py +0 -0
  67. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/base/video_mae.py +0 -0
  68. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/builder.py +0 -0
  69. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/heads/builder.py +0 -0
  70. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/neck/builder.py +0 -0
  71. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/common.py +0 -0
  72. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/__init__.py +0 -0
  73. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/asformer.py +0 -0
  74. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/calf.py +0 -0
  75. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/gsm.py +0 -0
  76. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/gtad.py +0 -0
  77. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/impl/tsm.py +0 -0
  78. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/litebase.py +0 -0
  79. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/modules.py +0 -0
  80. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/shift.py +0 -0
  81. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib/models/utils/utils.py +0 -0
  82. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib.egg-info/dependency_links.txt +0 -0
  83. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/opensportslib.egg-info/top_level.txt +0 -0
  84. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/setup.cfg +0 -0
  85. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/tests/conftest.py +0 -0
  86. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/tests/test_config_utils_smoke.py +0 -0
  87. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/tests/test_package_smoke.py +0 -0
  88. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/tests/test_public_apis_smoke.py +0 -0
  89. {opensportslib-0.1.1.dev1 → opensportslib-0.1.1.dev3}/tests/test_subset_train_infer_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensportslib
3
- Version: 0.1.1.dev1
3
+ Version: 0.1.1.dev3
4
4
  Summary: OpenSportsLib is the professional library, designed for advanced video understanding in sports. It provides state-of-the-art tools for action recognition, spotting, retrieval, and captioning, making it ideal for researchers, analysts, and developers working with sports video data.
5
5
  Author: Jeet Vora
6
6
  Requires-Python: >=3.12
@@ -22,17 +22,8 @@ Requires-Dist: opencv-python
22
22
  Requires-Dist: omegaconf
23
23
  Requires-Dist: timm
24
24
  Requires-Dist: seaborn
25
- Provides-Extra: localization
26
- Requires-Dist: nvidia-dali-cuda120; extra == "localization"
27
- Requires-Dist: cupy-cuda12x; extra == "localization"
28
- Requires-Dist: tabulate; extra == "localization"
29
- Requires-Dist: pytorch-lightning; extra == "localization"
30
- Provides-Extra: py-geometric
31
- Requires-Dist: torch-geometric; extra == "py-geometric"
32
- Requires-Dist: torch-scatter; extra == "py-geometric"
33
- Requires-Dist: torch-sparse; extra == "py-geometric"
34
- Requires-Dist: torch-cluster; extra == "py-geometric"
35
- Requires-Dist: torch-spline-conv; extra == "py-geometric"
25
+ Requires-Dist: tabulate
26
+ Requires-Dist: pytorch-lightning
36
27
  Provides-Extra: test
37
28
  Requires-Dist: pytest; extra == "test"
38
29
  Requires-Dist: pytest-cov; extra == "test"
@@ -0,0 +1,22 @@
1
+ import argparse
2
+ from opensportslib.setup.setup import setup
3
+
4
+
5
+ def main():
6
+ parser = argparse.ArgumentParser()
7
+
8
+ parser.add_argument(
9
+ "command",
10
+ choices=["setup"]
11
+ )
12
+
13
+ parser.add_argument("--pyg", action="store_true")
14
+ parser.add_argument("--dali", action="store_true")
15
+
16
+ args = parser.parse_args()
17
+
18
+ if args.command == "setup":
19
+ setup(
20
+ pyg=args.pyg,
21
+ dali=args.dali # reuse flag for simplicity
22
+ )
@@ -52,7 +52,16 @@ def tracking_collate_fn(batch):
52
52
  Custom collate function for tracking data.
53
53
  Uses PyG Batch.from_data_list for efficient C++ batching.
54
54
  """
55
- from torch_geometric.data import Batch
55
+ try:
56
+ from torch_geometric.data import Batch
57
+ except ImportError as exc:
58
+ raise ImportError(
59
+ "torch-geometric is required for tracking_collate_fn. "
60
+ "Install with: pip install \"opensportslib[py-geometric]\" "
61
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html "
62
+ "or (editable): pip install -e \".[py-geometric]\" "
63
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html"
64
+ ) from exc
56
65
 
57
66
  batch_size = len(batch)
58
67
  seq_len = batch[0]['seq_len']
@@ -82,4 +91,4 @@ def mixup_data(x, y, alpha=0.2):
82
91
  index = torch.randperm(x.size(0)).to(x.device)
83
92
  mixed_x = lam * x + (1 - lam) * x[index]
84
93
  return mixed_x, y, y[index], lam
85
-
94
+
@@ -496,7 +496,16 @@ class TrackingDataset(ClassificationDataset):
496
496
  a copy of the feature array is made before augmentation and
497
497
  normalization so the cached data is never mutated.
498
498
  """
499
- from torch_geometric.data import Data
499
+ try:
500
+ from torch_geometric.data import Data
501
+ except ImportError as exc:
502
+ raise ImportError(
503
+ "torch-geometric is required for tracking_parquet datasets. "
504
+ "Install with: pip install \"opensportslib[py-geometric]\" "
505
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html "
506
+ "or (editable): pip install -e \".[py-geometric]\" "
507
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html"
508
+ ) from exc
500
509
 
501
510
  from opensportslib.datasets.utils.tracking import normalize_features
502
511
 
@@ -533,7 +542,16 @@ class TrackingDataset(ClassificationDataset):
533
542
 
534
543
  def _getitem_on_the_fly(self, idx):
535
544
  """load, parse, and process a single sample from disk."""
536
- from torch_geometric.data import Data
545
+ try:
546
+ from torch_geometric.data import Data
547
+ except ImportError as exc:
548
+ raise ImportError(
549
+ "torch-geometric is required for tracking_parquet datasets. "
550
+ "Install with: pip install \"opensportslib[py-geometric]\" "
551
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html "
552
+ "or (editable): pip install -e \".[py-geometric]\" "
553
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html"
554
+ ) from exc
537
555
 
538
556
  from opensportslib.datasets.utils.tracking import (
539
557
  compute_deltas,
@@ -600,4 +618,4 @@ class TrackingDataset(ClassificationDataset):
600
618
  if label is not None:
601
619
  out["label"] = label
602
620
  return out
603
-
621
+
@@ -38,6 +38,23 @@ import os
38
38
  from opensportslib.models.utils.shift import make_temporal_shift
39
39
 
40
40
 
41
+ _PYG_IMPORT_ERROR_MSG = (
42
+ "torch-geometric is required for graph/tracking models. "
43
+ "Install with: pip install \"opensportslib[py-geometric]\" "
44
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html "
45
+ "or (editable): pip install -e \".[py-geometric]\" "
46
+ "-f https://pytorch-geometric.com/whl/torch-2.10.0+cu128.html"
47
+ )
48
+
49
+
50
+ def _import_pyg_nn():
51
+ try:
52
+ import torch_geometric.nn as pyg_nn
53
+ except ImportError as exc:
54
+ raise ImportError(_PYG_IMPORT_ERROR_MSG) from exc
55
+ return pyg_nn
56
+
57
+
41
58
  def _use_pretrained_weights(default=True):
42
59
  """Control pretrained backbone loading from env for offline/local runs."""
43
60
  flag = os.environ.get("OSL_PRETRAINED_WEIGHTS", "1").strip().lower()
@@ -350,7 +367,8 @@ class GraphEncoder(nn.Module):
350
367
  def __init__(self, input_dim, hidden_dim, num_layers, conv_type='gin', dropout=0.1):
351
368
  super().__init__()
352
369
 
353
- from torch_geometric.nn import DeepGCNLayer
370
+ pyg_nn = _import_pyg_nn()
371
+ DeepGCNLayer = pyg_nn.DeepGCNLayer
354
372
  self.conv_type = conv_type
355
373
  self.feat_dim = hidden_dim
356
374
 
@@ -371,10 +389,14 @@ class GraphEncoder(nn.Module):
371
389
  self.gcn_layers.append(layer)
372
390
 
373
391
  def _build_conv_layer(self, conv_type, hidden_dim, dropout):
374
- from torch_geometric.nn import (
375
- GATv2Conv, EdgeConv, SAGEConv,
376
- GINConv, GENConv, GraphConv, MultiAggregation
377
- )
392
+ pyg_nn = _import_pyg_nn()
393
+ GATv2Conv = pyg_nn.GATv2Conv
394
+ EdgeConv = pyg_nn.EdgeConv
395
+ SAGEConv = pyg_nn.SAGEConv
396
+ GINConv = pyg_nn.GINConv
397
+ GENConv = pyg_nn.GENConv
398
+ GraphConv = pyg_nn.GraphConv
399
+ MultiAggregation = pyg_nn.MultiAggregation
378
400
 
379
401
  if conv_type == 'graphconv':
380
402
  return GraphConv(
@@ -434,7 +456,8 @@ class GraphEncoder(nn.Module):
434
456
  raise ValueError(f"Unknown conv type: {conv_type}")
435
457
 
436
458
  def forward(self, x, edge_index, batch):
437
- from torch_geometric.nn import global_mean_pool
459
+ pyg_nn = _import_pyg_nn()
460
+ global_mean_pool = pyg_nn.global_mean_pool
438
461
 
439
462
  x = self.node_encoder(x)
440
463
 
@@ -448,7 +471,8 @@ class GraphEncoder(nn.Module):
448
471
 
449
472
  def _compute_edge_dynamic(self, x, batch, k=8):
450
473
  """Compute dynamic KNN edges for EdgeConv layers."""
451
- from torch_geometric.nn import knn_graph
474
+ pyg_nn = _import_pyg_nn()
475
+ knn_graph = pyg_nn.knn_graph
452
476
  edge_index = knn_graph(x, k=k, batch=batch, loop=False)
453
477
  return edge_index
454
478
 
@@ -1,6 +1,5 @@
1
1
  import torch
2
2
  import torch.nn as nn
3
- from torch_geometric.nn import global_mean_pool
4
3
 
5
4
  from opensportslib.models.backbones.builder import build_backbone
6
5
  from opensportslib.models.neck.builder import build_neck
@@ -70,4 +69,4 @@ class TrackingModel(nn.Module):
70
69
  # classification
71
70
  logits = self.head(x) # (B, num_classes)
72
71
 
73
- return logits
72
+ return logits
@@ -0,0 +1,151 @@
1
+ import subprocess
2
+ import sys
3
+
4
+
5
+ CUDA_SUPPORT = [
6
+ "cu126",
7
+ "cu128",
8
+ "cu130",
9
+ "cpu"
10
+ ]
11
+
12
+ def get_cuda_version():
13
+ try:
14
+ output = subprocess.check_output(["nvidia-smi"]).decode()
15
+
16
+ for line in output.split("\n"):
17
+ if "CUDA Version" in line:
18
+ ver = line.split("CUDA Version:")[1].strip().split()[0]
19
+ print(f"CUDA Version found : {ver}")
20
+ return ver
21
+ except Exception:
22
+ return None
23
+
24
+
25
+ CUDA_VERSION = get_cuda_version()
26
+
27
+ def get_cpu_tag():
28
+ if not CUDA_VERSION:
29
+ return "cpu"
30
+
31
+ def install_torch():
32
+ python = sys.executable
33
+ for cuda in CUDA_SUPPORT:
34
+
35
+ print(f"\n Trying installation: {cuda}\n")
36
+ try:
37
+ if get_cpu_tag() == "cpu":
38
+ subprocess.check_call([
39
+ python, "-m", "pip", "install",
40
+ "torch", "torchvision", "torchaudio"
41
+ ])
42
+ else:
43
+
44
+ subprocess.check_call([
45
+ python, "-m", "pip", "install",
46
+ "torch", "torchvision", "torchaudio",
47
+ "--index-url",
48
+ f"https://download.pytorch.org/whl/{cuda}"
49
+ ])
50
+ print(f"\nSuccess with {cuda}")
51
+ return cuda
52
+
53
+ except Exception as e:
54
+ print(f"Failed with {cuda}: {e}")
55
+
56
+ raise RuntimeError("All CUDA installs failed")
57
+
58
+ def install_dali():
59
+
60
+ python = sys.executable
61
+
62
+ print("\nInstalling dali extras...\n")
63
+
64
+ # DALI (only if GPU)
65
+ if CUDA_VERSION:
66
+ subprocess.check_call([
67
+ python, "-m", "pip", "install",
68
+ "nvidia-dali-cuda120"
69
+ ])
70
+
71
+ # CuPy (CUDA-aware but auto-resolves internally)
72
+ subprocess.check_call([
73
+ python, "-m", "pip", "install",
74
+ "cupy-cuda12x"
75
+ ])
76
+
77
+ def install_pyg():
78
+ import torch
79
+ from packaging import version
80
+
81
+ python = sys.executable
82
+ torch_version = "2.10.0" if version.parse(torch.__version__.split("+")[0]) > version.parse("2.10.0") else torch.__version__.split("+")[0]
83
+ cuda_tag = next((f"cu{CUDA_VERSION.replace('.', '')}" for _ in [0] if CUDA_VERSION), CUDA_SUPPORT[0])
84
+ cuda_tag = cuda_tag if cuda_tag in CUDA_SUPPORT else CUDA_SUPPORT[0]
85
+ print("\nInstalling Py-Geometric ecosystem...\n")
86
+ if cuda_tag == "cpu":
87
+ url = f"https://data.pyg.org/whl/torch-{torch_version}+cpu.html"
88
+ else:
89
+ url = f"https://data.pyg.org/whl/torch-{torch_version}+{cuda_tag}.html"
90
+
91
+ subprocess.check_call([
92
+ python, "-m", "pip", "install",
93
+ "torch-geometric", "-f", url
94
+ ])
95
+ subprocess.check_call([
96
+ python, "-m", "pip", "install",
97
+ "torch-scatter", "-f", url
98
+ ])
99
+ subprocess.check_call([
100
+ python, "-m", "pip", "install",
101
+ "torch-sparse", "-f", url
102
+ ])
103
+ subprocess.check_call([
104
+ python, "-m", "pip", "install",
105
+ "torch-cluster", "-f", url
106
+ ])
107
+ subprocess.check_call([
108
+ python, "-m", "pip", "install",
109
+ "torch-spline-conv", "-f", url
110
+ ])
111
+
112
+ def install_extras(dali=False, pyg=False):
113
+ if dali:
114
+ install_dali()
115
+ print("NVIDIA DALI installed successfully.")
116
+ if pyg:
117
+ install_pyg()
118
+ print("PyTorch Geometric installed successfully.")
119
+
120
+
121
+ def verify():
122
+ import torch
123
+
124
+ print("\n Verifying installation...\n")
125
+ print("Torch:", torch.__version__)
126
+
127
+ if torch.cuda.is_available():
128
+ print("CUDA available")
129
+ print("GPU:", torch.cuda.get_device_name(0))
130
+ else:
131
+ print("Running on CPU")
132
+
133
+ def setup(dali=False, pyg=False):
134
+ install_torch()
135
+ install_extras(dali=dali, pyg=pyg)
136
+ verify()
137
+
138
+
139
+ # ----------------------------
140
+ # CLI entry
141
+ # ----------------------------
142
+ if __name__ == "__main__":
143
+ import argparse
144
+
145
+ parser = argparse.ArgumentParser()
146
+ parser.add_argument("--dali", action="store_true")
147
+ parser.add_argument("--pyg", action="store_true")
148
+
149
+ args = parser.parse_args()
150
+
151
+ setup(dali=args.dali, pyg=args.pyg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensportslib
3
- Version: 0.1.1.dev1
3
+ Version: 0.1.1.dev3
4
4
  Summary: OpenSportsLib is the professional library, designed for advanced video understanding in sports. It provides state-of-the-art tools for action recognition, spotting, retrieval, and captioning, making it ideal for researchers, analysts, and developers working with sports video data.
5
5
  Author: Jeet Vora
6
6
  Requires-Python: >=3.12
@@ -22,17 +22,8 @@ Requires-Dist: opencv-python
22
22
  Requires-Dist: omegaconf
23
23
  Requires-Dist: timm
24
24
  Requires-Dist: seaborn
25
- Provides-Extra: localization
26
- Requires-Dist: nvidia-dali-cuda120; extra == "localization"
27
- Requires-Dist: cupy-cuda12x; extra == "localization"
28
- Requires-Dist: tabulate; extra == "localization"
29
- Requires-Dist: pytorch-lightning; extra == "localization"
30
- Provides-Extra: py-geometric
31
- Requires-Dist: torch-geometric; extra == "py-geometric"
32
- Requires-Dist: torch-scatter; extra == "py-geometric"
33
- Requires-Dist: torch-sparse; extra == "py-geometric"
34
- Requires-Dist: torch-cluster; extra == "py-geometric"
35
- Requires-Dist: torch-spline-conv; extra == "py-geometric"
25
+ Requires-Dist: tabulate
26
+ Requires-Dist: pytorch-lightning
36
27
  Provides-Extra: test
37
28
  Requires-Dist: pytest; extra == "test"
38
29
  Requires-Dist: pytest-cov; extra == "test"
@@ -6,9 +6,11 @@ pyproject.toml
6
6
  examples/quickstart/basic_classification.py
7
7
  examples/quickstart/basic_localization.py
8
8
  opensportslib/__init__.py
9
+ opensportslib/cli.py
9
10
  opensportslib.egg-info/PKG-INFO
10
11
  opensportslib.egg-info/SOURCES.txt
11
12
  opensportslib.egg-info/dependency_links.txt
13
+ opensportslib.egg-info/entry_points.txt
12
14
  opensportslib.egg-info/requires.txt
13
15
  opensportslib.egg-info/top_level.txt
14
16
  opensportslib/apis/__init__.py
@@ -77,6 +79,7 @@ opensportslib/models/utils/impl/calf.py
77
79
  opensportslib/models/utils/impl/gsm.py
78
80
  opensportslib/models/utils/impl/gtad.py
79
81
  opensportslib/models/utils/impl/tsm.py
82
+ opensportslib/setup/setup.py
80
83
  tests/conftest.py
81
84
  tests/test_config_utils_smoke.py
82
85
  tests/test_package_smoke.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ opensportslib = opensportslib.cli:main
@@ -12,22 +12,11 @@ opencv-python
12
12
  omegaconf
13
13
  timm
14
14
  seaborn
15
-
16
- [:platform_system != "Darwin" and platform_machine != "arm64"]
17
- decord
18
-
19
- [localization]
20
- nvidia-dali-cuda120
21
- cupy-cuda12x
22
15
  tabulate
23
16
  pytorch-lightning
24
17
 
25
- [py-geometric]
26
- torch-geometric
27
- torch-scatter
28
- torch-sparse
29
- torch-cluster
30
- torch-spline-conv
18
+ [:platform_system != "Darwin" and platform_machine != "arm64"]
19
+ decord
31
20
 
32
21
  [test]
33
22
  pytest
@@ -4,19 +4,20 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "opensportslib"
7
- version = "0.1.1.dev1"
7
+ version = "0.1.1.dev3"
8
8
  description = "OpenSportsLib is the professional library, designed for advanced video understanding in sports. It provides state-of-the-art tools for action recognition, spotting, retrieval, and captioning, making it ideal for researchers, analysts, and developers working with sports video data."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
11
- dependencies = [ "SoccerNet", "av", "decord; platform_system != 'Darwin' and platform_machine != 'arm64'", "evaluate", "scikit-learn", "torch", "torchvision", "transformers==4.57.3", "tokenizers==0.22.1", "accelerate", "wandb", "opencv-python", "omegaconf", "timm", "seaborn",]
11
+ dependencies = [ "SoccerNet", "av", "decord; platform_system != 'Darwin' and platform_machine != 'arm64'", "evaluate", "scikit-learn", "torch", "torchvision", "transformers==4.57.3", "tokenizers==0.22.1", "accelerate", "wandb", "opencv-python", "omegaconf", "timm", "seaborn", "tabulate", "pytorch-lightning",]
12
12
  [[project.authors]]
13
13
  name = "Jeet Vora"
14
14
 
15
15
  [project.optional-dependencies]
16
- localization = [ "nvidia-dali-cuda120", "cupy-cuda12x", "tabulate", "pytorch-lightning",]
17
- py-geometric = [ "torch-geometric", "torch-scatter", "torch-sparse", "torch-cluster", "torch-spline-conv",]
18
16
  test = [ "pytest", "pytest-cov",]
19
17
 
18
+ [project.scripts]
19
+ opensportslib = "opensportslib.cli:main"
20
+
20
21
  [tool.setuptools.package-data]
21
22
  opensportslib = [ "opensportslib/config/*.yaml",]
22
23