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

Finetune guide for semantic segmentation #18640

Merged
merged 11 commits into from
Sep 2, 2022

Conversation

stevhliu
Copy link
Member

@stevhliu stevhliu commented Aug 16, 2022

This PR creates a finetune guide for semantic segmentation in the docs. Unlike previous finetune guides, this one will include:

  • metrics for evaluation
  • a section for how to use the model for inference
  • an embedded Gradio demo

🚧 To do:

  • create section for inference
  • create Gradio demo

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 16, 2022

The documentation is not available anymore as the PR was closed or merged.

@stevhliu stevhliu requested a review from NielsRogge August 17, 2022 20:53

## Preprocess

Next, load a SegFormer feature extractor to process the image into an array of tensors. Some datasets, like this one, uses the zero-index as the background class. However, the background class isn't included in the 150 classes, so you'll need to set `reduce_labels=True` to subtract one from all the labels. The zero-index is replaced by `255` so it's ignored by SegFormer's loss function:
Copy link
Contributor

@NielsRogge NielsRogge Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, note that we're currently in the process of replacing feature extractors by image processors, as feature extractor is a confusing name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, I'll update this again once the image processors are ready

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!

docs/source/en/tasks/semantic_segmentation.mdx Outdated Show resolved Hide resolved
docs/source/en/tasks/semantic_segmentation.mdx Outdated Show resolved Hide resolved
@stevhliu stevhliu changed the title [WIP] Finetune guide for semantic segmentation Finetune guide for semantic segmentation Sep 2, 2022
@stevhliu stevhliu marked this pull request as ready for review September 2, 2022 00:03
Copy link
Contributor

@NielsRogge NielsRogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this!

@stevhliu stevhliu merged commit ae32f3a into huggingface:main Sep 2, 2022
@stevhliu stevhliu deleted the segmentation-guide branch September 2, 2022 19:30
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
* 📝 first draft

* oops add to toctree

* make style

* 📝 add inference section

* 🖍 make style

* 📝 add images

* 🖍 apply feedbacks

* remove num_labels and pytorch block

* apply feedbacks, add colab notebook

Co-authored-by: Steven <stevhliu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants