aallali / Leaf-Diseases-Classification

An innovative computer vision project utilizing leaf image analysis for disease recognition.
1 stars 1 forks source link

Predict.py #38

Open panban-ux opened 1 month ago

panban-ux commented 1 month ago

I already augmented the dataset, trained the (.h5) model but i get a bunch of errors inside my IDE.

`### 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last):

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/004-predict.py", line 173, in main()

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/004-predict.py", line 165, in main predict_folder(args.image_path)

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/004-predict.py", line 64, in predict_folder img_predicted_class = predict_image(img_path=img_path, plot=False)

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/004-predict.py", line 82, in predict_image transformer.mask()

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/libft/ft_image_transformer.py", line 105, in mask self.guassian_blur()

File "/home/pan/PycharmProjects/pythonProject/Stafilia/Leaf-Diseases-Classification/libft/ft_image_transformer.py", line 91, in guassian_blur s_thresh = pcv.threshold.binary( TypeError: binary() got an unexpected keyword argument 'max_value'**** ` The command i use with the arguments target a single image Any ideas where to look??

panban-ux commented 1 month ago

PlantCV==3.14.3 is the resolution. As i installed the last version it had a conflict with the "max_value" parameter

BUT!!

I dont know why the older (3.14.3) version breaks the train.py It gives TensorFlow errors, seems strange as during training you don't initialize PlantCV

aallali commented 1 month ago

Hi @panban-ux ,

Sorry for late reply, been a busy days,

Good to hear that you solved the issue, if you check the requirements.txt file i have the versions fixed on purpose especially for PlantCV and TensorFlow , i ran through same compatibility issues with versions. Please re-install packages with requirements.txt and check if u still have any other issues.

Take care :)

panban-ux commented 1 month ago

Hello @aallali and the prompt reply. No problem we all are busy in this life.

Just some observations regarding the classification. I trained the augmented dataset for 50 epochs. If i use a cellphone image~12mpx and assign the argument to a single leaf e.g (/input/1.jpg) i get the prediction displayed in the plot window

If i add 10-14 repository initial dataset images to the folder and the batch argument (/input) i get a different behavior and no detection , e.g 100%|██████████| 14/14 [00:07<00:00, 1.98it/s] 0/14 (0.0%) predicted correctly. The same goes with a bulk of photos i applied, 3 in sum.

As i mentioned above i run the commands from within Pycharm, in this case only i didn't used the "clear &&" flag ahead of the script if that make sense

panban-ux commented 3 weeks ago

How the def predict_folder(folder_path): invokes to detect an image in predict.py? I mean I can change the plot flag to true and and receive the plot detection directly from a folder but not a recursive detection with the tqdm progress bar?

panban-ux commented 3 weeks ago

Accidentally I marked it as closed. Hope it opens

aallali commented 2 weeks ago

provide your discord so we can debug that live.

panban-ux commented 2 weeks ago

panban0384 is my discord id