Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

How to modify AICamera to make it work for detection or segmentation? #74

Open
yxchng opened this issue Mar 25, 2019 · 1 comment
Open

Comments

@yxchng
Copy link

yxchng commented Mar 25, 2019

I have a U-Net model that takes as input image of size (3, 256, 256) and outputs a binary mask of size (1,256,256). I modify the input size to 256x256 and commented out the following part:

constexpr int k = 5;
float max[k] = {0};
int max_index[k] = {0};
// Find the top-k results manually.
if (output_vec.capacity() > 0) {
    for (auto output : output_vec) {
        for (auto i = 0; i < output->size(); ++i) {
            for (auto j = 0; j < k; ++j) {
                if (output->template data<float>()[i] > max[j]) {
                    for (auto _j = k - 1; _j > j; --_j) {
                        max[_j - 1] = max[_j];
                        max_index[_j - 1] = max_index[_j];
                    }
                    max[j] = output->template data<float>()[i];
                    max_index[j] = i;
                    goto skip;
                }
            }
            skip:;
        }
    }

}

for (auto j = 0; j < k; ++j) {
    stringStream << j << ": " << imagenet_classes[max_index[j]] << " - " << max[j] / 10 << "%\n";

}

The code runs but it is always in "Loading ..." mode. The predictor does not seems to give back any output. What should I do to resolve this problem?

@ndinhtuan
Copy link

I have got same problem, Wish some one solved this :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants