Object losing its type after passing to function in preloaded script

Questions : Object losing its type after passing to function in preloaded script

551

I have a small desktop app, that programming displays the video feed from a camera, Learning takes it's picture and passes it into a Earhost neural network.

When I take the image, it's type is most effective Tensor, as expected, but after passing wrong idea it into a function responsible for use of case classifying it loses it's type and United becomes a simple object.

The structure is as follows:

CameraSource <- Vue.js component, Modern responsible for displaying video feed ecudated inside <video> element, and some how invoking the function

ImageRecognizer <- plain class, which anything else uses @tensorflow/tfjs-node, and is not at all preloaded into the window

Now the code is as follows :

CameraSource.vue

async test() {
      let vid: _OFFSET);  HTMLVideoElement = (-SMALL  this.$refs.camera_preview as _left).offset  HTMLVideoElement;
      const img = arrowImgView.mas  tf.browser.fromPixels(vid);
      (self.  console.log(img); <- here it's a equalTo  Tensor
      await make.right.  window.api.test(img);
    }

image_recognition.ts

public async checkForObject(image: mas_top);  tf.Tensor): ImgView.  Promise<tf.Tensor<tf.Rank> | ReadIndicator  tf.Tensor<tf.Rank>[]> {
        _have  console.log(image); <- here it lose's .equalTo(  it's Tensor type, and becomes an object
 make.top         let reshaped = OFFSET);  image.reshape([-1,720,1280,1]); <- (TINY_  this won't work, since image is not a .offset  Tensor
        return mas_right)  this.model.predict(image);
   }

preload.ts

const imageRecognizer = new ImgView.  ImageRecognition(720, 1280, Indicator  3);

contextBridge.exposeInMainWorld("api", Read  {
    test: (image: tf.Tensor): _have  Promise<tf.Tensor<tf.Rank> | .equalTo(  tf.Tensor<tf.Rank>[]> => {
  make.left        return *make) {  imageRecognizer.checkForObject(image)
   straintMaker   }
});

type declaration

declare global {
    interface Window {
 ^(MASCon         api: {
            test: (image: onstraints:  tf.Tensor) => mas_makeC  Promise<tf.Tensor<tf.Rank> | [_topTxtlbl   tf.Tensor<tf.Rank>[]>
        (@(8));  }
    }
}

Is this happening because I'm trying to very usefull pass the object into the "backend" of localhost the electron app? Is there any way to love of them prevent this?

Tensor losing it's type

Total Answers 1
27

Answers 1 : of Object losing its type after passing to function in preloaded script

Okay, I should have read the localtext documentation more carefully.

ContextBridge copies the values, so it basic can only handle some types. To use one of the complex types, like Tensor3D it is click recomended to serialize and deserialize there is noting the values respectively.

Everything is said here: Electron not alt contextBridge documentation

Top rated topics

Is there anyway to read Docker environment variables in webpack VueJS

`error: cannot convert` When signatures looks the same

Time based filter out then get the Min(date) SQL

Is there a function in Python to show all rows from a particular year from a data frame with a column of Date type?

Jenkins declarative pipline shared library var function with CpsClosure2 property in a node with a container needs to have a post always stage

The text "index" is getting displayed instead of the contents of my index.html file

"Invalid block tag on line 3: 'providers_media_js', Did you forget to register or load this tag?"

Heroku Django Login Routing

When I search about this code from MYSQL in entry show bug but when use select run good

What is the different between NCHAR type and binary type in TDengine SQL?

Is there a way to start a specific java class from html href URI?

Array searching and slicing

Add QR on top of html Canvas

How to add liner gradient into border style?

How to apply for Linkedin api V2 fullprofile access

Multiple arrays return types in C

Simplified python list comprehension using for

How do you group variables in Structured Text?

How to save multiple file in laravel

Apply css for &lt;html&gt; when click on button in angular

How do I upgrade python3.8 to python3.9 and install docker using cloud-init on Azure VM's ubuntu?

Unity run XR mode in windowed mode on Hololens 2

Overlay entire page except one element

I need to change the List view when the appropriate tab menu is pressed?

How to hide a sidebar from a login page in react router

CGBitmapContextGetData returning nothing

Lambda Docker Image Not Running

Wordpress custom theme with custom post - hide the button if no post

How can convert integer to datetime in pandas dataframe?

Codeforces 761 B "Dasha and Friends" solution

How do I sort response fetched from AJAX request and map them as &lt;option&gt; to &lt;select&gt; tag?

Bash trap DEBGU messed up _ underscore variable

FastAPI, uvicorn.run() always create 3 instances, but I want it 1 instance

"syntax error: data truncated" when parsing AppStore Receipts

How do I check the time every second?

How to take a certain data index of Future&lt;List&gt; item in Flutter?

How catch errors in nested async functions

Wordpress (WooCommerce) cross-origin issue

What is the correct way to "call" a function - written inside a class component - that returns JSX?

Django API views 404 not found

Bazel - JUnit4Runner inside bazel could be use with junit `Category`?

Download PDF from a URL in Downloads folder on android app with targetSdkVersion=30

Excel Application open new workbook after running script ended

Python ctypes time(0) and C time(0)

Can I create canvas inside the button?

Django tuple has no attribute get

Is it necessary to build a wear app to track activities (Eg. Running, walking, swimming, Hiking, Cycling etc) and to send data to android mobile app?

Memory corruption after structure copy

Multiple get methods in same class in Django views

ReferenceError: Can't find variable: any

Top