ElieAljalbout / Clustering-with-Deep-learning

Generic implementation for clustering with deep learning : representation learning (DNN) + clustering
291 stars 81 forks source link

IOError: [Errno 2] No such file or directory: u'saved_params/MNIST/pc_km_z_c-5-6_p_c-5-16_p_c-4-120.npy' #8

Closed rezacsedu closed 6 years ago

rezacsedu commented 6 years ago

The pretrain (usin 'python main.py -d MNIST -a 1 --pretrain 5') and clustering (using 'python main.py -d MNIST -a 1 --cluster 5') steps went well. But when I tried to print the metrics and visualize the, I encounter the following error:

asif@ubuntu:~/Clustering-with-Deep-learning$ python main.py -d MNIST -a 1 --metrics [08/18 01:40:29] Initial Cluster Quality Comparison [08/18 01:40:29] ____ [08/18 01:40:29] method ACC NMI [08/18 01:40:29] ____ [08/18 01:43:42] image 0.542 0.481 [08/18 01:44:11] c-5-6_p_c-5-16_p_c-4-120 0.612 0.560 [08/18 01:44:20] c-5-6_p_c-5-16_p_c-4-120 0.668 0.676 Traceback (most recent call last): File "main.py", line 164, in testKMeans(dataset_name, [archs[arch_index]]) File "main.py", line 77, in testKMeans Z = numpy.load('saved_params/' + dataset.name + '/pc_kmz' + arch['name'] + '.npy') File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 362, in load fid = open(file, "rb") IOError: [Errno 2] No such file or directory: u'saved_params/MNIST/pc_km_z_c-5-6_p_c-5-16_p_c-4-120.npy' asif@ubuntu:~/Clustering-with-Deep-learning$ python main.py -d MNIST -a 1 --visualize [08/18 01:47:56] Loading dataset [08/18 01:47:57] Done loading dataset Traceback (most recent call last): File "main.py", line 166, in visualizeLatentSpace(dataset_name, archs[arch_index]) File "main.py", line 104, in visualizeLatentSpace Z = numpy.load('saved_params/' + dataset.name + '/pc_kmz' + arch['name'] + '.npy') File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 362, in load fid = open(file, "rb") IOError: [Errno 2] No such file or directory: u'saved_params/MNIST/pc_km_z_c-5-6_p_c-5-16_p_c-4-120.npy'

As far as I understood, this file should be generated automatically during the pretrain/cluster step, right? Am I doing something wrong?

rezacsedu commented 6 years ago
    if args.cluster:
        testOnlyClusterImprovement(dataset_name, archs[arch_index], args.cluster, "KLD")
        testOnlyClusterImprovement(dataset_name, archs[arch_index], args.cluster, "KM")

This change fixed the issue. So closing it. Thanks.

rezacsedu commented 6 years ago

if args.cluster: testOnlyClusterImprovement(dataset_name, archs[arch_index], args.cluster, "KLD") testOnlyClusterImprovement(dataset_name, archs[arch_index], args.cluster, "KM")

dnnguifever commented 6 years ago

Would you mind explaining what exact change you are talking about? I am getting that same error. Where does that "if" statement go?

Thanks!

rezacsedu commented 6 years ago

@dnnguifever try adding testOnlyClusterImprovement(dataset_name, archs[arch_index], args.cluster, "KM") after line number 162 in the main.py script.