-
Notifications
You must be signed in to change notification settings - Fork 1.1k
tc.image_classifier.create should have a way to use extracted features #3126
Comments
This is a great idea. It's something we have talked about doing before, see #1916. The main reason we haven't done it already is that we're not sure where to put this new function. The same deep features are used by both the image classifier and the image similarity toolkit. So do we add the My current thinking is that the best places to add it might be under If you have any opinions about where to add it, please let me know. |
I think using the same piece of code at two places will be both confusing and redundant so yes that might be a bad idea but why not create a new module where we can just extract features and use the same in both places. In addition we can make the tc.image_classifier.create accept data in both formats, sframe with image_path or sframe with extracted features and will have an option of saving features after model creation. What are your thoughts? |
I agree we'll need to modify the I think adding a new module (say we call it Another option would be to add a new module and make each model have its own function, i.e. remove the Let me know which of these two options you had in mind. Or if I misunderstood and you had something else in mind. |
I like the later one better and yes It will be relatively cleaner and we can definitely do it. |
any comments? |
@NeerajKomuravalli - Sorry for the delay. I wanted to discuss this matter with my manager before responding. We think having one function under I think it should look like Below is a list of things that will should to be done. There is likely more needed but this should be most of it. Get Deep Features
Image Classifier
Image Similarity
Let me know if you have any questions. Feel free to put up a work in progress pull request at any point, if you would like feedback. |
@TobyRoseman Thanks for the response, that was a very detailed doc. I agree with all your point and will try to send a PR at the earliest and will let you know if I have any doubts. |
@TobyRoseman I was working on all the things we discussed and I realized, to extract features we need to call the |
I think I don't think it should be much work to for it be an SArray rather than an SFrame. The current code should not need to change too much. You're right we will need a |
yes, you are right. I can just create a SFrame and get this done and there is no need for accepting SFrame as input. |
…issing value test (apple#3126)
…wo support functions (apple#3126)
Issue turicreate: I am sorry for the delay I have caused in working on this, I could not really get a lot of time to work on it. Image Analysis
Image classifier
Image similarity
Test image classifier and test image similarity
After finishing all this, I tested the same with both c++ unit test cases and python unit test cases:
Please let me know if the approach I have taken is correct and what do you think of it and if you want I pull put out a WIP pull request for you to check what I have done. |
Hi @NeerajKomuravalli - Wow, this all sounds great. Yes, please put up a WIP pull request and I'll be happy to take a detailed look. I'm not sure what's happening with those exporting to CoreML Python unit test but I'm sure we can figure it out. |
I have put a pull request, please let me know what you think. |
Hi, I have made the required changes, please take a look whenever you can. Thanks! |
Hi, I have made all the necessary changes and have run the test cases as well to see if everything is working as it should. All the test cases are passed successfully except:
My assumption is predict method on Please let me know your thoughts and what are the next steps. |
* Adding features column to the data and compensating for the same in missing value test (#3126) * Adding features column to the data to test with features (#3126) * Changing import statements to make the image_analysis callable (#3126) * Adding get_deep_features module to extract features and adding more two support functions (#3126) * Adding a way to create model by passing either feature column or image column (#3126) * Adding a way to create model by passing either feature column or image column (#3126) * Fixing syntax error * Adding more elaborate error messages to also include Missing value errors * Adding image_classifier test methods to include testing for data with and without extracted_features column * Making Image feature extraction feature more robust and indipendent * Changing the _extract_features functions to first recognize the feature type and then take the decision * Doing small edits * Changing the _extract_features functions to first recognize the feature type and then take the decision * passing model name specifically in test_select_correct_feature_column_to_train test case * Adding a way to account for extracted features instead of images as inoput features in classify, predict and _canonize_input functions * Adding feature based test cases for both image as a feature and extracted features as feature * Using actual features using get_deep_features instead of randomly generating features * Adding test cases for model using both image and extracted_feature as input feature * Removing unnecessary code * Adding a way to accept input as extracted feature in quary function * Created test cases for model that is being trained with deep features * Created test cases for model that is being trained with deep features * Hiding the functions is_image_deep_feature_sarray and find_only_image_extracted_features_column * Changing the function name find_only_image_extracted_features_column to _find_only_image_extracted_features_column as chnages were made in image_analysis * Changing the generic deep feature column name in data generation to the model specific name * Simplifing the code to detect type of sfrane column by using _find_only_column_of_type instead of writing a new logic * Removing unnecessary try except block and correcting spelling mistakes * Debugging to fix _find_only_column_of_type not found error * Fixing all the errors where image_classifier was failing in test cases * Fixing all the errors where image_similarity was failing in test cases * Changing test_export_coreml_predict function to also account for deep features * Changing test_export_coreml function to also account for deep features * Ignoring the coremltools predict test case when deep_features are used * Ignoring the coremltools predict test case when deep_features are used * Adding docstring for get_deep_features * Removing unnecessary code and makeing recommended changes * Ignoring getting deep features when mac version is less than 10.14 or if its a Linux system or any other OS * Removing coremltools import line to adhere to the turicreate testing practices * Shifting deep feature building in from get_test_data to setUpClass (no tested) * Shifting deep feature building in from get_test_data to setUpClass (fully tested) * Shifting deep feature building in from get_test_data to setUpClass * Removing unnecessary comments * Changed the logic that decides when to extract deepFeatures and changed the name of the same to WithDeepFeatures * Using the feature fed to unit test classes based on their names to maintain consistency
The relevant pull request here has been merged and was included in our latest release. Closing. |
The model building with turi create takes most of its time building features and if someone wants to retrain the model with the same data or add just some amount of data it goes through the process of extracting features again and this is a waste of time. Turi Create should have a method of extracting the features and saving the same in sFrame data format and using the same to create the model with either the extracted features or the image data itself.
I could not really find a method which addresses this anywhere in the code or documentation and I would really think this a great feature to have. Please let me know if this is already there and I am not able to find it and if it's not there I would not mind working on it and send a merge request.
The text was updated successfully, but these errors were encountered: