yolo-tiling icon indicating copy to clipboard operation
yolo-tiling copied to clipboard

Fails to load bounding box file.

Open Kickjaw opened this issue 3 years ago • 12 comments

Hi,

when I run this script it fails to load in the bounding box file that I have. I have attached the file.

3.txt

Kickjaw avatar Aug 27 '21 16:08 Kickjaw

Hi. What error messages does it show? You need to have the same number of images and corresponding annotation files. For file 3.txt you need an image with the name 3.jpg

slanj avatar Aug 27 '21 16:08 slanj

Hi, I get this error, NULL byte detected. This byte cannot be processed in Python's native csv library at the moment, so please pass in engine='c' instead

I have played around with different operators, delimiter, engine and lower memory but nothing seems to get it to work.

currently I am just trying to split one image 3.jpg which is in the correct folder location

Kickjaw avatar Aug 27 '21 17:08 Kickjaw

What version of Python and Pandas are you using? I have downloaded your file and opened it without problem.

slanj avatar Aug 27 '21 17:08 slanj

I am using python 3.8.8 64 bit through anaconda and pandas 1.2.4

Kickjaw avatar Aug 27 '21 17:08 Kickjaw

I use more old versions. Python 3.6.9 and Pandas 1.1.5 But I think the problem is in your file encoding. Try to resave it.

slanj avatar Aug 27 '21 17:08 slanj

if you can open it doen't that mean its not the file encoding?

Kickjaw avatar Aug 27 '21 19:08 Kickjaw

If I can open it - it means, that there are no problems in attached file. Try to download it, save and test in separate environment.

slanj avatar Aug 27 '21 20:08 slanj

Hi, I am starting to think it has something to do with how it is creating the file path to get to that file. I created a test python file with import pandas as pd

test = pd.read_csv('yolosample/ts/3.txt', sep=' ', names=['class', 'x1', 'y1', 'w', 'h'])

print(test)

and it loaded file txt file just fine.

I am running all of this on windows 10 if that makes a differnce.

Kickjaw avatar Aug 28 '21 11:08 Kickjaw

Hello I think my issue is arising in imnames = glob.glob(f'{args.source}/{args.ext}') labnames = glob.glob(f'{args.source}/.txt')

from what I can understand glob is used for a unix file system and because I am running this on windows the resulting file path does not work. I need to find a replacement for this functions to do this for windows file structure.

Kickjaw avatar Aug 28 '21 13:08 Kickjaw

As I know, glob.glob works in Windows. But path will be different --- glob.glob(f'{args.source}\{args.ext}') Or you can use os.path.join()

In any case I haven't tested this script in Windows.

slanj avatar Aug 28 '21 14:08 slanj

Hi! Did you find the replacement?

gikas1 avatar Mar 01 '22 20:03 gikas1

https://www.geeksforgeeks.org/how-to-install-glob-in-python-in-windows/

You can install glob on windows.

aymuos15 avatar Jul 27 '23 16:07 aymuos15