Giter Site home page Giter Site logo

keras-rcnn's Introduction

Keras-RCNN

https://travis-ci.org/broadinstitute/keras-rcnn.svg?branch=master

keras-rcnn is the Keras package for region-based convolutional neural networks.

Getting Started

Let’s read:

training, validation, test = keras_rcnn.datasets.malaria_phenotypes.load_data()

classes = {
    "rbc": 1, "leu": 2, "ring": 3, "tro": 4, "sch": 5, "gam": 6
}

generator = keras_rcnn.preprocessing.ObjectDetectionGenerator()

generator = generator.flow(training, classes)

validation_data = keras_rcnn.preprocessing.ObjectDetectionGenerator()

validation_data = validation_data.flow(validation, classes)

and inspect our training data:

(target_bounding_boxes, target_image, target_scores, _), _ = generator.next()

target_bounding_boxes = numpy.squeeze(target_bounding_boxes)

target_image = numpy.squeeze(target_image)

target_scores = numpy.argmax(target_scores, -1)

target_scores = numpy.squeeze(target_scores)

_, axis = matplotlib.pyplot.subplots(1, figsize=(12, 8))

axis.imshow(target_image)

for target_index, target_score in enumerate(target_scores):
    if target_score > 0:
        xy = [
            target_bounding_boxes[target_index][0],
            target_bounding_boxes[target_index][1]
        ]

        w = target_bounding_boxes[target_index][2] - target_bounding_boxes[target_index][0]
        h = target_bounding_boxes[target_index][3] - target_bounding_boxes[target_index][1]

        rectangle = matplotlib.patches.Rectangle(xy, w, h, edgecolor="r", facecolor="none")

        axis.add_patch(rectangle)

matplotlib.pyplot.show()

https://storage.googleapis.com/keras-rcnn-website/example.png

Let’s create an RCNN instance:

image = keras.layers.Input((None, None, 3))

model = keras_rcnn.models.RCNN(image, classes=len(classes) + 1)

and pass our preferred optimizer to the compile method:

optimizer = keras.optimizers.Adam(0.0001)

model.compile(optimizer)

Finally, let’s use the fit_generator method to train our network:

model.fit_generator(generator)

Slack

We’ve been meeting in the #keras-rcnn channel on the keras.io Slack server.

You can join the server by inviting yourself from the following website:

https://keras-slack-autojoin.herokuapp.com/

keras-rcnn's People

Contributors

0x00b1 avatar 24hours avatar jhung0 avatar jihongju avatar milani avatar yanfengliu avatar yhenon avatar

Watchers

 avatar  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.