Pixel2Mesh icon indicating copy to clipboard operation
Pixel2Mesh copied to clipboard

build_cnn18 - inconsistent use of tabs and spaces in indentation

Open tomaszjacek opened this issue 4 years ago • 2 comments

Hi All,

I'm getting an error

Traceback (most recent call last): File "demo.py", line 20, in from p2m.api import GCN File "G:\addOns\Pixel2Mesh-master\p2m\api.py", line 180 x=self.placeholders['img_inp'] ^ TabError: inconsistent use of tabs and spaces in indentation

when I removed '] from line x=self.placeholders['img_inp'] and writed it again I have

Traceback (most recent call last): File "demo.py", line 20, in from p2m.api import GCN File "G:\addOns\Pixel2Mesh-master\p2m\api.py", line 181 x = tf.expand_dims(x, 0) ^ TabError: inconsistent use of tabs and spaces in indentation

Do you have an idea what could be wrong?

Thank you,

tj

tomaszjacek avatar Jun 22 '20 21:06 tomaszjacek

Hello, I have the same problem, as shown in the error message the code uses both tab characters and softtabs (4 tabs in a row) for indentation in the same file. This is not allowed by python, I wrote a script which you find below. It fixes the error by replacing the tabs. Simply run it from the repository root folder (where demo.py is located). But I highly recommend you to not use this repositories code, as it uses deprecated old Tensorflow <= 1.14 and old Python <= 2.7. There are newer implementations using pytorch: https://github.com/noahcao/Pixel2Mesh and https://github.com/Tong-ZHAO/Pixel2Mesh-Pytorch But fixing this code would be nice as above code is only available to CUDA as it seems. Greetings, MrMois

Script:

import os

NUMSPACES = 4

for (path, dirs, files) in os.walk('.'):

for file in files:

    if(file[-3:] == '.py'):

        print('Currently at: %s\\%s' % (path, file))

        str = ''

        with open(path + '\\' + file, 'r+') as fHandle:

            str = fHandle.read()

            if '\t' in str:

                if '  ' in str:
                    print('Found tabs and doublespaces, yay!')
                else:
                    print('Found tabs...')

                str = str.replace('\t', ' ' * NUMSPACES)

                # Goto file start
                fHandle.seek(0)
                fHandle.write(str)

                print('Replaces tabs with %i whitespaces.' % NUMSPACES)

            else:
                print('Ok.')

        print('---------')

MrMois avatar Jun 23 '20 10:06 MrMois

Hi, Do you know how to download the dataset and unzip it?

zshyang avatar Sep 15 '20 20:09 zshyang