Coder Social home page Coder Social logo

leocvml / mxnet-im2rec_tutorial Goto Github PK

View Code? Open in Web Editor NEW
100.0 3.0 15.0 748 KB

this simple tutorial will introduce how to use im2rec for mx.image.ImageIter , ImageDetIter and how to use im2rec for COCO DataSet

Python 100.00%
mxnet gluon im2rec cocodataset

mxnet-im2rec_tutorial's Issues

How fix any erros whuch i get creating im2rec

from skimage import io

test='C:\Users\Admin\Desktop\test.lst' # folder where must be my test.lst

test='C:/Users/Admin/Desktop/test.lst'
DataSet='C:/Users/Admin/Downloads/mypic/'

data_iter = mx.image.ImageIter(
batch_size=4,
data_shape=(3,816, 1232),
label_width=4,
path_imglist='C:/Users/Admin/Desktop/test.lst',
path_root='DataSet')

for data in data_iter: d = data.data[0]
break

Error

for data in data_iter: d = data.data[0]
... break
File "", line 2
break
^
SyntaxError: invalid syntax

=================================

then

import numpy as nd
img =nd.transpose(d,(0,2,3,1))

===== Error
Traceback (most recent call last):
File "", line 1, in
NameError: name 'd' is not defined

d
Traceback (most recent call last):
File "", line 1, in
NameError: name 'd' is not defined

train_iter = mx.image.ImageIter(
... batch_size=32,
... data_shape=(3, 816, 1232),
... path_imgrec='C:/Users/Admin/Downloads/mypic/data.rec',
... path_imgidx='C:/Users/Admin/Downloads/mypic/data.idx', #help shuffle perform
ance
... shuffle=True,
... aug_list=[mx.image.HorizontalFlipAug(0.5)]
... )

============i get next errors
Traceback (most recent call last):
File "", line 7, in
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\image\image.py", line 1061, in init
self.imgrec = recordio.MXIndexedRecordIO(path_imgidx, path_imgrec, 'r') # p
ylint: disable=redefined-variable-type
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\recordio.py", line 199, in init
super(MXIndexedRecordIO, self).init(uri, flag)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\recordio.py", line 69, in init
self.open()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\recordio.py", line 202, in open
super(MXIndexedRecordIO, self).open()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\recordio.py", line 77, in open
check_call(_LIB.MXRecordIOReaderCreate(self.uri, ctypes.byref(self.handle)))

File "C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packag
es\mxnet\base.py", line 149, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [17:17:32] C:\projects\mxnet-distro-win\mxnet-build\3rdpa
rty\dmlc-core\src\io\local_filesys.cc:166: Check failed: allow_null LocalFileSy
stem::Open "C:/Users/Admin/Downloads/mypic/data.rec": No such file or directory

... train_iter.reset()
Traceback (most recent call last):
File "", line 2, in
TypeError: reset() missing 1 required positional argument: 'self'

How to fix it?

Multiprocessing not available, fall back to single threaded encoding imread read blank (None) image for file: /home/opencv/–center-crop/Downloads/img/h_101.jpg

When i try create .rec files using im2rec.py
github.com
apache/incubator-mxnet/blob/master/tools/im2rec.py
i get these errors,what does it mean and how to fix

machine:~$ python Downloads/im2rec.py Downloads/train –center-crop --resize 224 --pack-label
Creating .rec file from /home/opencv/Downloads/train/dog.lst in /home/opencv/Downloads/train
multiprocessing not available, fall back to single threaded encoding
imread read blank (None) image for file: /home/opencv/–center-crop/Downloads/img/h_101.jpg
Traceback (most recent call last):
File “Downloads/im2rec.py”, line 386, in
record.write_idx(item[0], s)
File “/home/opencv/.local/lib/python2.7/site-packages/mxnet/recordio.py”, line 285, in write_idx
self.write(buf)
File “/home/opencv/.local/lib/python2.7/site-packages/mxnet/recordio.py”, line 135, in write
ctypes.c_size_t(len(buf))))
TypeError: object of type ‘NoneType’ has no len()

how to run generate dataset.lst code

hi, thank you for your nice code. i am a newbie in programming, would you please tell me more about how to run the generate dataset.lst code properly?
i have image stored under train folder, with images named as id_1_labels_[95, 66, 137, 70, 20].jpg. inside [] are the label of the image. i tried to run the generate dataset.lst code as:
python lstgen.py /Users/Anna/.kaggle/competitions/imaterialistchallengefashion2018/train
but the .lst file doesn't look right. thank you for your valuable help.

Im2rec.py: error: unrecognized arguments TRUE

I want create .rec file (ubuntu 18)
So i have im2rec.py
then traim with .lst
i do so

python /home/Downloads/im2rec.py /home/Downloads/train ’ --center-crop True --resize 224 --pack-label True
and then get this error
im2rec.py: error: unrecognized arguments TRUE
How to fix it?

pencv@opencv-virtual-machine:~$ python /home/opencv/Downloads/im2rec.py /home/opencv/train . --resize 224 --pack-label True
usage: im2rec.py [-h] [–list] [–exts EXTS [EXTS …]] [–chunks CHUNKS]
[–train-ratio TRAIN_RATIO] [–test-ratio TEST_RATIO]
[–recursive] [–no-shuffle] [–pass-through]
[–resize RESIZE] [–center-crop] [–quality QUALITY]
[–num-thread NUM_THREAD] [–color {-1,0,1}]
[–encoding {.jpg,.png}] [–pack-label]
prefix root
im2rec.py: error: unrecognized arguments: True

my file taken from i didn edit it
https://github.com/apache/incubator-mxnet/blob/master/tools/im2rec.py

Encounter sample with no valid label

你好,我按照你的方法制作了多目标检测的.rec和.idx文件,但是读取的时候出现 Encounter sample with no valid label 错误,能帮我看一下吗?多谢了
这是我生成.lst文件的程序
with open('dataset/dataset.lst', 'w+') as f:
----f.truncate()
----for i in range(len(labels)):
--------lst = str(i) + '\t' + str(4) + '\t' + str(5) + '\t' + str(1360) + '\t' + str(800) + '\t'
--------for label in labels[i]:
------------lst += str(label[4]) + '\t' + str(round(label[0]/1360, 4)) + '\t' + str(round(label[1]/800,4)) + '\t'
------------lst += str(round(label[2]/1360,4)) + '\t' +str(round(label[3]/800,4)) + '\t'
--------lst += str(i).zfill(5) + '.jpg\n'
--------f.write(lst)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.