Logistic Regression python code

I have used the dataset of cats vs dogs to train my logistic regression model but I am getting wrong output (I don’t know the implementation of CNN so I used logistic regression). Please review my code. If there is any error please tell me else give me suggestions to improve code and style.

link to dataset: Download Kaggle Cats and Dogs Dataset from Official Microsoft Download Center
link to code: Logistic regression, some error - Pastebin.com


Thank you for pasting the code! Could you paste the error as well? It would help to pinpoint the error location more easily!

Sorry for the late reply, but the code is giving 0 for dog and 1 for cat which is opposite of what it should be. I am not able to understand if there is some logic error in code or I am understanding it incorrectly or is Logistic Regression not great with images.

Did you try for many images?
Or is it just for one image?
I am not sure what the issue is actually…

Thank you for your help! Apparently the images were not loading properly and thus the output was not correct. I changed the pictures and tested on 200 new cat images and the model got around 60% correct labels and around 64 % on 200 dog images. It was totally my mistake for not checking if the images were loading properly.