Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
How to preprocess input image in JavaScript for keras resnet152v2?

I'm trying to run ResNet152V2 in TensorFlowJS in Browser, but I've got problem with input processing. In Tensorflow (python), to get correct predictions, all I need to do is call tf.keras.applications.resnet_v2.preprocess_input on inputs before passing them to the model. It scales input pixels between -1 and 1 (according to https://keras.io/api/applications/resnet/).

url = 'my_image.png'

img = image.load_img(url, target_size=(224, 224))

img_array = image.img_to_array(img) 
img_batch = np.expand_dims(img_array, axis=0)
img_preprocessed = tf.keras.applications.resnet_v2.preprocess_input(img_batch)

prediction = model.predict(img_preprocessed)
print(prediction.argmax(axis=-1))

Im trying to find out, how to do it in browser in JavaScript.

Thanks for help

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!