Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

impossible to save : float division by zero #462

Open
lucydjo opened this issue Apr 17, 2019 · 3 comments
Open

impossible to save : float division by zero #462

lucydjo opened this issue Apr 17, 2019 · 3 comments

Comments

@lucydjo
Copy link

lucydjo commented Apr 17, 2019

Hi,

Does not want to record labels. I have tried with several versions, nothing works.
How to fix ?

I only have two very large images. High-precision satellite photo (15kX15k). I have to get more than 1000 labels per photo

Img: C:\Users\wkn\Documents\IA\ortoIA\images\png5ca3a3d5e5635f000690af6b.png -> Its txt: C:\Users\wkn\Documents\IA\ortoIA\labels\png5ca3a3d5e5635f000690af6b.txt
Traceback (most recent call last):
  File "<string>", line 1291, in saveFile
  File "<string>", line 1320, in _saveFile
  File "<string>", line 808, in saveLabels
  File "Z:\home\darrenl\tmp\labelImg\build-tools\build\labelImg\out00-PYZ.pyz\libs.labelFile", line 83, in saveYoloFormat
  File "Z:\home\darrenl\tmp\labelImg\build-tools\build\labelImg\out00-PYZ.pyz\libs.yolo_io", line 64, in save
  File "Z:\home\darrenl\tmp\labelImg\build-tools\build\labelImg\out00-PYZ.pyz\libs.yolo_io", line 36, in BndBox2YoloLine
ZeroDivisionError: float division by zero

Thx !

  • Windows 10 64
  • 3.7:
@erquren
Copy link

erquren commented Aug 13, 2019

can you show your xml file?because its mean your size is zero

@DynamicCodes
Copy link

i faced the same problem, this happens due to transparency in the some images, i dnt know what kind of transparency is this,......but it can be solved by opening the image with opencv and saving it again, it worked for me.

i wrote this python file :--

import cv2
import os

def loadImages(path = "."):

return [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.jpg')]

filenames = loadImages()
images = []
for file in filenames:
images.append(cv2.imread(file, cv2.IMREAD_UNCHANGED))

num = 0
for image in images:
cv2.imwrite(str(num)+".jpg",image)
num += 1

it will open every file in the directory and save it again!!

@kit57
Copy link

kit57 commented Apr 30, 2020

What image format are you labelling? I had the same error when I was labelling .png images. It only worked for me with .jpg images.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants