bgshih/crnn

Issue when creating custom dataset

Closed this issue · 5 comments

Hi everyone,
I wanted to train the model on my own dataset so I followed the instructions as given in the repo. I separated my data into train, test and valid data and fed it into the create_dataset.py given in the repo,

I am using
Python 3.6
OpenCV 3.4.1

I made the required changes to the file to get it working as guided in this thread. and the code starts working. but after creating a few thousand files, it throws the following error. I am using mjsynth dataset.

....
....
Written 689000 / 7224612
Written 690000 / 7224612
Written 691000 / 7224612
Written 692000 / 7224612
Written 693000 / 7224612

error Traceback (most recent call last)
in ()
----> 1 createDataset('lmdb_data/', df_train_path_list, df_train_label_list, lexiconList=None, checkValid=True)

in createDataset(outputPath, imagePathList, labelList, lexiconList, checkValid)
23 imageBin = f.read()
24 if checkValid:
---> 25 if not checkImageIsValid(imageBin):
26 print('%s is not a valid image' % imagePath)
27 continue

in checkImageIsValid(imageBin)
3 return False
4 imageBuf = np.fromstring(imageBin, dtype=np.uint8)
----> 5 img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE)
6 imgH, imgW = img.shape[0], img.shape[1]
7 if imgH * imgW == 0:

error: OpenCV(3.4.1) /io/opencv/modules/imgcodecs/src/loadsave.cpp:731: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_

can anyone please tell me what the problem is? I am not able to figure it out.

I have solved this issue.

Hi @Kumara-Kaushik
I don't know how be should put the labels for images , please put your struct dataset both images and labels for training.

hi @zeynali

What exactly is the problem you are facing? Which dataset are you using and what version of python etc. Please give me more details to help you.

@Kumara-Kaushik Hi.I keep encountering the problem "imageName is not a valid image".How do I solve this?Is there any requirement of the image?

@Kumara-Kaushik
hey how you fix the problem? I am using the same dataset msjsynth and having the same problem you just face.

can share the solution?