Predicting film genres from their posters with Tensorflow.js
Find a file
2020-09-23 17:23:51 +01:00
gnuplot GNUplot: change font size 2020-09-18 18:28:16 +01:00
images Move some files around 2020-09-18 17:23:01 +01:00
src Add comments from live presentation 2020-09-23 17:23:51 +01:00
.gitignore Move some files around 2020-09-18 17:23:01 +01:00
Film Poster Genres - Slides.odp Further refinement of slides 2020-09-23 14:44:04 +01:00
LICENSE Initial commit 2020-09-15 15:39:02 +01:00
package-lock.json It trains! 2020-09-15 18:32:51 +01:00
package.json It trains! 2020-09-15 18:32:51 +01:00
README.md Fill out README 2020-09-23 17:23:44 +01:00

film-poster-genres

Predicting film genres from their posters with Tensorflow.js

Dataset

The dataset used with this demo can be found here:

https://nextcloud.starbeamrainbowlabs.com/index.php/s/wmCdL4tX3HHGAFD

The format is as follows:

+ dataset_dir/
	+ train/
		+ 1234,Comedy,Fantasy.jpg
		+ 4321,Western,Short,Drama.jpg
		+ .....
	+ validate/
		+ 6789,Drama,Mystery,Thriller.jpg
		+ 9876,History,Documentary,Animation.jpg
		+ .....

The filenames of the images take the following format: ID,GENRE_1,GENRE_2,GENRE_N.jpg.

System / User Requirements

  • Node.js
  • NPM (installed by default with Node.js)
  • A relatively decent CPU
  • Basic knowledge of the command-line / terminal

Installation

First, clone this git repo:

git clone https://git.starbeamrainbowlabs.com/Demos/film-poster-genres.git
cd film-poster-genres

Then, install the dependencies:

npm install

Usage

Training

To train a new model:

node src/index.mjs train --input path/to/dataset_dir --output path/to/output_dir

The output directory will look like this:

 + output_dir/
	+ metrics.stream.json
	+ checkpoints/
		+ 0/
		+ 1/
		+ 2/
		+ 3/

Predicting

To make a prediction using an existing model:

node src/index.mjs predict --input path/to/image.jpg --ai-model path/to/checkpoint_dir/

The result will be written to the standard output. Extra debugging data is written to the standard error, but this can be ignored.

Contributing

Contributions are very welcome! Git patches are preferred - I can move this repo to GitHub if that makes it easier. Please mention in your contribution that you release your work under the MPL-2.0 (see below).

Licence

This code is released under the Mozilla Public License 2.0. The full license text is included in the LICENSE file in this repository. Tldr legal have a great summary of the license if you're interested.