Create bagofFeatures for code generation

조회 수: 1 (최근 30일)
Michael Sorocky
Michael Sorocky 2023년 6월 20일
댓글: Sahithi Kanumarlapudi 2023년 9월 8일
I'm trying to create a bagOfFeatures for use in a script that will be compiled to C code. The help page for bagOfFeatures states:
For code generation, the bagOfFeatures function does not support the ImageDatastore object as input. Instead, specify the input as a structure with fields Images and Labels. The Images field must contain a cell array of grayscale or RGB color images. The Labels field must contain image labels stored as categorical arrays.
As a result, I cannot use the constructers of the form
bag = bagOfFeatures(imds)
However, if I try to create a structure imds with fields Images and Labels as suggested, I recieve the following error when I run
bofData = bagOfFeatures(imds);
Error using bagOfFeatures/parseInputs
The value of 'imds' is invalid. Expected imds to be one of these types:
imageSet, matlab.io.datastore.ImageDatastore
Instead its type was struct.
This seems to indicate I cannot pass a structure as suggested - how can I create a bagOfFeatures using the specified input? I don't see a Name/Value pair related to this.
Thanks in advance!
  댓글 수: 2
Anush
Anush 2023년 6월 20일
You can try checking out the code with:
edit bagOfFeatures.m
Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2023년 9월 8일
Hi Michael,
Could you attach the script that you have used to create the struct and the script you used to do codegen. It would help us in understanding the issue better.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by