aws / aws/amazon-sagemaker-examples

object_detection_birds - numpy depency issue

Open
#4,560 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/object_detection_birds/object_detection_birds.ipynb

**Describe the bug**
In this notebook, it is using im2rec.py to create the RecordIO files. However, mxnet, used there, depends on an older version of numpy which is no longer supported. This leads to this error:

AttributeError: module 'numpy' has no attribute 'bool'

Change cell 1 from:

```
# These packages are needed to use OpenCV in Studio as of February 2022
! pip install distro
import distro
if "debian" in distro.linux_distribution()[0].lower():
! apt-get update
! apt-get install ffmpeg libsm6 libxext6 -y
```

To:

```
# These packages are needed to use OpenCV in Studio as of February 2022
! pip install distro
# We need to downgrade numpy because it otherwise interferes with mxnet, which is used in the im2rec.py script (generates model input):
!python -m pip install numpy==1.23.1
import distro
if "debian" in distro.name().lower():
! pip install --upgrade pip
! apt-get update
! apt-get install ffmpeg libsm6 libxext6 -y
```

Fixes the issue (and removes an error log on distro.linux_distribution).

**To reproduce**
Load the repo into Sagemaker running the Data Science 3.0 python3 kernel using ml.t3.medium.

**Logs**
If applicable, add logs to help explain your problem.
You may also attach an `.ipynb` file to this issue if it includes relevant logs or output.

ps. mxnet has been archived and therefore I do not expect any updates there.

Contributor guide

Open the contributing guide

Research direction

Open introduction_to_amazon_algorithms/object_detection_birds/object_detection_birds.ipynb and inspect cell 1. Reproduce it in the SageMaker Data Science 3.0 Python 3 kernel on ml.t3.medium, then apply the requested dependency and distro changes. Done means the notebook can generate RecordIO files without the numpy.bool error or the distro.linux_distribution error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, numpy
Domain
machine-learning
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.