Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve gif classification #401

Merged
merged 20 commits into from
Oct 23, 2020

Conversation

yzevm
Copy link
Contributor

@yzevm yzevm commented Aug 19, 2020

Hi @GantMan I working on /~https://github.com/nsfw-filter/nsfw-filter and have some bugs with DOM

Current state

  1. nsfwjs.min.js size is 1694185 bytes => ~1.7mb
  2. during prediction gif changed size
  3. for 10 secs gif it takes 20264ms => ~20 secs

old2

New

  1. nsfwjs.min.js size is 2014035 bytes => ~2mb
  2. during prediction gif didn't change size
  3. for 10 secs gif it takes 15913ms => ~16 secs
  4. you can use fps property to adjust amount of frames to predict model.classifyGif(GIF_IMAGE, { topk: 3, fps: 1 })

new

@yzevm
Copy link
Contributor Author

yzevm commented Aug 19, 2020

UPD1 Oh, I estimate time with prediction of 190 frames for both cases
Found old records, not sure, but looks like its only time for gif preparation (without frames prediction)

libifjs
23.667 -> 31.377
44.173 -> 52.451
01.013 -> 08.798

gif-frames
47.742 -> 48.779
53.875 -> 54.825
58.736 -> 59.696

@GantMan
Copy link
Member

GantMan commented Aug 20, 2020

This looks great!

Can you please update the README.md to explain the new params along with this change? Then I can merge.

@GantMan GantMan added the enhancement New feature or request label Aug 20, 2020
@yzevm yzevm changed the base branch from master to new_model August 25, 2020 16:38
@yzevm yzevm changed the base branch from new_model to master August 25, 2020 16:39
get-pixels-frame-info-update "3.3.2"
multi-integer-range "3.0.0"

"@nsfw-filter/save-pixels@^2.3.4":
Copy link
Contributor Author

@yzevm yzevm Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed a little bit this lib

@@ -553,6 +553,26 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@nsfw-filter/gif-frames@1.0.2":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no changes(except types), just replace with new @nsfw-filter/save-pixels

@yzevm
Copy link
Contributor Author

yzevm commented Aug 25, 2020

Hi @GantMan, I finished

  • works for both environnements: browser and nodejs (without massive packages, but it's pretty slow for all frames on nodejs)
  • tests for classifyGif
  • updated README docs

ps could you please take a look into classifyGIF implementation, maybe I miss sth (sorry, it's pretty messy)

@GantMan
Copy link
Member

GantMan commented Aug 26, 2020

FANTASTIC WORK!

Quick note: If I merge this it will break NSFWJS.com for GIFs which is powered by CI to /~https://github.com/infinitered/nsfwjs/tree/master/example/nsfw_demo

I'm OK merging and then tasking myself with updating the code in the demo, but I guess I should ask. Do you want to update the small bit of demo code? That way when I merge this, the new GIF code will go directly to NSFWJS.com?

this means a small update to /~https://github.com/infinitered/nsfwjs/blob/master/example/nsfw_demo/src/App.js#L123-L127

Again, feel free to refuse. NSFWJS.com can be broken for a bit until I find time to update the site to the new syntax API.

@yzevm yzevm mentioned this pull request Sep 20, 2020
15 tasks
@GantMan GantMan merged commit 91b0fa3 into infinitered:master Oct 23, 2020
@GantMan
Copy link
Member

GantMan commented Oct 23, 2020

@YegorZaremba - can you contact me and give me your address? We'd love to mail you some swag for your contributions.

My email is Gant followed by the company's domain.

@yzevm yzevm deleted the feature/improve-gif branch October 25, 2020 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants