GithubHelp home page GithubHelp logo

perseus784 / bvs Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 22.0 24.78 MB

An Image classifier to identify whether the given image is Batman or Superman using a CNN with high accuracy. (From getting images from google to saving our trained model for reuse.)

Home Page: https://medium.com/@ipaar3/how-i-built-a-convolutional-image-classifier-using-tensorflow-from-scratch-f852c34e1c95

License: MIT License

Python 100.00%
batman bvs cnn-architecture cnn-classifier cnn-model cnn-tensorflow convolutional-neural-networks deeplearning dnn gradient-descent image-classification image-classifier neural-networks python tensorflow tensorflow-models tensorflow-tutorials

bvs's Introduction

bvs's People

Contributors

mrmallik avatar perseus784 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bvs's Issues

Error in running trainer.py

trainer.py
2 ['superman', 'batman']
rawdata/superman
OpenCV(3.4.1) Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /io/opencv/modules/imgproc/src/resize.cpp, line 4044
Traceback (most recent call last):
File "/home/mustafa/Downloads/BvS-master/trainer.py", line 3, in
from utils import utils
File "/home/mustafa/Downloads/BvS-master/utils.py", line 3, in
from config import *
File "/home/mustafa/Downloads/BvS-master/config.py", line 10, in
ppr.image_processing(raw_data,data_path,height,width)
File "/home/mustafa/Downloads/BvS-master/preprocessing.py", line 16, in image_processing
im=cv2.resize(im,(height,width))
cv2.error: OpenCV(3.4.1) /io/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

One image class

I've tried this but I have only 1 class of image. When I run the trainer.py, the loss always giving me 0. Is this still applicable if I have only 1 class of image?

choice_count index out of range

When I run 'trainer.py', I get an error in 'def batch_dispatch' at 'choice_count = self.count_buffer[choice_index]':

File "C:\Users\Garrett\PycharmProjects\basic image recognition\utils.py", line 30, in batch_dispatch
choice_count = self.count_buffer[choice_index]
IndexError: list index out of range

In the 'init' function, it seems that 'count.buffer[]' is just being appended to, the number of (or length of) images in my data folder in which I am running my trainer on. I am just trying to run a very small number of images to make sure that the program runs at first. This means that for my 11 images in the data folder, 'count.buffer' just ends up equaling '[11]'. In batch_dispatch, I am getting a random index from the array of my 11 images, but when this random index, 'choice_index', is run into count.buffer it calls for an index way out of range. Since len(count_buffer) only equals 1 for me, getting a random image that is past the starting position, choice_index>0, will give me an error every time.

I'm sorry I am fairly new to coding. I would just greatly appreciate if you could help me through this error.

Thank you,

Garrett

unable to print the process

I'm using tensorflow 1.14, and cuda version is 8.0
there is no such things on my screen:

epoch 10 ....
loss ....

Is it caused by different tensorflow version?

AttributeError: 'str' object has no attribute '_run'

When I call python ./predict.py, I get the following error. any idea?


Traceback (most recent call last):
  File "./predict.py", line 27, in <module>
    saver.restore(session,os.path.join(model_folder))
  File "C:\Users\ALIEN\Anaconda3\lib\site-packages\tensorflow_core\python\training\saver.py"
, line 1290, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "C:\Users\ALIEN\Anaconda3\lib\site-packages\tensorflow_core\python\client\session.py"
, line 955, in run
    result = self._run(None, fetches, feed_dict, options_ptr,
AttributeError: 'str' object has no attribute '_run'

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 1: invalid start byte

When running predict.py, I get this error.

2019-01-12 14:00:12.547769: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "C:/Users/Garrett/PycharmProjects/workkkk/predict.py", line 17, in
saver = tf.train.import_meta_graph(os.path.join(model_folder,'.meta')) #saver = tf.train.import_meta_graph(os.path.join(model_folder,'.meta'))
File "C:\Users\Garrett\PycharmProjects\workkkk\venv\lib\site-packages\tensorflow\python\training\saver.py", line 1674, in import_meta_graph
meta_graph_or_file, clear_devices, import_scope, **kwargs)[0]
File "C:\Users\Garrett\PycharmProjects\workkkk\venv\lib\site-packages\tensorflow\python\training\saver.py", line 1686, in _import_meta_graph_with_return_elements
meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file)
File "C:\Users\Garrett\PycharmProjects\workkkk\venv\lib\site-packages\tensorflow\python\framework\meta_graph.py", line 644, in read_meta_graph_file
text_format.Merge(file_content.decode("utf-8"), meta_graph_def)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 1: invalid start byte

When I ran the trainer, it saved a checkpoints.index, checkpoints.meta and checkpoints.data-00000-of-00001 file in my current working directory, not in the checkpoints folder. However, I saw that they needed to be named .meta, .index, and .data-00000-of-00001 for predict,py to work. It wouldn't let me change the file names directly, so I converted them to notepads, saved them as their correct names, and then converted them back to unknown files. I am able to reach the files inside checkpoints folder with predict.py now, but I get this decode error.

I think the trainer may have saved the files with wrong names in the first place because I changed model_save_name='checkpoints' in config.py to model_save_name='./checkpoints'. I did this because I would get an error running trainer.py: ValueError: Parent directory of checkpoints doesn't exist, can't save. Adding the "./" would allow the trainer to run without error, but this may be why the checkpoint files saved wrong.

It would be great if you could help me through this.

Thank you,

Garrett

No Accuracy Metrics

This is great work and looks like it took a considerable amount of effort. But, projects like this always include accuracy metrics to convince others its worth implementing and correct. All I was able to find was "It is actually pretty good. It is almost right all the time. " It should only take an hour to implement a cross validated accuracy, precision, and recall scores.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.