Skip to content

Attribute Error due to depracated Numpy.int #32

@Austral-IV

Description

@Austral-IV

I tried running the Colab Demo, but cell 4 does not run correctly. I did not do any modifications.

The is due to a deprecated numpy method. I tried downgrading to numpy 1.18.5 (which I think was the version originally used?) but that seems to be incompatible tensorflow 2.8 and with the python3.10 environment Colab uses nowadays.

Edit: A similar issue arises with np.float on detection.py and preprocessing.py
Edit2: replaced all deprecated instances on this pull request

Full Error message:

AttributeError                            Traceback (most recent call last)

[<ipython-input-30-9bcf3788091f>](https://localhost:8080/#) in <cell line: 5>()
      3 
      4 # output = None will not save the output video
----> 5 tracker.track_video("./IO_data/input/video/IMG_1172-slow-walk.MP4", output="./IO_data/output/crop-detect.avi", show_live = False, skip_frames = 0, count_objects = True, verbose=1)

3 frames

[/content/yolov7-deepsort-tracking/bridge_wrapper.py](https://localhost:8080/#) in track_video(self, video, output, skip_frames, show_live, count_objects, verbose)
    128 
    129             # ---------------------------------- DeepSORT tacker work starts here ------------------------------------------------------------
--> 130             features = self.encoder(frame, bboxes) # encode detections and feed to tracker. [No of BB / detections per frame, embed_size]
    131             detections = [Detection(bbox, score, class_name, feature) for bbox, score, class_name, feature in zip(bboxes, scores, names, features)] # [No of BB per frame] deep_sort.detection.Detection object
    132 

[/content/yolov7-deepsort-tracking/tracking_helpers.py](https://localhost:8080/#) in encoder(image, boxes)
    135     def encoder(image, boxes):
    136         image_patches = []
--> 137         for box in boxes:
    138             patch = extract_image_patch(image, box, image_shape[:2])
    139             if patch is None:

[/content/yolov7-deepsort-tracking/tracking_helpers.py](https://localhost:8080/#) in extract_image_patch(image, bbox, patch_shape)
     87     # convert to top left, bottom right
     88     bbox[2:] += bbox[:2]
---> 89  bbox = bbox.astype(int)  
     90     

[/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 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
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

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