Comments (7)
anybody can help me ?
from numpy.net.
Please post a small code example of what you are trying to do.
from numpy.net.
hi, have the same question, how would i convert this code:
rects = detector.detectMultiScale(gray, scaleFactor=1.1,minNeighbors=5, minSize=(30, 30),flags=cv2.CASCADE_SCALE_IMAGE)
# ensure at least one face was found before continuing
if len(rects) > 0:
# determine the largest face area
rect = sorted(rects, reverse=True,key=lambda x: (x[2] - x[0]) * (x[3] - x[1]))[0]
(fX, fY, fW, fH) = rect
# extract the face ROI from the image, then pre-process
# it for the network
roi = gray[fY:fY + fH, fX:fX + fW]
roi = cv2.resize(roi, (48, 48))
roi = roi.astype("float") / 255.0
roi = img_to_array(roi)
roi = np.expand_dims(roi, axis=0)
# make a prediction on the ROI, then lookup the class# label
preds = model.predict(roi)[0]
so here the input is a opencv mat and keras needs the nparray of the rectangle
from numpy.net.
Which library are you using to call OpenCV from C#?
from numpy.net.
I'm using opencvsharp
currently i'm at this state below which looks fishy - but loading the Model.LoadModel("epoch_90.hdf5");
throwing a EEFileLoadException
keeps me from testing if it works yet
Mat roi = frameMat[rects[0]];
Cv2.Resize(roi, roi, new OpenCvSharp.Size(48, 48));
float[] result;
roi.GetArray(out result);
var test = np.asfarray(result) / 255;
test = ImageUtil.ImageToArray(test);
test = np.expand_dims(test, 0);
NDarray nDarray = model.Predict(test[0]);
Console.WriteLine(nDarray.argmax());
from numpy.net.
Is it possible to extract the array values from the OpenCV mat into a C# array? Then you can create an NDarray from those easily and pass it on to Keras
from numpy.net.
@simonbuehler Take a look at SharpCV. It combines the NDArray
and Mat
.
from numpy.net.
Related Issues (20)
- np.load of np.savez impossible to get values back out? HOT 3
- np.array leaks memory HOT 12
- Numpy hangs on exit since version 3.10.1.29 (last stable 3.7.1.28) HOT 7
- Support for CuPy HOT 1
- Please Sign and assign StrongName for Numpy Nuget package
- np.split HOT 12
- `Half` type arrays HOT 7
- Set conditions as NDArray Type HOT 3
- fft() failed: “index -2 is out of bounds for axis 0 with size 1” HOT 9
- Problem with passing imaginery numbers HOT 3
- NDarray of DateTime HOT 3
- Azure AppService and System.DllNotFoundException: Could not load python311.dll with flags RTLD_NOW | RTLD_GLOBAL: python311.dll: cannot open shared object file: No such file or directory HOT 5
- Could not find platform dependent libraries <exec_prefix> HOT 6
- System.TypeLoadException: Could not load type 'Python.Runtime.PyLong' from assembly 'Python.Runtime, Version=3.0.1.0, Culture=neutral, PublicKeyToken=5000fea6cba702dd'. HOT 5
- Numpy.Bare build for Python 3.11 HOT 3
- np.sum(NDArray, axis:1) not supported? HOT 5
- Unable to use Numpy.NET from linux environment HOT 1
- Hello, has SciSharp/NumSharp stopped development and maintenance? HOT 1
- Unable to cast System.Double[][] to NDarray HOT 2
- failed to use "where" in Numpy.NET HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numpy.net.