Code Monkey home page Code Monkey logo

Comments (5)

xiaohk avatar xiaohk commented on May 3, 2024

Good question :)

Unfortunately, you would need to change some javascript code if you fine-tune the underlying model to other classes. It would be very straightforward though, if you are using our tiny-VGG architecture (with 10 output classes).

Let me know if you are interested in trying out; I can give you some pointers to the functions you might need to change. I will close this issue for now.

from cnn-explainer.

ljjsfe avatar ljjsfe commented on May 3, 2024

Sorry for duplicate the question. I thought I forget to submit it. :) I am interested in trying out to modify the functions. Can you point me the functions? Thx,

from cnn-explainer.

xiaohk avatar xiaohk commented on May 3, 2024

Sure! You can change the output class labels here:

classLists: ['lifeboat', 'ladybug', 'pizza', 'bell pepper', 'school bus',
'koala', 'espresso', 'red panda', 'orange', 'sport car']

It matches the order of your output labels in your tiny-vgg model. If you are using 10 class, then changing the line above should be good to go. If you are using other number of classes, then here are some functions you want to look into:

nodeGroups.append('rect')
.attr('class', 'output-rect')
.attr('x', left)
.attr('y', (d, i) => nodeCoordinate[l][i].y + nodeLength / 2 + 8)
.attr('height', nodeLength / 4)
.attr('width', 0)
.style('fill', 'gray');
nodeGroups.append('text')
.attr('class', 'output-text')
.attr('x', left)
.attr('y', (d, i) => nodeCoordinate[l][i].y + nodeLength / 2)
.style('dominant-baseline', 'middle')
.style('font-size', '11px')
.style('fill', 'black')
.style('opacity', 0.5)
.text((d, i) => classLists[i]);

svg.selectAll('g.node-output').each(
(d, i, g) => drawOutputScore(d, i, g, outputRectScale)
);

/**
* Draw bar chart to encode the output value
* @param {object} d d3 data
* @param {index} i d3 data index
* @param {[object]} g d3 group
* @param {function} scale map value to length
*/
const drawOutputScore = (d, i, g, scale) => {
let group = d3.select(g[i]);
group.select('rect.output-rect')
.transition('output')
.delay(500)
.duration(800)
.ease(d3.easeCubicIn)
.attr('width', scale(d.output))
}

Keep me updated when you are trying out new classes. I'm happy to help :)

from cnn-explainer.

ljjsfe avatar ljjsfe commented on May 3, 2024

from cnn-explainer.

xiaohk avatar xiaohk commented on May 3, 2024

A user has successfully adapted CNN Explainer to other dataset in #14 .

You can see their public GitHub page and code repository.

Hopefully you find these pointers helpful :)

from cnn-explainer.

Related Issues (20)

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.