Predicting film genres from their posters with Tensorflow.js
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
Starbeamrainbowlabs 0356c218f2
Update package lock
gnuplot GNUplot: change font size 5ヶ月前
images Move some files around 5ヶ月前
src Add comments from live presentation 5ヶ月前
.gitignore Move some files around 5ヶ月前
Film Poster Genres - Slides.odp Further refinement of slides 5ヶ月前
LICENSE Initial commit 5ヶ月前 Update README 2ヶ月前
package-lock.json Update package lock 2ヶ月前
package.json Update README 2ヶ月前


Predicting film genres from their posters with Tensorflow.js

The example code & slide deck for a talk I gave on getting started with AI. A link to the unlisted YouTube video is available upon request (because it contains my face, and this is a public repo) - see my website for ways to get in touch.

For advanced users, see also the post-talk-improvements branch, which contains a number of adjustments and changes to this codebase. These changes improve the model, but make it more complex to understand and hence are kept in a separate branch to allow regular users to look at the simpler / easier to understand codebase.


The dataset used with this demo can be found here:

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


First, clone this git repo:

git clone
cd film-poster-genres

Then, install the dependencies:

npm install



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/
	+ checkpoints/
		+ 0/
		+ 1/
		+ 2/
		+ 3/


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.


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


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.