nicknochnack / TFODCourse

957 stars 924 forks source link

GenerateTFRecord & Verification script not working MacOS M1 #107

Open kubakakauko opened 2 years ago

kubakakauko commented 2 years ago

!python {files['TF_RECORD_SCRIPT']} -x {os.path.join(paths['IMAGE_PATH'], 'train')} -l {files['LABELMAP']} -o {os.path.join(paths['ANNOTATION_PATH'], 'train.record')} !python {files['TF_RECORD_SCRIPT']} -x {os.path.join(paths['IMAGE_PATH'], 'test')} -l {files['LABELMAP']} -o {os.path.join(paths['ANNOTATION_PATH'], 'test.record')}

Those two lines from jupyter do not generate output for me. No new files are generated in the annotations folder When I try to manually run the script from the terminal it generates

[1] 41968 illegal hardware instruction python generate_tfrecord.py

With running the script in terminal as sudo like (tfod) sh-3.2#: sudo python generate_tfrecord.py -h

Output: Illegal instruction: 4

The Verification script generates no output and when ran in terminal generates same output as the GenerateTFRecord script. In the comment section i've seen other people have same issues.

fbrynpk commented 2 years ago

@kubakakauko I was able to get it running on my M1 device in VS Code, you can take a look at my repo, I wrote the exact same code inside a virtual environment and it works perfectly fine

https://github.com/fbrynpk/CustomObjectDetection

kubakakauko commented 2 years ago

@kubakakauko I was able to get it running on my M1 device in VS Code, you can take a look at my repo, I wrote the exact same code inside a virtual environment and it works perfectly fine

https://github.com/fbrynpk/CustomObjectDetection

That's great thank @fbrynpk you so much. The only question I got is where to download tensorflow_io-0.27.0-cp310-cp310-macosx_10_9_universal2.whl as I think its a local file in your requirements.txt

fbrynpk commented 2 years ago

Hi @kubakakauko ,

This is a very common problem for M1 Machine, you can simply solve this by cloning the tensorflow_io git folder and install directly from there

Here's what I do : $ git clone https://github.com/tensorflow/io.git (Should create an io folder) $ cd io (Change Directory to io) $ python3 setup.py -q bdist_wheel Project: tensorflow-io Exclude: ['tests', 'tests.', 'tensorflow_io_gcs_filesystem', 'tensorflow_io_gcs_filesystem.'] Install Requires: ['tensorflow-io-gcs-filesystem==0.24.0'] Project Rootpath: tensorflow_io /Users/olivierskonieczny/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( (There I get a warning but importing at the end work (also with some weird warnings :) ))

$ python3 -m pip install --no-deps dist/tensorflow_io-0.24.0-cp39-cp39-macosx_11_0_arm64.whl

After all this step has been completed feel free to delete the 'io' folder Steps followed from https://github.com/tensorflow/io/issues/1625