prpy 0.2.2__tar.gz → 0.2.4__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 (45) hide show
  1. {prpy-0.2.2 → prpy-0.2.4}/PKG-INFO +9 -3
  2. {prpy-0.2.2 → prpy-0.2.4}/README.md +8 -2
  3. {prpy-0.2.2 → prpy-0.2.4}/prpy/ffmpeg/readwrite.py +3 -3
  4. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/face.py +2 -2
  5. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/image.py +1 -1
  6. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/signal.py +2 -2
  7. {prpy-0.2.2 → prpy-0.2.4}/prpy.egg-info/PKG-INFO +9 -3
  8. {prpy-0.2.2 → prpy-0.2.4}/.github/workflows/main.yml +0 -0
  9. {prpy-0.2.2 → prpy-0.2.4}/.gitignore +0 -0
  10. {prpy-0.2.2 → prpy-0.2.4}/LICENSE +0 -0
  11. {prpy-0.2.2 → prpy-0.2.4}/MANIFEST.in +0 -0
  12. {prpy-0.2.2 → prpy-0.2.4}/prpy/__init__.py +0 -0
  13. {prpy-0.2.2 → prpy-0.2.4}/prpy/constants.py +0 -0
  14. {prpy-0.2.2 → prpy-0.2.4}/prpy/ffmpeg/__init__.py +0 -0
  15. {prpy-0.2.2 → prpy-0.2.4}/prpy/ffmpeg/probe.py +0 -0
  16. {prpy-0.2.2 → prpy-0.2.4}/prpy/ffmpeg/utils.py +0 -0
  17. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/__init__.py +0 -0
  18. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/metric.py +0 -0
  19. {prpy-0.2.2 → prpy-0.2.4}/prpy/numpy/stride_tricks.py +0 -0
  20. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/__init__.py +0 -0
  21. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/image.py +0 -0
  22. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/loss.py +0 -0
  23. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/lr_schedule.py +0 -0
  24. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/model_saver.py +0 -0
  25. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/nan.py +0 -0
  26. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/optimizer.py +0 -0
  27. {prpy-0.2.2 → prpy-0.2.4}/prpy/tensorflow/signal.py +0 -0
  28. {prpy-0.2.2 → prpy-0.2.4}/prpy/torch/__init__.py +0 -0
  29. {prpy-0.2.2 → prpy-0.2.4}/prpy/torch/model_saver.py +0 -0
  30. {prpy-0.2.2 → prpy-0.2.4}/prpy.egg-info/SOURCES.txt +0 -0
  31. {prpy-0.2.2 → prpy-0.2.4}/prpy.egg-info/dependency_links.txt +0 -0
  32. {prpy-0.2.2 → prpy-0.2.4}/prpy.egg-info/requires.txt +0 -0
  33. {prpy-0.2.2 → prpy-0.2.4}/prpy.egg-info/top_level.txt +0 -0
  34. {prpy-0.2.2 → prpy-0.2.4}/pyproject.toml +0 -0
  35. {prpy-0.2.2 → prpy-0.2.4}/setup.cfg +0 -0
  36. {prpy-0.2.2 → prpy-0.2.4}/setup.py +0 -0
  37. {prpy-0.2.2 → prpy-0.2.4}/tests/conftest.py +0 -0
  38. {prpy-0.2.2 → prpy-0.2.4}/tests/test_ffmpeg.py +0 -0
  39. {prpy-0.2.2 → prpy-0.2.4}/tests/test_numpy_face.py +0 -0
  40. {prpy-0.2.2 → prpy-0.2.4}/tests/test_numpy_image.py +0 -0
  41. {prpy-0.2.2 → prpy-0.2.4}/tests/test_numpy_metric.py +0 -0
  42. {prpy-0.2.2 → prpy-0.2.4}/tests/test_numpy_signal.py +0 -0
  43. {prpy-0.2.2 → prpy-0.2.4}/tests/test_numpy_stride_tricks.py +0 -0
  44. {prpy-0.2.2 → prpy-0.2.4}/tests/test_tensorflow.py +0 -0
  45. {prpy-0.2.2 → prpy-0.2.4}/tests/test_torch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prpy
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Collection of Python utils for signal, image, and video processing
5
5
  Author-email: Philipp Rouast <philipp@rouast.com>
