|
19 | 19 | <vue-button type="default" v-on:click="showInvokeModal({'function': 'init_user', 'fields': ['ID'], 'title': 'Create User'})">Create User</vue-button> --> |
20 | 20 | <div style="margin-top:10px"> |
21 | 21 | <vue-button type="default" v-on:click="goHome">Home</vue-button> |
22 | | - <vue-button type="default" v-on:click="showModal({'name': 'upload-modal', 'title': 'Upload'})">Upload Image(s)</vue-button> |
| 22 | + <vue-button type="default" v-on:click="filenames = [] ; showModal({'name': 'upload-modal', 'title': 'Upload'})">Upload Image(s)</vue-button> |
23 | 23 | <vue-button type="default" v-on:click="showModal({'name': 'login-modal', 'fields': ['URL', 'Username', 'Password'], 'title': 'Login'})">Login</vue-button> |
24 | 24 | <vue-button type="default" v-on:click="downloadImages">Download Image(s)</vue-button> |
25 | 25 | </div> |
|
76 | 76 | </md-card-header> |
77 | 77 |
|
78 | 78 | <md-card-media md-big> |
79 | | - <img :src="url + inference['thumbnail_path']"> |
| 79 | + <template v-if="Object.keys(inference).includes('heatmap')"> |
| 80 | + <img :src="inference['heatmap']"> |
| 81 | + <img :src="url + inference['thumbnail_path']"> |
| 82 | + </template> |
| 83 | + <template v-else> |
| 84 | + <img :src="url + inference['thumbnail_path']"> |
| 85 | + </template> |
80 | 86 | </md-card-media> |
81 | 87 |
|
82 | 88 | <md-card-content> |
83 | 89 | <!-- <template v-if="'processed_frames' in Object.keys(inference)"> --> |
84 | | - <div class="md-subhead">{{inference['status']}}</div> |
85 | | - <div class="md-subhead">{{inference['percent_complete'].toFixed(2)}} %</div> |
| 90 | + <div class="md-subhead">Status: {{inference['status']}}</div> |
| 91 | + <div class="md-subhead">Progress: {{inference['percent_complete'].toFixed(2)}} %</div> |
86 | 92 | <!-- </template> --> |
87 | 93 | </md-card-content> |
88 | 94 |
|
|
93 | 99 |
|
94 | 100 |
|
95 | 101 | <template v-if="inferenceDetails && (Object.keys(inferenceDetails).length > 0) && inferenceDetails[inference._id]"> |
96 | | - <div class="md-subhead">Detected Objects</div> |
97 | | - <div>{{Object.keys(inferenceDetails[inference._id]).join(", ")}}</div> |
| 102 | + <div class="md-subhead">Detected Objects / Classes</div> |
| 103 | + <!-- <div>All: {{inferenceDetails[inference._id]}}</div> --> |
| 104 | + <template v-if="inference._id.includes('-')"> |
| 105 | + <div>{{Object.keys(inferenceDetails[inference._id]).join(", ")}}</div> |
| 106 | + </template> |
| 107 | + <template v-else> |
| 108 | + <template v-for="(value, key) in Object.keys(inferenceDetails[inference._id])"> |
| 109 | + <template v-if="Object.keys(inferenceDetails[inference._id][value]).includes('score')"> |
| 110 | + {{value}}: {{inferenceDetails[inference._id][value]['score']}} |
| 111 | + </template> |
| 112 | + </template> |
| 113 | + |
| 114 | + </template> |
| 115 | + |
98 | 116 | </template> |
99 | 117 | <!-- <div class="md-subhead">Classes: {{inferencedetailed['created_date']}}</div> --> |
100 | 118 |
|
|
627 | 645 | var formData = new FormData() |
628 | 646 | formData.append('blob', file) |
629 | 647 | formData.append("genCaption", "true") |
| 648 | + formData.append("containHeatMap", "true") |
630 | 649 | var options = { |
631 | 650 | method: "POST", |
632 | 651 | body: formData, |
|
638 | 657 | } |
639 | 658 | console.log("formData") |
640 | 659 | console.log(formData) |
| 660 | + console.log("this.$data.url") |
| 661 | + console.log(this.$data.url) |
| 662 | + console.log("options") |
| 663 | + console.log(options) |
| 664 | +
|
641 | 665 | console.log("adding file: " + file.name) |
642 | 666 | // console.log('this.$data.url + "/dlapis/" + this.$data.selectedModel') |
643 | 667 | // console.log(this.$data.url + "/dlapis/" + this.$data.selectedModel) |
|
646 | 670 | fetch("http://localhost:30000/proxypost" + "/api/dlapis/" + this.$data.selectedModel, options).then((res) => { |
647 | 671 | console.log("api call complete") |
648 | 672 | // this.$modal.hide('invoke-modal'); |
649 | | - // console.log(res.text()) |
650 | | - console.log(res) |
651 | 673 | res.json().then((result) => { |
652 | 674 | console.log("json") |
653 | 675 | console.log(result) |
654 | 676 | // this.$data.inferences.append(result) |
655 | 677 | // TODO, this only applies in case of a still image |
656 | | - var labels = Array.from(new Set(result.classified.map((c) => c.label))) |
| 678 | +
|
657 | 679 | var endpoint = result.imageUrl.split('/uploads')[1] |
658 | 680 | // result.classified.filter((c) => ) |
659 | 681 | this.$data.inferenceDetails[result.imageMd5] = {} |
660 | | - labels.map((l) => { |
661 | | - var r = result.classified.filter(c => c.label == l) |
662 | | - var count = r.length //Array.from((new Set(r))).length |
663 | | - console.log("count for " + l) |
664 | | - this.$data.inferenceDetails[result.imageMd5][l] = count |
665 | | - }) |
| 682 | + console.log(JSON.stringify(result)) |
| 683 | + if (Object.keys(result).includes('classified')) { |
| 684 | + // var labels = Array.from(new Set(result.classified.map((c) => c.label))) |
| 685 | + var labels = Array.from(new Set(Object.keys(result.classified).map((c) => c))) |
| 686 | +
|
| 687 | + labels.map((l) => { |
| 688 | + var r = Object.keys(result.classified).filter(c => c.label == l) |
| 689 | + var count = r.length //Array.from((new Set(r))).length |
| 690 | + console.log("count for " + l) |
| 691 | + this.$data.inferenceDetails[result.imageMd5][l] = {"count": count, "score": result.classified[l]} |
| 692 | + // this.$data.inferenceDetails[result.imageMd5]['score'] = result.classified[l] |
| 693 | + }) |
| 694 | + console.log("labels") |
| 695 | + console.log(labels) |
| 696 | + } |
666 | 697 |
|
| 698 | + if (Object.keys(result).includes('heatmap')) { |
| 699 | + var heatmap = result['heatmap'] |
| 700 | + } else { |
| 701 | + var heatmap = "" |
| 702 | + } |
667 | 703 | var inference = { |
668 | 704 | _id: result.imageMd5, |
669 | 705 | created_date: (new Date().toJSON()), |
670 | 706 | thumbnail_path: '/uploads' + endpoint, |
671 | 707 | status: result['result'], |
672 | 708 | model: result['webAPIId'], |
| 709 | + heatmap: heatmap, |
673 | 710 | percent_complete: 100 |
674 | 711 | } |
675 | | - console.log("labels") |
676 | | - console.log(labels) |
677 | 712 | // this.$data.inferenceDetails[result.imageMd5] = //result.classified |
678 | 713 | console.log("appending inference ") |
679 | 714 | console.log(inference) |
680 | 715 | this.$data.inferences.push(inference) |
681 | 716 | // "http://powerai-vision-ny-service:9080/powerai-vision-ny-api/uploads/temp/ee5f1177-7ff1-4cd5-86d2-60faca266c71/16acd8ad-2008-484b-8f7a-e669621852f3.jpg" |
682 | 717 | }).catch((err) => { |
683 | 718 | console.log("error parsing json") |
| 719 | + console.log(err) |
684 | 720 | }) |
685 | 721 | }).catch((err) => { |
686 | 722 | console.log(err) |
|
796 | 832 | var objects = Object.keys(detections) |
797 | 833 | var d = [] |
798 | 834 | objects.map((o) => { |
| 835 | + console.log("adding object " + o) |
799 | 836 | var x = Array.from(Array(detections[o].length + 1).keys()) |
800 | 837 | // d['data'].push({ |
801 | 838 | d.push({ |
|
820 | 857 | formatCircle(inferenceId) { |
821 | 858 | console.log(this.$data.inferenceDetails) |
822 | 859 | console.log("generating line graph for " + inferenceId) |
823 | | - var detections = this.$data.inferenceDetails[inferenceId] |
| 860 | + var detections = this.$data.inferenceDetails[inferenceId]['count'] |
824 | 861 | var objects = Object.keys(detections) |
825 | 862 | var d = { |
826 | 863 | values: [], |
|
0 commit comments