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

How to use color img instead of grayscale img #185

Open
tingfengwanxiao opened this issue Jan 3, 2023 · 5 comments
Open

How to use color img instead of grayscale img #185

tingfengwanxiao opened this issue Jan 3, 2023 · 5 comments

Comments

@tingfengwanxiao
Copy link

I see the img using grayscale ,how to using color img to get more Color feature

@williamfzc
Copy link
Owner

Duplicated with #184

BTW, what kind of features?

@tingfengwanxiao
Copy link
Author

It's like using three channels instead of a single grayscale channel

@williamfzc
Copy link
Owner

You can use toolbox to grab the origin frames.

from stagesepx import toolbox

with toolbox.video_capture(self.video_path) as cap:
    frame = toolbox.get_frame(cap, self.frame_id)

@tingfengwanxiao
Copy link
Author

emm,It's the problem.In your code
image
to make orign img to gray to train and test,like (100,100),but I want to using orign img (100,100,3),so I change the code like this

image
but it make the problem
ValueError: Input 0 of layer conv2d is incompatible with the layer: expected axis -1 of input shape to have value 1 but received input with shape (None, 200, 200, 3) in keras train and test,so have you try to using orign img to train and test,I think it may get better result

@williamfzc
Copy link
Owner

Cool it's a good point. I have not tried it.

input_shape = (1, *self.data_size)

ValueError was caused by our pre-defined keras model.
As you can see we lock the channel to 1.

You can try to extend KerasClassifier and create your own model for test.
Or just change 1 to 3.

https://github.com/rdcolema/keras-image-classification/blob/9d4b678d33410a7c848dee85e86be5d624de7046/img_clf.py#L43

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

No branches or pull requests

2 participants