You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/03 07:13:09 UTC
[GitHub] sandipmgiri opened a new issue #12021: UnboundLocalError: local
variable 'label' referenced before assignment
sandipmgiri opened a new issue #12021: UnboundLocalError: local variable 'label' referenced before assignment
URL: https://github.com/apache/incubator-mxnet/issues/12021
## Description
Following 2 tests are failing with error `UnboundLocalError: local variable 'label' referenced before assignment`
1. tests/python/unittest/test_image.py::TestImage::test_det_augmenters <- /mxnet/tests/python/unittest/test_image.py FAILED
2. tests/python/unittest/test_image.py::TestImage::test_image_detiter <- /mxnet/tests/python/unittest/test_image.py FAILED
## Environment info (Required)
ubuntu:16.04 (x86)
Python 2.7.12
numpy 1.15.0
```
What to do:
1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
2. Run the script using `python diagnose.py` and paste its output here.
----------Python Info----------
('Version :', '2.7.12')
('Compiler :', 'GCC 5.4.0 20160609')
('Build :', ('default', 'Dec 4 2017 14:50:18'))
('Arch :', ('64bit', 'ELF'))
------------Pip Info-----------
('Version :', '18.0')
('Directory :', '/usr/local/lib/python2.7/dist-packages/pip')
----------MXNet Info-----------
/usr/lib/python2.7/dist-packages/scipy/stats/morestats.py:16: DeprecationWarning: Importing from numpy.testing.decorators is deprecated, import from numpy.testing instead.
from numpy.testing.decorators import setastest
('Version :', '1.3.0')
('Directory :', '/mxnet/python/mxnet')
Hashtag not found. Not installed from pre-built package.
----------System Info----------
('Platform :', 'Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial')
('system :', 'Linux')
('node :', '445fd99b7e00')
('release :', '4.4.0-116-generic')
('version :', '#140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018')
----------Hardware Info----------
('machine :', 'x86_64')
('processor :', 'x86_64')
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Model name: Intel Xeon E312xx (Sandy Bridge)
Stepping: 1
CPU MHz: 2399.970
BogoMIPS: 4799.94
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm retpoline kaiser vnmi ept xsaveopt
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0235 sec, LOAD: 1.4152 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0135 sec, LOAD: 2.6120 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0221 sec, LOAD: 1.5329 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.1229 sec, LOAD: 1.3467 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.3364 sec, LOAD: 1.0559 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 1.0087 sec, LOAD: 1.1898 sec.
```
Package used (Python/R/Scala/Julia):
(I'm using Python...)
## Build info (Required if built from source)
Compiler (gcc/clang/mingw/visual studio):
gcc
MXNet commit hash:
(Paste the output of `git rev-parse HEAD` here.)
564e01acdf460535d4ab7340db39b0d10028b453
Build config:
(Paste the content of config.mk, or the build command.)
```
git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet
cd mxnet
make -j $(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_PROFILER=1
rm -r build
cd python
sudo pip install --upgrade pip
sudo pip install -e .
cd ..
python -m pytest -v tests/python/unittest
```
(Paste the complete error message, including stack trace.)
**$ python -m pytest -v tests/python/unittest/test_image.py::TestImage::test_image_detiter**
```
========================================================================= test session starts ==========================================================================
platform linux2 -- Python 2.7.12, pytest-3.7.0, py-1.5.4, pluggy-0.7.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /mxnet, inifile:
collected 1 item
tests/python/unittest/test_image.py::TestImage::test_image_detiter FAILED [100%]
=============================================================================== FAILURES ===============================================================================
_____________________________________________________________________ TestImage.test_image_detiter _____________________________________________________________________
self = <test_image.TestImage testMethod=test_image_detiter>
def test_image_detiter(self):
im_list = [_generate_objects() + [x] for x in TestImage.IMAGES]
> det_iter = mx.image.ImageDetIter(2, (3, 300, 300), imglist=im_list, path_root='')
tests/python/unittest/test_image.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python/mxnet/image/detection.py:682: in __init__
label_shape = self._estimate_label_shape()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <mxnet.image.detection.ImageDetIter object at 0x7fdebefab290>
def _estimate_label_shape(self):
"""Helper function to estimate label shape"""
max_count = 0
self.reset()
try:
while True:
label, _ = self.next_sample()
label = self._parse_label(label)
max_count = max(max_count, label.shape[0])
except StopIteration:
pass
self.reset()
> return (max_count, label.shape[1])
E UnboundLocalError: local variable 'label' referenced before assignment
python/mxnet/image/detection.py:708: UnboundLocalError
======================================================================= 1 failed in 2.54 seconds ==============================================
```
**$ python -m pytest -v tests/python/unittest/test_image.py::TestImage::test_det_augmenters**
```
========================================================================= test session starts ==========================================================================
platform linux2 -- Python 2.7.12, pytest-3.7.0, py-1.5.4, pluggy-0.7.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /mxnet, inifile:
collected 1 item
tests/python/unittest/test_image.py::TestImage::test_det_augmenters FAILED [100%]
=============================================================================== FAILURES ===============================================================================
____________________________________________________________________ TestImage.test_det_augmenters _____________________________________________________________________
self = <test_image.TestImage testMethod=test_det_augmenters>
def test_det_augmenters(self):
# only test if all augmenters will work
# TODO(Joshua Zhang): verify the augmenter outputs
im_list = [_generate_objects() + [x] for x in TestImage.IMAGES]
det_iter = mx.image.ImageDetIter(2, (3, 300, 300), imglist=im_list, path_root='',
resize=640, rand_crop=1, rand_pad=1, rand_gray=0.1, rand_mirror=True, mean=True,
std=np.array([1.1, 1.03, 1.05]), brightness=0.1, contrast=0.1, saturation=0.1,
pca_noise=0.1, hue=0.1, inter_method=10, min_object_covered=0.5,
aspect_ratio_range=(0.2, 5), area_range=(0.1, 4.0), min_eject_coverage=0.5,
> max_attempts=50)
tests/python/unittest/test_image.py:220:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python/mxnet/image/detection.py:682: in __init__
label_shape = self._estimate_label_shape()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <mxnet.image.detection.ImageDetIter object at 0x7f6c9d664290>
def _estimate_label_shape(self):
"""Helper function to estimate label shape"""
max_count = 0
self.reset()
try:
while True:
label, _ = self.next_sample()
label = self._parse_label(label)
max_count = max(max_count, label.shape[0])
except StopIteration:
pass
self.reset()
> return (max_count, label.shape[1])
E UnboundLocalError: local variable 'label' referenced before assignment
python/mxnet/image/detection.py:708: UnboundLocalError
======================================================================= 1 failed in 1.93 seconds ===========
```
## Steps to reproduce
(Paste the commands you ran that produced the error.)
1. python -m pytest -v tests/python/unittest/test_image.py::TestImage::test_image_detiter
2. python -m pytest -v tests/python/unittest/test_image.py::TestImage::test_det_augmenters
## What have you tried to solve it?
Tried installing different numpy version, but still these 2 tests are failing.
Looks like configuration/dependency issue. Any inputs would be appreciated. Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services