Code Monkey home page Code Monkey logo

multichannel-gcforest's Introduction

Multichannel-GCForest

A generalization of gcForest(or named deep Forest)

Introduction

GcForest paper url: ( https://arxiv.org/abs/1702.08835 ). The official release of the gcForest code used in paper at here.

This project implements a multi-channel deep-forest based on the pylablanche's work. Thus, the project allows you to input multi-channels images.

Using Multichannel-GCForest

The project implements a multi-channel deep forest so that it can process multi-channel images, such as RGB images.Besides, we use the sk-learn style with a .fit() function to train and .predict() function to predict the gcForest.
There are two sample ways to start training as follows:

1) Training Multichannel-gcForest with samples (sample starting)

The project contains a small sample data set, so you can directly run main.py for training with:

cd ./   
python main.py  

Then you can directly see the test results as follows:

Slicing Images...
sliced_imgs shape after MGS:: (2700, 972)
Training MGS Random Forests...
Adding/Training Layer, n_layer=1
Layer validation accuracy = 0.9166666666666666
Adding/Training Layer, n_layer=2
Layer validation accuracy = 0.9333333333333333
Adding/Training Layer, n_layer=3
Layer validation accuracy = 0.9333333333333333
Slicing Images...
sliced_imgs shape after MGS:: (2700, 972)
accuracy: 0.88
kappa: 0.76
              precision    recall  f1-score   support
           0       0.84      0.94      0.89       150
           1       0.93      0.82      0.87       150
    accuracy                           0.88       300
   macro avg       0.89      0.88      0.88       300
weighted avg       0.89      0.88      0.88       300
[[141   9]
 [ 27 123]]
Confusion matrix, without normalization

2) Training Multichannel-gcForest with youselves dataset

If you need to train gcforest with your own data:

from GCForest import *
gcf = gcForest( **kwargs ) 
gcf.fit(X_train, y_train)   # training
gcf.predict(X_test)         # inference

3) Saving and Loading trained Model

Using sklearn.externals.joblib save your model to disk and load it later.
save trained model :

from sklearn.externals import joblib
joblib.dump(gcf, 'trained_model.sav')

load trained model :

joblib.load('trained_model.sav')

multichannel-gcforest's People

Contributors

lee-zq avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.