Coder Social home page Coder Social logo

pa4y / shot-type-classifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsomani95/shot-type-classifier

0.0 0.0 0.0 11.33 MB

Detecting cinema shot types using a ResNet-50

License: Other

Shell 0.01% Python 0.09% Jupyter Notebook 99.90%

shot-type-classifier's Introduction

AI For Filmmaking

Code for the blog post AI for Filmmaking. Detect cinematic shot types in images using a pre-trained ResNet-50.

This model recognises 6 shot types:

1. Extreme Wide Shot

2. Long Shot

3. Medium Shot

4. Medium Close Up

5. Close Up

6. Extreme Close Up


In the not so distant future, it will also recognise:

Wide Shots

Medium Long Shots

Requirements

fastai โ€” Installation instructions here. You can use this code without a GPU.

Usage

After downloading the directory, run bash get_data_model.sh to download the model and the validation set. A dummy training set is downloaded too to enable the generation of heatmaps.

Predict Shot Types

python get-preds.py                     \
    --path_base  ~/shot-type-classifier \
    --path_img   ~/images               \
    --path_preds ~/images/preds         \

Where path_base is the directory path, path_img the path to the images you want to evaluate, and path_preds where you'd like to store the predictions (.csv files). The script create the ~/images/preds folder if it doesn't exist.

Heatmaps

python get-heatmaps.py                 \
    --path_base ~/shot-type-classifier \
    --path_img  ~/images               \
    --path_hms  ~/images/heatmaps      \
    --alpha 0.8

Where path_base is the directory path, path_img the path to the images you want to evaluate, path_hms where you'd like to store the heatmaps, and alpha the blending value of the heatmap with the original image. An alpha value of 1.0 produces the heatmap only. The script create the ~/images/heatmaps folder if it doesn't exist.

License

This repository is released under the Creative Commons Attribution-NonCommercial 4.0 (CC BY-NC 4.0). See here for more details.

shot-type-classifier's People

Contributors

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