SKTBrain / DiscoGAN

Official implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"
773 stars 171 forks source link

Error : #13

Open neelkadia-zz opened 7 years ago

neelkadia-zz commented 7 years ago
dataset_path = './datasets/'
celebA_path = os.path.join(dataset_path, 'celebA')
handbag_path = os.path.join(dataset_path, 'edges2handbags')
shoe_path = os.path.join(dataset_path, 'edges2shoes')
facescrub_path = os.path.join(dataset_path, 'fonts')
chair_path = os.path.join(dataset_path, 'rendered_chairs')
face_3d_path = os.path.join(dataset_path, 'PublicMM1', '05_renderings')
face_real_path = os.path.join(dataset_path, 'real_face')
car_path = os.path.join(dataset_path, 'data', 'cars')

def shuffle_data(da, db):
    a_idx = range(len(da))
    np.random.shuffle( a_idx )

    b_idx = range(len(db))
    np.random.shuffle(b_idx)

    shuffled_da = np.array(da)[ np.array(a_idx) ]

Giving error on the last line :


Traceback (most recent call last):
  File "./discogan/image_translation.py", line 314, in <module>
    main()
  File "./discogan/image_translation.py", line 181, in main
    data_style_A, data_style_B = shuffle_data( data_style_A, data_style_B)
  File "/Users/kadia/Desktop/DiscoGAN-master/discogan/dataset.py", line 27, in shuffle_data
    shuffled_da = np.array(da)[ np.array(a_idx) ]
IndexError: arrays used as indices must be of integer (or boolean) type
shadow111 commented 6 years ago

i think it's something related to the n_test argument in image_translation.py, by default they are 200 so you have to be sure that your dataset contain more than 200 image or you have to change it. i got the same error for my dataset(197 images) i change it to 10 and the training works very well. Best