fferroni / dec-keras Goto Github PK
View Code? Open in Web Editor NEWDeep Embedding Clustering in Keras
License: GNU General Public License v3.0
Deep Embedding Clustering in Keras
License: GNU General Public License v3.0
Trying to load model for production predictions with the code:
from keras_dec import ClusteringLayer
from keras.models import load_model
model = load_model('./DEC.model', custom_objects={'ClusteringLayer': ClusteringLayer})
...
This is not working and producing:
ValueError: initial_value must be specified.
This error is referring to line #64 in keras_dec.py
What is the issue?
/usr/local/lib/python3.6/dist-packages/sklearn/utils/linear_assignment_.py:21: DeprecationWarning: The linear_assignment_ module is deprecated in 0.21 and will be removed from 0.23. Use scipy.optimize.linear_sum_assignment instead.
DeprecationWarning)
Hi
I got this error when I try to run the script python 3.4.
ImportError: No module named 'DEC'
Can you help me?
thanks
the problem is : No such file or directory: './data/usps/usps_train.jf'
Hi,
Great work! Thanks a lot.
I'm just wondering how I can use my own dataset here. I have a folder full of images that I want to be clustered.
Thanks!
Hi, thanks for sharing your code. It is very helpful. However, I thought I found an error in keras_dec.py:
delta_label = ((y_pred == self.y_pred).sum().astype(np.float32) / y_pred.shape[0])
if y is not None:
acc = self.cluster_acc(y, y_pred)[0]
self.accuracy.append(acc)
print('Iteration '+str(iteration)+', Accuracy '+str(np.round(acc, 5)))
else:
print(str(np.round(delta_label*100, 5))+'% change in label assignment')
if delta_label < tol:
print('Reached tolerance threshold. Stopping training.')
train = False
np.save("cluster_loss", np.asarray(cluster_loss))
continue
It should be !=
instead of ==
when it comes to delta_label, isn't it?
HI,
i have this value.
Any ideas?
DEC-Keras network is so wonderful for my data.
I changed the input as my data instead of mnist data.
The pre_trainning is so good.
But the loss value diverge to NaN during fine tunning.
I think that dynamic learning rate will be needed in fine tunning !
Could you suggest me the best method for applying dynamic learning rate.
Thank you in advance.
Do you know if there have been any usage with an unknown number of clusters? Thanks for posting this btw! It makes a lot more sense looking at the code than interpreting math symbols for me.
Are there any plans to implement NMI and G metrics as outlined in the paper?
Looking at the original Caffe version of DEC, NMI is defined using sklearn.metrics.normalized_mutual_info_score
. https://github.com/piiswrong/dec/blob/master/dec/dec.py#L701
As for G, it should be a straightforward division of training loss and validation loss.
I plan to use use this to play around with some clustering. If/when I do I'm happy to take a stab at it. Or if you have time to work on it before then that would be great too.
Thank you for posting the code! I attempted to implement your code in TF 1.3 making the following changes:
import tensorflow.contrib.keras.api.keras as K
from tensorflow.contrib.keras.api.keras.initializers import RandomNormal
from tensorflow.contrib.keras.api.keras.layers import Layer, InputSpec
from tensorflow.contrib.keras.api.keras.models import Model, Sequential
from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Input
from tensorflow.contrib.keras.api.keras.optimizers import SGD
from tensorflow.contrib.keras.api.keras.callbacks import LearningRateScheduler
from tensorflow.contrib.keras.api.keras.backend import floatx
However, I encounter en error message pointing to line#71, which is the last line in the following:
def build(self, input_shape):
assert len(input_shape) == 2
input_dim = input_shape[1]
self.input_spec = [InputSpec(dtype=K.backend.floatx(),
shape=(None, input_dim))]
self.W = K.backend.variable(self.initial_weights)
self.trainable_weights = [self.W]
layerwise pretrain and Finetuning autoencoder works fine on the test example (mnist), but then Initializing cluster centres with k-means. crushes with an error message:
self.trainable_weights = K.backend.variable(self.initial_weights)
AttributeError: can't set attribute
What could be the reason for that??? Thanks in advance.
Hello @fferroni. Thank you for sharing this implementation.
With the MXNET model, I can get a 82% clustering accuracy on MNIST but get stuck around 60% with this Keras model out of the box?
Could you tell be if you manage to reach a higher accuracy? Thanks.
After the cluster is formed, how to know which cluster does the new data belong to?
And also how to retrieve all images which rely on the same cluster?
how can we visualize the clusters?
This is a great implementation of DEC, would it be possible to add support for using multiple GPUs via Keras?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.