dhuy228 / augmented-volumetric-image-generator Goto Github PK
View Code? Open in Web Editor NEWCustomised Keras' ImageDataGenerator for 3D volumetric medical image
License: MIT License
Customised Keras' ImageDataGenerator for 3D volumetric medical image
License: MIT License
Hi,
Thanks so much for creating this image generator, I've been struggling to find a way to modify some 2DCNN code to implement ImageDataGenerator with Conv3D.
I am getting an error when I try to .fit() the data generator object:
line 176, in <module> datagen.fit(X_train) AttributeError: 'customImageDataGenerator' object has no attribute 'fit'
However it seems fine with fit_generator() - except that the data needs to be fit first:
UserWarning: This ImageDataGenerator specifies
featurewise_std_normalization, but it hasn'tbeen fit on any training data. Fit it first by calling
.fit(numpy_data).'
Am I missing something about how to implement this?
Thanks for your time.
Here is the code:
datagen = generator.customImageDataGenerator(
featurewise_center=True,
featurewise_std_normalization=True,
horizontal_flip=True)
validation_gen = generator.customImageDataGenerator(
featurewise_center=True,
featurewise_std_normalization=True,
horizontal_flip=False)
test_gen = generator.customImageDataGenerator(
featurewise_center=True,
featurewise_std_normalization=True,
horizontal_flip=False)
model_in = Input(X_train.shape[1:])
# 3x3 layer
h = Conv3D(128, 3, activation='relu',padding="same", name='conv1_1')(model_in)
h = Conv3D(64, 3, activation='relu',padding="same", name='conv1_2')(h)
h = MaxPooling3D(pool_size=3, name='pool1',padding="same")(h)
h = Dropout(0.15, name='drop1')(h)
h = Flatten(name='flaten1')(h)
<more branches>
output = Dense(5,name="out_dense",activation='softmax')(h)
model = Model(inputs=[model_in], outputs=[output])
model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
datagen.fit(X_train)
validation_gen.fit(X_valid)
test_gen.fit(X_test)
model.fit_generator(datagen.flow(X_train, Y_train, batch_size=32), \
steps_per_epoch=len(X_train) / 32, epochs=epochOption,verbose=1, \
callbacks=callbacks_list, \
validation_data=validation_gen.flow(X_valid,Y_valid, batch_size=32), \
validation_steps=len(X_test)/32)
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.