Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a problem #1

Open
constatnt opened this issue Oct 8, 2018 · 3 comments
Open

I have a problem #1

constatnt opened this issue Oct 8, 2018 · 3 comments

Comments

@constatnt
Copy link

Hi, I have a problem.
Using your data (cfg, weight), The accuracy is very low.
I modified my darknet code using this information(pjreddie/darknet#1103).
But the accuracy is same.
Can you help me ?

@azuryl
Copy link
Owner

azuryl commented Nov 3, 2018

you need to change
image load_image_stb_squeezenet(char *filename, int channels)
{
int w, h, c;
unsigned char *data = stbi_load(filename, &w, &h, &c, channels);
if (!data) {
fprintf(stderr, "Cannot load image!!!!!!!!!!!! "%s"\nSTB Reason: %s\n", filename, stbi_failure_reason());
exit(0);
image im;
im.data=0;
return im;
}
if(channels) c = channels;
int i,j,k;
image im = make_image(w, h, c);

 //For Squeezenet
for(k = 0; k < c; ++k){
    for(j = 0; j < h; ++j){
        for(i = 0; i < w; ++i){
                            if (k==0) {
                                    int dst_index = i + w*j + w*h*(k+2);
                                    int src_index = k + c*i + c*w*j;
                                    im.data[dst_index] = ((float)data[src_index]-123);
                            }
                            if (k==1) {
                                    int dst_index = i + w*j + w*h*k;
                                    int src_index = k + c*i + c*w*j;
                                    im.data[dst_index] = ((float)data[src_index]-117);
                            }
                            if (k==2) {
                                    int dst_index = i + w*j + w*h*(k-2);
                                    int src_index = k + c*i + c*w*j;
                                    im.data[dst_index] = ((float)data[src_index]-104);
                            }
        }
    }
}

free(data);
return im;

}

@92jisuk
Copy link

92jisuk commented Jan 14, 2019

Hi. Thank you for sharing your code.

I downloaded your cfg file and weight file and run following command:
./darknet classifier predict cfg/imagenet1k.data cfg/squeezenet.cfg squeezenet_darknetformat.weight data/dog.jpg

In this command, cfg/squeezenet.cfg and squeezenet_darknetformat.weight is downloaded from your github.
And cfg/imagenet1k.data and data/dog.jpg is basic files of darknet.

I also changed the image.c file following your reply of this issue.

But an accuracy is very low...
Should I perform a training for high accuracy?

Thank you.

@azuryl
Copy link
Owner

azuryl commented Apr 16, 2019

no I am not trained, you also should change the code in classifier.c to call the load_image_stb_squeezenet()

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

No branches or pull requests

3 participants