6
6
  License: MIT License
@@ -47,14 +47,20 @@ It contains subpackages for working with `numpy`, `ffmpeg`, `tensorflow`, and `t
47
47
 
48
48
  General prerequisites are `python>=3.8` and `ffmpeg` installed and accessible via the `$PATH` environment variable.
49
49
 
50
- To install `prpy` and its dependencies:
50
+ The easiest way to install the latest version of `prpy`:
51
+
52
+ ```
53
+ pip install "prpy[ffmpeg,numpy,tensorflow,torch,test]"
54
+ ```
55
+
56
+ Alternatively, it can be done by cloning the source:
51
57
 
52
58
  ```
53
59
  git clone https://github.com/prouast/prpy.git
54
60
  pip install "./prpy[ffmpeg,numpy,tensorflow,torch,test]"
55
61
  ```
56
62
 
57
- The above runs a full install of all dependencies.
63
+ The above run full installs of all dependencies.
58
64
  It is possible to customize the install of the dependencies by only listing the desired subpackages out of `ffmpeg`, `numpy`, `tensorflow`, `torch`, and `test` in the square brackets above.
59
65
 
60
66
  ## Linting and tests
@@ -9,14 +9,20 @@ It contains subpackages for working with `numpy`, `ffmpeg`, `tensorflow`, and `t
9
9
 
10
10
  General prerequisites are `python>=3.8` and `ffmpeg` installed and accessible via the `$PATH` environment variable.
11
11
 
12
- To install `prpy` and its dependencies:
12
+ The easiest way to install the latest version of `prpy`:
13
+
14
+ ```
15
+ pip install "prpy[ffmpeg,numpy,tensorflow,torch,test]"
16
+ ```
17
+
18
+ Alternatively, it can be done by cloning the source:
13
19
 
14
20
  ```
15
21
  git clone https://github.com/prouast/prpy.git
16
22
  pip install "./prpy[ffmpeg,numpy,tensorflow,torch,test]"
17
23
  ```
18
24
 
19
- The above runs a full install of all dependencies.
25
+ The above run full installs of all dependencies.
20
26
  It is possible to customize the install of the dependencies by only listing the desired subpackages out of `ffmpeg`, `numpy`, `tensorflow`, `torch`, and `test` in the square brackets above.
21
27
 
22
28
  ## Linting and tests
