Skip to main content

All Questions

Tagged with
0 votes
0 answers
54 views

how could I change the format of every image in an array in python?

i know it sounds simple but I do not know what am i doing wrong, I'm trying to make a face detection model using GAN (Generative Adversive Networks) I don´t know if it will work but first I need to ...
Dogobrack34's user avatar
0 votes
1 answer
36 views

TensorFlow sequential model is not recognising the full shape of the data

import tensorflow as tf from traffic import IMG_WIDTH, IMG_HEIGHT import cv2 import os import numpy as np model = tf.keras.models.load_model("neural-network") image = cv2.imread("gtsrb\\...
Tim Wolstenholme's user avatar
0 votes
0 answers
766 views

'KerasTensor' object has no attribute 'numpy' when trying to convert KerasTensor to NumPy array - how to fix?

I'm working on a deep learning project using Keras, and I'm trying to convert a KerasTensor object to a NumPy array using the numpy() method, but I'm getting an AttributeError: import tensorflow as tf ...
Tom Berry's user avatar
0 votes
0 answers
476 views

How to convert KerasTensor to numpy array or TensorFlow EagerTensor?

I have a KerasTensor object with shape (None, 128, 128, 1) that I need to pass to an OpenCV function. However, I'm having trouble converting the KerasTensor to either a numpy array or a TensorFlow ...
Tom Berry's user avatar
0 votes
0 answers
35 views

How to fix Argument must be a dense tensor error while converting numpy image array to tensor array?

I'm trying to convert numpy image array to tensor image array as below img = cv2.imread(r'source_img.jpg') img shape (128, 128, 3) and numpy array as below [[[102 102 94] [ 99 100 92] [ 98 99 91]...
godzillabeast's user avatar
0 votes
1 answer
8k views

I get this error --> AttributeError: 'NoneType' object has no attribute 'predict'

I get this error many times. Traceback (most recent call last): File "E:\AI and ML-pr\day14\test.py", line 38, in <module> ...
Dev's user avatar
  • 130
0 votes
1 answer
287 views

How to code for the object detection using python opencvDNN professionaly with minimum CPU and memory usage?

I am trying to run multiple inferences of Tensorflow's SSD model from the model zoo on the CPU to detect and track 'cars' in the CCTV feed using the OpenCV DNN module with Python on Windows server ...
Gaurav Sisodia's user avatar
0 votes
1 answer
2k views

OpenCV grayscale image has shape (H,W) but I need (H,W,1) for Tensorflow [closed]

I use this command to convert an open cv image from RGB to grayscale: img = cv2.cvtColor(np.float32(img), cv2.COLOR_BGR2GRAY) # Grayscale image Printing the shape before this command returns the ...
Daniel's user avatar
  • 995
6 votes
2 answers
8k views

How can I return a NumPy array using FastAPI?

I have a TensorFlow Keras deep learning model in the form of an h5 file. How can I upload an image and return a NumPy array in FastAPI? import numpy as np import cv2 from fastapi import FastAPI, File, ...
Radon333's user avatar
  • 122
0 votes
0 answers
369 views

InvalidArgumentError: Unknown image file format. One of JPEG, PNG, GIF, BMP required. [Op:DecodeJpeg]

Hi there I'm quite new to this sort of stuff, I'm at the final stages of completing my facial verification software and everything has run smoothly right up to the last section. I've had an error. It ...
Freddie's user avatar
0 votes
1 answer
235 views

how to add one dimension in the front of an image?

Now I have change a image (32,32) to (32,32,1) by these methods img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) img = np.expand_dims(img, axis=-1) img = img.astype(np.float32)/255 img = tf.image.resize(...
4daJKong's user avatar
  • 2,077
0 votes
0 answers
233 views

raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (3, 3, 3, 32) and (3, 3, 3, 16) are incompatible

I am trying to use yolov3 and tensorflow to detect objects and i was following the youtube tutorial to understand what im doing since i dont have experience in coding. after i ran the code i got this ...
azarath's user avatar
0 votes
1 answer
392 views

Error bitwise error img = cv2.bitwise_and(img, imgInv, mask=None)

This is my eror C:\Users\User\PycharmProjects\VirtualPainter\venv\Scripts\python.exe C:/Users/User/PycharmProjects/VirtualPainter/main.py INFO: Created TensorFlow Lite XNNPACK delegate for CPU. ...
Glenn Ramadhan's user avatar
0 votes
1 answer
919 views

How to apply the same preprocessing steps to a numpy array that keras applied to images during training?

Problem Setup I have a collection of float32 numpy arrays (say: (100, 100) each) that belong to several classes. I've created an image dataset from them by saving them to the disk (DATA_SET_PATH) ...
akilat90's user avatar
  • 5,716
1 vote
1 answer
341 views

Show Mask Object Detection On Screen instead of Camera

So I've been following this tutorial to detect if person wearing mask or not on camera and got everything to work when using the camera by using the following code: vs = cv2.VideoCapture(0) while True:...
theknig's user avatar
  • 13

15 30 50 per page