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

RGB 256*256 image #4

Open
deep0learning opened this issue Dec 8, 2017 · 1 comment
Open

RGB 256*256 image #4

deep0learning opened this issue Dec 8, 2017 · 1 comment

Comments

@deep0learning
Copy link

Can you tell us how can we use your code to classify RGB images.

Our dataset is like that:

class1:
0001.jpg
0002.jpg
Class2:
001.jpg
002.jpg

@cedrickchee
Copy link
Owner

cedrickchee commented Jan 5, 2018

Sorry for the terribly late response. If I understand your intention correctly, you are trying to do inference using the model. Unfortunately, the code has no proper support for inference mode yet. It's actually not hard to make this work based on the existing codebase as we are using PyTorch.

Steps on how to achieve this:

  1. Create a new function in main.py and named it infer. Make this function accept a new input parameter, data for passing in images from your dataset (0001.jpg, 0002.jpg, etc.)
  2. Convert the pixel data from the image file into multi-dimensional array/vector.
  3. Write the code to load the trained or pre-trained weights. In PyTorch, it is easy to do this. Read the PyTorch docs here to find out on how to do that: http://pytorch.org/docs/master/notes/serialization.html#
  4. Copy the following code from the test function and make some slight modification to support the passed in image data instead of data from the dataset.
# arr_image: ndarray type
output = model(arr_image) # output predictions
  1. Extend argparse.ArgumentParser by adding a new option that accept image file paths that will be pass in from your terminal/CLI.
  2. Profit!

I am planning to add that in soon in the codebase. Please read the README for the things I have planned to do soon or in the near future.

Let us know if you have any queries.

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

No branches or pull requests

2 participants