Darkflow: Not detects my dataset and ZeroDivisionError: division by zero

Created on 17 Aug 2018  ·  4Comments  ·  Source: thtrieu/darkflow

I'm trying to train my own dataset with my annotations using this command:
python flow --model cfg/tiny-yolo-voc-4c.cfg --load bin/tiny-yolo-voc.weights --train --annotation custom/annotations --dataset custom/all --gpu 0.8 --epoch 500

my annotations folder(all xml)
my dataset folder (all jpg)

Error :

Statistics:
Dataset size: 0
Dataset of 0 instance(s)
Traceback (most recent call last):
  File "flow", line 6, in <module>
    cliHandler(sys.argv)
  File "C:\Users\msi\Desktop\VSCode Folder\AI Stuff\YOLO Darkflow\darkflow-gpu\darkflow\cli.py", line 33, in cliHandler
    print('Enter training ...'); tfnet.train()
  File "C:\Users\msi\Desktop\VSCode Folder\AI Stuff\YOLO Darkflow\darkflow-gpu\darkflow\net\flow.py", line 39, in train
    for i, (x_batch, datum) in enumerate(batches):
  File "C:\Users\msi\Desktop\VSCode Folder\AI Stuff\YOLO Darkflow\darkflow-gpu\darkflow\net\yolo\data.py", line 102, in shuffle
    batch_per_epoch = int(size / batch)
ZeroDivisionError: division by zero

Most helpful comment

@naren142 Yeah I fixed the issue the same day I created this issue with printing processed images while make it train.
I also changed this line of code at darkflow/utils/pascal_voc_clean_xml.py. (line 22) to:
annotations = glob.glob('*.xml')

The error caused by an annotation without data. (there is an annotation for the image but image is gone) I deleted that annotation.xml then it worked! Thanks!

All 4 comments

I am getting the same error. Tried to retrain using VOC dataset. Did you manage to resolve it ?

Statistics:
Dataset size: 0
Dataset of 0 instance(s)
Traceback (most recent call last):
  File "/usr/local/bin/flow", line 6, in <module>
    cliHandler(sys.argv)
  File "/videoEval/darkflow/darkflow/cli.py", line 29, in cliHandler
    print('Enter training ...'); tfnet.train()
  File "/videoEval/darkflow/darkflow/net/flow.py", line 39, in train
    for i, (x_batch, datum) in enumerate(batches):
  File "/videoEval/darkflow/darkflow/net/yolo/data.py", line 102, in shuffle
    batch_per_epoch = int(size / batch)
ZeroDivisionError: division by zero

@humanova in the "darkflow/darkflow/net/yolov2/data.py" try printing the path of the image,then you will get to know what is the mistake there..!! See the following code.

jpg = chunk[0]; w, h, allobj_ = chunk[1]
allobj = deepcopy(allobj_)
path = os.path.join(self.FLAGS.dataset, jpg)
**print("Processed : {}".format(path))**
img = self.preprocess(path, allobj)

@naren142 Yeah I fixed the issue the same day I created this issue with printing processed images while make it train.
I also changed this line of code at darkflow/utils/pascal_voc_clean_xml.py. (line 22) to:
annotations = glob.glob('*.xml')

The error caused by an annotation without data. (there is an annotation for the image but image is gone) I deleted that annotation.xml then it worked! Thanks!

Had the same issue. Figured out that darkflow needed xml files rather than txt annotations.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pribadihcr picture pribadihcr  ·  5Comments

hrshovon picture hrshovon  ·  5Comments

borasy picture borasy  ·  3Comments

wonny2001 picture wonny2001  ·  4Comments

Kowasaki picture Kowasaki  ·  4Comments