@@ -105,7 +105,7 @@ def _ffmpeg_filtering(
105
105
  n: The existing number of frames
106
106
  w: The existing width
107
107
  h: The existing height
108
- target_fps: Try to downsample frames to achieve this framerate (optional)
108
+ target_fps: Downsample frames to approximate this framerate (optional)
109
109
  crop: Coords and sizes for spatial cropping (x, y, width, height) (optional)
110
110
  scale: Size(s) for spatial scaling. Scalar or (width, height) (optional)
111
111
  trim: Frame numbers for temporal trimming (start, end) (optional)
@@ -125,14 +125,14 @@ def _ffmpeg_filtering(
125
125
  assert isinstance(w, int)
126
126
  assert isinstance(h, int)
127
127
  assert target_fps is None or isinstance(target_fps, (float, int))
128
- assert crop is None or (isinstance(crop, tuple) and len(crop) == 4 and all(isinstance(i, int) for i in crop))
128
+ assert crop is None or (isinstance(crop, tuple) and len(crop) == 4 and all(isinstance(i, (int, np.int64)) for i in crop))
129
129
  assert scale is None or isinstance(scale, int) or (isinstance(scale, tuple) and len(scale) == 2 and all(isinstance(i, int) for i in scale))
130
130
  assert trim is None or (isinstance(trim, tuple) and len(trim) == 2 and all(isinstance(i, int) for i in trim))
131
131
  assert isinstance(preserve_aspect_ratio, bool)
132
132
  assert isinstance(scale_algorithm, str)
133
133
  ds_factor = 1
134
134
  if target_fps is not None and target_fps > fps: logging.warn("target_fps should not be greater than fps. Ignoring.")
135
- elif target_fps is not None: ds_factor = int(fps // target_fps)
135
+ elif target_fps is not None: ds_factor = round(fps / target_fps)
136
136
  # Target number of frames
137
137
  target_n = trim[1] - trim[0] if trim is not None else n
138
138
  target_n = int(target_n / ds_factor)
@@ -23,7 +23,7 @@ from prpy.numpy.image import crop_slice_resize
23
23
  from typing import Tuple, Union
24
24
 
25
25
  def _get_roi_from_det(
26
- det: tuple,
26
+ det: Union[tuple, np.ndarray],
27
27
  rel_change: tuple,
28
28
  clip_dims: Union[tuple, None] = None
29
29
  ) -> Tuple[int, int, int, int]:
@@ -36,7 +36,7 @@ def _get_roi_from_det(
36
36
  Returns:
37
37
  out: The roi [0, H/W] in format (x0, y0, x1, y1)
38
38
  """
39
- assert isinstance(det, tuple) and len(det) == 4 and all(isinstance(i, int) for i in det)
39
+ assert isinstance(det, (tuple, np.ndarray)) and len(det) == 4 and all(isinstance(i, (int, np.int64)) for i in det)
40
40
  assert det[2] > det[0]
41
41
  assert det[3] > det[1]
42
42
  assert isinstance(rel_change, tuple) and len(rel_change) == 4 and all(isinstance(i, float) for i in rel_change)
@@ -48,7 +48,7 @@ def crop_slice_resize(
48
48
  """
49
49
  assert isinstance(inputs, np.ndarray) and (len(inputs.shape) == 3 or len(inputs.shape) == 4)
50
50
  assert isinstance(target_size, int) or (isinstance(target_size, (tuple, list)) and len(target_size) == 2 and all(isinstance(i, int) for i in target_size))
51
- assert roi is None or (isinstance(roi, (tuple, list)) and len(roi) == 4 and all(isinstance(i, int) for i in roi) and roi[2] > roi[0] and roi[3] > roi[1])
51
+ assert roi is None or (isinstance(roi, (tuple, list)) and len(roi) == 4 and all(isinstance(i, (int, np.int64)) for i in roi) and roi[2] > roi[0] and roi[3] > roi[1])
52
52
  assert target_idxs is None or isinstance(target_idxs, np.ndarray) or (isinstance(target_idxs, (tuple, list)) and all(isinstance(i, int) for i in target_idxs))
53
53
  assert isinstance(preserve_aspect_ratio, bool)
54
54
  assert isinstance(keepdims, bool)
@@ -231,7 +231,7 @@ def detrend(
231
231
  # Return
232
232
  return proc_z
233
233
 
234
- # TODO write tests
234
+ # TODO(prouast): Write tests
235
235
  def windowed_standardize(
236
236
  x: np.ndarray,
237
237
  window_size: int,
@@ -261,7 +261,7 @@ def windowed_standardize(
261
261
  x /= std
262
262
  return x
263
263
 
264
- # TODO write tests
264
+ # TODO(prouast): Write tests
265
265
  def butter_bandpass(
266
266
  x: np.ndarray,
267
267
  lowcut: Union[int, float],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prpy
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Collection of Python utils for signal, image, and video processing
5
5
  Author-email: Philipp Rouast <philipp@rouast.com>
6
6
  License: MIT License
@@ -47,14 +47,20 @@ It contains subpackages for working with `numpy`, `ffmpeg`, `tensorflow`, and `t
47
47
 
48
48
  General prerequisites are `python>=3.8` and `ffmpeg` installed and accessible via the `$PATH` environment variable.
49
49
 
50
- To install `prpy` and its dependencies:
50
+ The easiest way to install the latest version of `prpy`:
51
+
52
+ ```
53
+ pip install "prpy[ffmpeg,numpy,tensorflow,torch,test]"
54
+ ```
55
+
56
+ Alternatively, it can be done by cloning the source:
51
57
 
52
58
  ```
53
59
  git clone https://github.com/prouast/prpy.git
54
60
  pip install "./prpy[ffmpeg,numpy,tensorflow,torch,test]"
55
61
  ```
56
62
 
57
- The above runs a full install of all dependencies.
63
+ The above run full installs of all dependencies.
58
64
  It is possible to customize the install of the dependencies by only listing the desired subpackages out of `ffmpeg`, `numpy`, `tensorflow`, `torch`, and `test` in the square brackets above.
59
65
 
60
66
  ## Linting and tests
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes