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

Annotation workflow #291

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Annotation workflow #291

wants to merge 14 commits into from

Conversation

murlock1000
Copy link

@murlock1000 murlock1000 commented Nov 15, 2024

(WIP) Implementation of #216

Features:

  • Demo Jupyter notebook showcasing functionality of the workflow
  • Hot-reloading of splat and annotation data using a custom websocket protocol and proxy server.
  • Annotations manager
  • Selecting and toggling labelled splats
  • Selected splat bounding box highlight
  • Annotation visualization in centers mode with 'Show Classes' toggle in view options menu
  • (WIP) Add/remove new labels
  • (WIP) Add/remove selected splats to a certain label
  • Class ID histogram
  • Additional RGB histograms

Known Bugs:

  • Histogram merges 0 and 1 Class IDs under single bucket
  • Efficiency improvement: lack of dynamic shader initialization upon label upload
  • Partial support for annotations - hardcoded dataset sample count = 1
  • Class color shader not rerendering upon hot-reload

@@ -228,6 +244,31 @@ class DataPanel extends Panel {
func = (i) => rgb2hsv({r: colorFunc(r[i]), g: colorFunc(g[i]), b: colorFunc(b[i])}).v;
break;
}
case 'rg': {
Copy link
Author

Choose a reason for hiding this comment

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

Feature creep happened, should probably remove from annotation workflow PR

@@ -143,7 +145,7 @@ void main(void)
if ((vertexState & 2u) == 2u) {
// frozen/hidden
c = vec3(0.0, 0.0, 0.0);
alpha = B * 0.05;
alpha = 0.0; //B * 0.05; // Trace shadow can still be visible when hidden.
Copy link
Author

Choose a reason for hiding this comment

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

Updated this, since it was distracting when classes were hidden, but shadow was still visible.

varying vec4 varying_color;

// Visualize class instances
uniform vec3 classColors[${GSplatLabels.MAX_UNIFORM_COLORS}];
Copy link
Author

Choose a reason for hiding this comment

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

We are limited in the number of colors here, maybe there is a dynamic way of uploading the class colors?

Copy link
Member

Choose a reason for hiding this comment

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

Probably better to sample the colors from a texture instead of uniform?

if (event.data instanceof Blob){
try {
// First 64 bytes used for message type
const msgtype = (await event.data.slice(0, 64).text()).replace(/\0+$/, '');
Copy link
Author

Choose a reason for hiding this comment

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

Should use grpc here perhaps.

@slimbuck
Copy link
Member

Wow, amazing @murlock1000. I guess this runs on windows? I'll definitely give a try when I can!

@murlock1000
Copy link
Author

murlock1000 commented Nov 18, 2024

@slimbuck yes, it runs on windows with the environment prepared according to the gaussian-splatting project requirements - but that is only required to run the demo, not supersplat itself. Additionally, it only requires 'from scene.gaussian_model import GaussianModel', so the whole project dependency could be omitted by extracting the GaussianModel class from it directly and installing libraries like torch on the go.

@@ -48,7 +48,8 @@ class AssetLoader {
{
elementFilter: this.loadAllData ? (() => true) : null,
// decompress data on load
decompress: true
decompress: true,
reorder: false, // Do not perform MortonOrder calculation and reordering when working with labels, since we are not persiting the old indices so we could also reorder the labels that come after.
Copy link
Author

Choose a reason for hiding this comment

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

This should also be improved - the ordering of splats and their corresponding labels should persist even after MortonOrder is applied.

const name = (await event.data.slice(64, 128).text()).replace(/\0+$/, '');
const data = await event.data.slice(128, event.data.size).text();
const labels = JSON.parse(data);
await scene.updateLabels(labels, name);
Copy link
Author

Choose a reason for hiding this comment

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

This is the only way to add labels to the scene for now. WIP - upload labels directly as a file from menu dialog.

}

class GSplatLabels {
static MAX_UNIFORM_COLORS = 4000;
Copy link
Author

Choose a reason for hiding this comment

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

Shader code does not compile with larger color buffer - should be reworked to use dynamically allocated buffers perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants