joaopauloschuler / two-branch-plant-disease

Source code for the paper "Color-aware two-branch DCNN for efficient plant disease classification".
GNU General Public License v3.0
13 stars 4 forks source link

Problems in imports section #1

Closed fjmsouza closed 1 year ago

fjmsouza commented 1 year ago

Hi, Joao! Thank you for your contribution. I was trying run this code, but I spent a lot of time in the imports section, precisely regard to: ModuleNotFoundError: No module named 'keras_applications'

Screenshot from 2022-12-13 01-12-35

Have you any tip?

joaopauloschuler commented 1 year ago

Hi Flávio, Are you trying to run the original code used for the paper or the updated code that should run on tensorflow 2.8 and later? Due to library updates, the code used for the paper doesn't run on current tensorflow/keras. As of the writting of this readme file, the current version of tensorflow is 2.8. An updated version of the code was done after the paper publication. This version is now compatible with tensorflow 2.8:

I can't change the original code as it's an evidence of what was done for the paper.

fjmsouza commented 1 year ago

Dear, João. Thank you for your attention. Yes, I was running the version updated to tensorflow 2.8, that ran ok. But, due when I saw the result a little bit different ("Epoch 30: val_accuracy improved from 0.99254 to 0.99263,", in a first time, and, "Epoch 30: val_accuracy did not improve from 0.99097", in a second attempt; differently from the paper's result, 99.48%) I decided to run the raw code, to see what was the behavior. Would it be an expected behavior due to the randomness of the initialization of the weights?

joaopauloschuler commented 1 year ago

Dear @fjmsouza , Glad to help.

The paper reports test accuracy (not validation accuracy). The test accuracy is calculated with the test subset (not validation subset).

Some small fluctuation in the result is expected from run to run. This is normal.

To be able to get results similar to the paper, you'll need to use:

input_shape=(224,224,3)

It will require a lot of RAM.

In the raw file, you can find the test accuracy after the acc : Testing Last Model: two-path-inception-v6-False-0.1 10876/10876 [==============================] - 30s 3ms/step loss 0.025440586953992164 acc 0.9918168187141418

In the filename two-path-inception-v6-False-0.1, 0.1 means 0.1L+0.9AB.

fjmsouza commented 1 year ago

Thank you for your support, I'll follow the tips, but, one more doubt:

Testing Last Model: two-path-inception-v6-False-0.5 10876/10876 [==============================] - 29s 3ms/step loss 0.09818798412079315 acc 0.9694740772247314

Testing Last Model: two-path-inception-v6-False-0.8 10876/10876 [==============================] - 29s 3ms/step loss 0.03349226882522234 acc 0.9905295968055725

I didn't get to find where is this values in the 3rd table:

image

joaopauloschuler commented 1 year ago

@fjmsouza , I gave you bad information, You should look at "Best Model Results" and not at "Testing Last Model".

Regarding 0.8L (80%L+20%AB), your result is a precise hit (99.05%). 0.02% difference is very close.

fjmsouza commented 1 year ago

@joaopauloschuler Ok, I'll see there. But this result isn't mine, 99.05 was the exposed result in the raw code: https://github.com/joaopauloschuler/two-branch-plant-disease/blob/main/raw/two-paths-plant-village/two_path_inception.ipynb

As you can see:

Best Model Results: two-path-inception-v6-False-0.8 10876/10876 [==============================] - 29s 3ms/step loss 0.03349226882522234 acc 0.9905295968055725

joaopauloschuler commented 1 year ago

@fjmsouza

0.2L is correct: Best Model Results: two-path-inception-v6-False-0.2 10876/10876 [==============================] - 31s 3ms/step loss 0.01862714639965264 acc 0.9947590827941895

0.5L is correct except for the rounding error (should be 99.12%): Best Model Results: two-path-inception-v6-False-0.5 10876/10876 [==============================] - 30s 3ms/step loss 0.03204927188806493 acc 0.9911732077598572

0.8L is incorrect. You found a mistake from myself! Best Model Results: two-path-inception-v6-False-0.8 10876/10876 [==============================] - 29s 3ms/step loss 0.03349226882522234 acc 0.9905295968055725

The result on the table is wrong by 0.03%.

joaopauloschuler commented 1 year ago

@fjmsouza , Would you mind if I close this ticket? If you believe that I haven't replied to all your questions, please feel free to bring it to my attention.