Giter VIP home page Giter VIP logo

predation-detection-cnn's Introduction

Hi , are you intrested in automating the detection of the ecological interactions using Convolutional Neural Networks?

Here, We are going to present the R scripts and data set that can be used to reproduce the results presented in the paper "Detecting predation interaction using pretrained CNNs".

Programming language


Gabriel-Python

Examples

To run our code, first open the project "SupplementMaterial.Rproj". Then, follow the examples above to reproduce our results.
# Adding aditional layers
model = models.Sequential()
model.add(layers.Dense(256, activation='relu', input_dim=4 * 4 * 512))
model.add(layers.Dropout(0.5))
model.add(layers.Dense(1, activation='sigmoid'))
# End Adding aditional layers

# New layers summary
model.summary() 
# End New layers summary

# Obtaining train and vaidation accuracy
model.compile(optimizer=optimizers.RMSprop(lr=2e-5),
                        loss='binary_crossentropy',
                        metrics=['acc'])
history = model.fit(train_features, train_labels,
epochs=30,
batch_size=20,
validation_data=(validation_features, validation_labels))
# End Obtaining train and vaidation accuracy

# Experiment to obtain accuracy
acc_set = []
val_set = []
for i in np.arange(0, 30):
    
    history = model.fit(train_features, train_labels,
    epochs=30,
    batch_size=20,
    validation_data=(validation_features, validation_labels))

    acc_set.append(history.history['acc'][-1])
    val_set.append(history.history['val_acc'][-1])
obtained_acc=pd.DataFrame({'Train Accuracy': acc_set,
              'Validation Accuracy': val_set})
obtained_acc
# End Experiment to obtain accuracy

# Experiment to obtain recall, precision and F1
model.compile(optimizer=optimizers.RMSprop(lr=2e-5),
                        loss='binary_crossentropy',
                        metrics=[metrics.Precision(), metrics.Recall()])
history = model.fit(train_features, train_labels,
epochs=30,
batch_size=20,
validation_data=(validation_features, validation_labels))

prec_set = []
recall_set = []
val_prec_set = []
val_recall_set = []

for i in np.arange(0, 30):
    
    history = model.fit(train_features, train_labels,
    epochs=30,
    batch_size=20,
    validation_data=(validation_features, validation_labels))
    

    prec_set.append(history.history['precision_4'][-1])
    recall_set.append(history.history['recall_3'][-1])
    val_prec_set.append(history.history['val_precision_4'][-1])
    val_recall_set.append(history.history['val_recall_3'][-1])
obtained_rec_prec=pd.DataFrame({'Precision': prec_set,
              'Recall': recall_set,
               'val_precision':val_prec_set,
               'val_recall':val_recall_set})
 obtained_rec_prec
# End Experiment to obtain recall, precision and F1

For more details

IMVIP 2020 : Irish Machine Vision and Image Processing Conference

predation-detection-cnn's People

Contributors

gabrielrpalma avatar

Stargazers

 avatar

Watchers

 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.