Skip to content

AttributeError: module 'numpy' has no attribute 'float'. #25

@amrzv

Description

@amrzv

Hi.
When running Traffic counting with OpenCV.ipynb notebook the error is raised

Training BG Subtractor...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-3-05c8b4f2588e>](https://localhost:8080/#) in <cell line: 22>()
     20 
     21 # skipping 500 frames to train bg subtractor
---> 22 train_bg_subtractor(bg_subtractor, cap, num=500)
     23 
     24 frame = next(cap)

3 frames
[<ipython-input-3-05c8b4f2588e>](https://localhost:8080/#) in train_bg_subtractor(inst, cap, num)
      5     print ('Training BG Subtractor...')
      6     i = 0
----> 7     for frame in cap:
      8         inst.apply(frame, None, 0.001)
      9         i += 1

[/usr/local/lib/python3.10/dist-packages/skvideo/io/io.py](https://localhost:8080/#) in vreader(fname, height, width, num_frames, as_grey, inputdict, outputdict, backend, verbosity)
    249             outputdict['-pix_fmt'] = 'gray'
    250 
--> 251         reader = FFmpegReader(fname, inputdict=inputdict, outputdict=outputdict, verbosity=verbosity)
    252         try:
    253             for frame in reader.nextFrame():

[/usr/local/lib/python3.10/dist-packages/skvideo/io/ffmpeg.py](https://localhost:8080/#) in __init__(self, filename, inputdict, outputdict, verbosity)
    101             parts = frtxt.split('/')
    102             if len(parts) > 1:
--> 103                 self.inputfps = np.float(parts[0])/np.float(parts[1])
    104             else:
    105                 self.inputfps = np.float(frtxt)

[/usr/local/lib/python3.10/dist-packages/numpy/__init__.py](https://localhost:8080/#) in __getattr__(attr)
    322 
    323         if attr in __former_attrs__:
--> 324             raise AttributeError(__former_attrs__[attr])
    325 
    326         if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

image
... which is due to breaking change in numpy version 1.20.0

Looks like the installation should be done as pip install scikit-video instead of pip install sk-video.
What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions