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 2019/02/19 12:59:42 UTC
[GitHub] jasperDD opened a new issue #14204: can't create rec file im2rec in
python
jasperDD opened a new issue #14204: can't create rec file im2rec in python
URL: https://github.com/apache/incubator-mxnet/issues/14204
i do as shown here https://github.com/apache/incubator-mxnet/issues/14164
import mxnet
test='C:/Users/Admin/Desktop/test.lst' # folder where must be my test.lst
DataSet='C:/Users/Admin/Downloads/mypic/' # folder with my pictures (20 pics)
then when i try
data_iter = mx.image.ImageIter(
batch_size=4,
data_shape=(3,816, 1232),
label_width=1,
path_imglist='test.lst',
path_root='DataSet')
for data in data_iter:
d = data.data[0]
break
here error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'data_iter' is not defined
>>>
then
img =nd.transpose(d,(0,2,3,1))
print(img.shape)
io.imshow(img[0].asnumpy().astype(np.uint8))
io.show()
and the errors
>>> img =nd.transpose(d,(0,2,3,1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'nd' is not defined
>>> print(img.shape)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'img' is not defined
>>> io.imshow(img[0].asnumpy().astype(np.uint
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'io' is not defined
>>> io.show()
when i try create step 2. make .rec file
train_iter = mx.image.ImageIter(
batch_size=32,
data_shape=(3, 816, 1232),
path_imgrec='data.rec',
path_imgidx='data.idx', #help shuffle performance
shuffle=True,
aug_list=[mx.image.HorizontalFlipAug(0.5)]
)
train_iter.reset()
for batch in train_iter:
x = batch.data[0]
break
img =nd.transpose(x,(0,2,3,1))
print(img.shape)
io.imshow(img[0].asnumpy().astype(np.uint8))
io.show()
i get the error
test='C:/Users/Admin/Desktop/test.rec'
Dataset='C:/Users/Admin/Downloads/mypic'
>>> train_iter = mx.image.ImageIter(
... batch_size=32,
... data_shape=(3, 816, 1232),
... path_imgrec='data.rec',
... path_imgidx='data.idx', #help shuffle performance
... shuffle=True,
... aug_list=[mx.image.HorizontalFlipAug(0.5)]
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'mx' is not defined
>>>
>>>
... train_iter.reset()
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
NameError: name 'train_iter' is not defined
>>> for batch in train_iter:
... x = batch.data[0]
... break
...
... img =nd.transpose(x,(0,2,3,1))
File "<stdin>", line 5
img =nd.transpose(x,(0,2,3,1))
^
SyntaxError: invalid syntax
>>> print(img.shape)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'img' is not defined
>>> io.imshow(img[0].asnumpy().astype(np.uint8))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'io' is not defined
>>> io.show()
How to fix these errors to create .lst and .rec file?
here example of one of my picture form mypic
https://github.com/apache/incubator-mxnet/blob/master/example/captcha/captcha_example.png
----------------------------------------------------------------
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