Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help! - AsserstionError - not a valid directory / randrange() (0,0, 0) #376

Closed
ArchitectTaeyoon opened this issue Sep 11, 2018 · 13 comments
Closed

Comments

@ArchitectTaeyoon
Copy link

I have manually downloaded the maps dataset,
and ran the train command in Anaconda3 prompt (Windows 10 64bit).
I get the following error -

Traceback (most recent call last): File "train.py", line 9, in <module> data_loader = CreateDataLoader(opt) File "C:\Users\tyk12\Documents\2_CODE\pix2pix\pytorch-CycleGAN-and-pix2pix\data\__init__.py", line 46, in CreateDataLoader data_loader.initialize(opt) File "C:\Users\tyk12\Documents\2_CODE\pix2pix\pytorch-CycleGAN-and-pix2pix\data\__init__.py", line 58, in initialize self.dataset = create_dataset(opt) File "C:\Users\tyk12\Documents\2_CODE\pix2pix\pytorch-CycleGAN-and-pix2pix\data\__init__.py", line 39, in create_dataset instance.initialize(opt) File "C:\Users\tyk12\Documents\2_CODE\pix2pix\pytorch-CycleGAN-and-pix2pix\data\unaligned_dataset.py", line 19, in initialize self.A_paths = make_dataset(self.dir_A) File "C:\Users\tyk12\Documents\2_CODE\pix2pix\pytorch-CycleGAN-and-pix2pix\data\image_folder.py", line 26, in make_dataset assert os.path.isdir(dir), '%s is not a valid directory' % dir AssertionError: ./datasets/maps/trainA is not a valid directory

Thank you in advance!

@junyanz
Copy link
Owner

junyanz commented Sep 11, 2018

Two possible reasons: (1) Maybe you haven't placed the dataset in the path ./datasets/maps/trainA. (2) I haven't used Windows for a long time. Maybe you want to replace the / by \ in the path.

@ArchitectTaeyoon ArchitectTaeyoon changed the title Help me with this error please - AsserstionError - not a valid directory Help! - AsserstionError - not a valid directory Sep 12, 2018
@ArchitectTaeyoon
Copy link
Author

ArchitectTaeyoon commented Sep 12, 2018

Thank you ! After sorting out the file directory like you mentioned, it moved on :)

The training process started, but then I ran into 4 exceptions and 1 connection error -

  1. ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

  2. urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001B7122DDDD8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

  3. urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001B7122DDDD8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

  4. File "C:\Users\tyk12\Anaconda3\lib\site-packages\requests\adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001B7122DDDD8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

  5. ConnectionError: Error connecting to Visdom server

When I trigger visdom command, the Visdom browser window pops up fine.

I am going through Q&A, and google-searching to solve the issues one by one :)

@junyanz
Copy link
Owner

junyanz commented Sep 12, 2018

Please look at the Q & A.

@ArchitectTaeyoon
Copy link
Author

Oooooh... I never thought about having 2 anaconda prompt windows open!
one for Visdom and one for training... Sorry and thanks!

Now I ran into a new error;
ValueError: empty range for randrange() (0,0, 0)

I am referring to issue #194

@ArchitectTaeyoon
Copy link
Author

ArchitectTaeyoon commented Sep 12, 2018

I tried adding --loadSize 143 --fineSize 128

and I still get the same error;

    index_B = random.randint(0, self.B_size - 1)
  File "C:\Users\tyk12\Anaconda3\lib\random.py", line 221, in randint
    return self.randrange(a, b+1)
  File "C:\Users\tyk12\Anaconda3\lib\random.py", line 199, in randrange
    raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)

Thank you for helping me along the way :)
I got to learn a lot.
I think I am almost there..!

@ArchitectTaeyoon ArchitectTaeyoon changed the title Help! - AsserstionError - not a valid directory Help! - AsserstionError - not a valid directory / randrange() (0,0, 0) Sep 12, 2018
@junyanz
Copy link
Owner

junyanz commented Sep 13, 2018

I don't know the solution. The command python train.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan works for me on my Linux. The code has not been tested on Windows.

@ArchitectTaeyoon
Copy link
Author

Okay thanks for looking into it 👍

Maybe I should try docker.

@ArchitectTaeyoon
Copy link
Author

Got this to run in Windows properly now!

I changed the directories in image_folder.py, and downgraded the version of visdom.

Thanks again ! :)

@kumarballapavan
Copy link

Got this to run in Windows properly now!

I changed the directories in image_folder.py, and downgraded the version of visdom.

Thanks again ! :)

How do you change the directories in image_folder.py! Can you kindly explain with code? Also could you kindly guide me how to downgrade the visdom's version using pip!

@junyanz
Copy link
Owner

junyanz commented Jul 29, 2020

You can change the data directories using dataroot. See this line. For pip usage, refer to this webpage.

@kumarballapavan
Copy link

AssertionError: ./datasets/dehazing\train is not a valid directory

Can you kindly help me to fix this error!

@junyanz
Copy link
Owner

junyanz commented Jul 30, 2020

I think Windows has a different path format compared to Linux. Try something like .\datasets\dehazing\train.

@zhushuqi2333
Copy link

AssertionError: ./datasets/dehazing\train is not a valid directory

Can you kindly help me to fix this error!

I have the same question, have you ever solved this problem? can you kindly help me to fix this error? thank you!

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

No branches or pull requests

4 participants