Forabot is a machine learning project to identify and sort foraminifera. By automating the identification process, data can be collected exponentially faster than it is now. Foraminifera may reveal the ancient history of our oceans and climate.
Jump to section below [Live Gallery] [ML Model] [References]
Live Gallery
Gallery is refreshed automatically
when new forams are processed
ML Model
Let us take a look at the core components of the network.
The general workflow is as follows:
- Instantiate a base model(s) with pre-trained weights. Ex: Xception and Resnet50
- Run new foram dataset (1437 images) through base model and save results from output layer. This is called feature extraction.
- Load previous outputs from base model and run them through new connected layers created using Sequential() high level keras library.
xception_model = xception.Xception(include_top=False, pooling=avg) resnet50_model = resnet.ResNet50(include_top=False, pooling=avg)
One unique part of the foram dataset is that it requires us to fuse multiple images with different lighting conditions as the input of the network
Loop through directory and group images.
for i, img_file in enumerate(img_filenames): img = cv2.imread(img_file, 0) saveimg = cv2.imread(img_file) img = cv2.resize(img, img_shape, interpolation=cv2.INTER_CUBIC) group_images[:, :, i] = img
Fuse grouped images together using top 90, 50, 10 quantiles.
img90 = np.expand_dims(np.percentile(group_images, 90, axis=-1), axis=-1) img50 = np.expand_dims(np.percentile(group_images, 50, axis=-1), axis=-1) img10 = np.expand_dims(np.percentile(group_images, 10, axis=-1), axis=-1) img = np.concatenate((img10, img50, img90), axis=-1) img = np.expand_dims(img, axis=0)
The newly created model which takes output of base model is created like this.
foram_fc_model = Sequential() foram_fc_model.add(Dropout(0.05, input_shape=feature_shape[1:])) foram_fc_model.add(Dense(512, activation="relu")) foram_fc_model.add(Dropout(0.15)) foram_fc_model.add(Dense(512, activation="relu")) foram_fc_model.add(Dense(7, activation="softmax"))
