Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit fdaf199f authored by bernie wang's avatar bernie wang
Browse files

fixed data loading so that binary files are now loading sequentially, not whichever is loaded first

parent 62410d28
......@@ -315,6 +315,7 @@ function OutputBox(box) {
var v3 = box.geometry.vertices[2];
var center = getCenter(v1, v2);
this.center = new THREE.Vector2(center.z, center.x);
console.log("center: ", this.center);
this.width = distance2D(v2, v3);
this.length = distance2D(v1, v3);
this.angle = box.angle;
......
......@@ -102,7 +102,7 @@ function init() {
function write_frame() {
evaluator.pause_recording();
evaluation.add_evaluator(evaluator);
evaluation.write_frame();
// evaluation.write_frame();
}
function predictLabel(boundingBox) {
......@@ -128,34 +128,56 @@ function predictLabel(boundingBox) {
}
}
function getMaskRCNNLabels(filename) {
$.ajax({
url: '/getMaskRCNNLabels',
data: JSON.stringify({filename: filename}),
type: 'POST',
contentType: 'application/json;charset=UTF-8',
success: function(response) {
var l = response.length - 1;
maskRCNNIndices = response.substring(1, l).split(',').map(Number);
// console.log(maskRCNNIndices);
// console.log(response);
highlightPoints(maskRCNNIndices);
},
error: function(error) {
console.log(error);
}
});
}
function next_frame(event) {
if (evaluation.is_done()) {
alert("You have completed the evaluation! Thank you for participating!");
write_frame();
console.log(evaluation.evaluators);
evaluation.write_output();
return;
}
var response = confirm('Do you want to move on to the next frame? You cannot go back to edit previous frames.');
console.log("length: ", data.length);
console.log(data.slice(0, 10));
if (response == true) {
$("#next_frame").text("Next Frame (" + (evaluation.get_frame_number() + 1) +
"/" + evaluation.num_frames() + ")");
write_frame();
evaluation.next_frame();
$.ajax({
url: '/updateBoundingBoxes',
data: JSON.stringify({bounding_boxes: stringifyBoundingBoxes(boundingBoxes)}),
type: 'POST',
contentType: 'application/json;charset=UTF-8',
success: function(response) {
console.log(response);
},
error: function(error) {
console.log(error);
}
});
// $.ajax({
// url: '/updateBoundingBoxes',
// data: JSON.stringify({bounding_boxes: stringifyBoundingBoxes(boundingBoxes)}),
// type: 'POST',
// contentType: 'application/json;charset=UTF-8',
// success: function(response) {
// console.log(response);
// },
// error: function(error) {
// console.log(error);
// }
// });
reset();
data = evaluation.get_data();
// getMaskRCNNLabels(evaluation.get_filename());
show();
console.log(normalizedIntensities.length, pointcloud.geometry.vertices.length);
$.ajax({
......
......@@ -43,7 +43,7 @@ function normalizeColors(vertices, color) {
// colors[i] = ( color.clone().multiplyScalar( intensity * 2 ) );
normalizedIntensities.push(intensities[i]);
colors[i] = ( new THREE.Color( intensity, 0, 1 - intensity).multiplyScalar(intensity * 5));
// colors[i] = color.clone();
// if (colors[i].b > colors[i].r) {
// colors[i] = colors[i].multiplyScalar(0);
// }
......@@ -51,10 +51,25 @@ function normalizeColors(vertices, color) {
return colors;
}
function highlightPoints(indices) {
// var colors = []
// for (var i = 0; i < pointcloud.geometry.colors.length; i++) {
// colors.push(pointcloud.geometry.colors[i].clone());
// }
for (var j = 0; j < indices.length; j++) {
pointcloud.geometry.colors[indices[j]] = new THREE.Color( 0,1,0 );
}
// pointcloud.geometry.colors = colors;
console.log(indices.length);
// console.log(colors);
pointcloud.geometry.colorsNeedUpdate = true;
}
function generatePointCloud( vertices, color ) {
var geometry = new THREE.Geometry();
var colors = [];
var k = 0;
var stride = 4;
for ( var i = 0, l = vertices.length / 4; i < l; i ++ ) {
......@@ -67,11 +82,12 @@ function generatePointCloud( vertices, color ) {
// add vertex to geometry
geometry.vertices.push( v );
colors.push(color.clone());
k++;
}
console.log("size: ", geometry.vertices.length);
geometry.colors = normalizeColors(vertices, color);
// geometry.colors = colors;
geometry.computeBoundingBox();
var material = new THREE.PointsMaterial( { size: pointSize, sizeAttenuation: false, vertexColors: THREE.VertexColors } );
......
......@@ -212,15 +212,24 @@ function upload_file() {
}
}
var fileLoaded = true;
var currFile = "";
function upload_files() {
var x = document.getElementById("file_input");
if (x.files.length > 0) {
for (var i = 0; i < x.files.length; i++) {
var file = x.files[i];
var filename = x.files[i].name;
var file = x.files[i];
evaluation.add_filename(filename);
load_text_file(file, import_annotations_from_bin);
}
var text_reader = new FileReader();
load_data_helper(0, x.files);
}
}
function load_data_helper(index, files) {
if (index < evaluation.filenames.length) {
load_text_file(index, files[index], files);
}
}
......@@ -232,22 +241,25 @@ function import_annotations_from_bin(data) {
}
function load_text_file(text_file, callback_function) {
function load_text_file(index, text_file, files) {
if (text_file) {
var text_reader = new FileReader();
text_reader.readAsArrayBuffer(text_file);
text_reader.onload = readData;
image_loaded = true;
text_reader.onload = function() {
readData(text_reader);
load_data_helper(index + 1, files);
}
}
}
function readData(e) {
var rawLog = this.result;
function readData(text_reader) {
var rawLog = text_reader.result;
var floatarr = new Float32Array(rawLog)
evaluation.add_data(floatarr);
if (evaluation.num_frames() == evaluation.filenames.length) {
if (evaluation.num_frames() == 1) {
reset();
data = evaluation.get_data();
// getMaskRCNNLabels(evaluation.get_filename());
show();
animate();
// $.ajax({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment