-
Notifications
You must be signed in to change notification settings - Fork 1
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
Inference of GCN model on unseen test data #223
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
"source": [ | ||
"from grace.io.image_dataset import ImageGraphDataset\n", | ||
"from grace.models.feature_extractor import FeatureExtractor\n", | ||
"from grace.evaluation.visualisation import plot_simple_graph\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error trying to run this cell:
ModuleNotFoundError: No module named 'grace.evaluation'
I think there is a missing init.py in the evaluation directory that would make this work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the __init__.py
in the next commit 🚀
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"extractor_filename = \"/Users/kulicna/Desktop/classifier/extractor/resnet152.pt\"\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want people to be able to run this easily maybe we need to add the line to download the resnet before or add a comment to point to where this is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! I included the instructions on how to download the ResNet locally in the training
subfolder README:
grace/grace/training/README.md
Lines 67 to 78 in 488f60b
### Downloading the feature extractor: | |
In case you decide to use a pre-trained image classifier, such as resnet-152, you can use this snippet to import the model, load the default weights & download the model: | |
```sh | |
import torch | |
from grace.models.feature_extractor import resnet | |
resnet_model = resnet(resnet_type="resnet152") | |
extractor_fn = "/path/to/your/feature/extractor/resnet152.pt" | |
torch.save(resnet_model, extractor_fn) | |
``` |
Would you like to see it added in the notebook, too?
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"grace_path = \"/Users/kulicna/Desktop/dataset/shape_stars/train\"\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we should remove path to personal directories if we want these notebooks to be run easily for everyone, we could add a new variable called: input_paht = /path/to/data/
to be replaced by the user.
Also, we need to put this data somewhere and easy to download.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agreed, we had this problem in the examples\
folder where I replaced the path for a user-specified input:
Lines 13 to 20 in 488f60b
# e.g. /Users/kulicna/Desktop/dataset/shape_squares/MRC_Synthetic_File_000.mrc | |
IMAGE_PATH = Path( | |
input( | |
"Enter absolute path to your file " | |
"(e.g. /Users/path/to/your/data/image.mrc, omit ''): " | |
) | |
) |
I'm not sure how to do this from the notebook tho...
Hi @KristinaUlicna, the notebook runs except for the minor comments above but I'm a bit confused about why is the inference done on a notebook and not added to the run.py script as part of the pipeline. Couldn't we just add an |
Also, it would be good to visualise the resulting graph on inference, as described in #222 |
PR contribution summary
Why is this PR useful / good for? Please describe the problem(s) you're trying to address.
GraphLabelPredictor
which updates theGraphAttrs.XXX_PREDICTION
by a vector of numbers for each node and edge:grace/grace/evaluation/inference.py
Lines 35 to 41 in 1e60b41
Annotation.UNKNOWN
relabelling to be separated for nodes & edges.List of proposed changes / linked issues & discussions
normalise
tonormalize
for tests to pass #224What should a reviewer concentrate their feedback on?
infer_predictions.ipynb
, others only have minor documentation / comments changes)What type of PR is this? (check all applicable)
Added tests?
PR review summary
Describe what this PR does & how you reviewed the individual items, where needed:
Some helper checks to tick off:
In conclusion, after my review, I'd like to: