Skip to content

Commit

Permalink
[Docs] Update install tutorials. (#854)
Browse files Browse the repository at this point in the history
* [Docs] Update install tutorials.

* [Docs] Improve dataset docs

* Add option to show the results in demo.

* fix typo
  • Loading branch information
mzr1996 authored Jun 1, 2022
1 parent 877ea30 commit 3e198e6
Show file tree
Hide file tree
Showing 12 changed files with 760 additions and 307 deletions.
10 changes: 9 additions & 1 deletion demo/image_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser

import mmcv

from mmcls.apis import inference_model, init_model, show_result_pyplot


Expand All @@ -9,6 +11,10 @@ def main():
parser.add_argument('img', help='Image file')
parser.add_argument('config', help='Config file')
parser.add_argument('checkpoint', help='Checkpoint file')
parser.add_argument(
'--show',
action='store_true',
help='Whether to show the predict results by matplotlib.')
parser.add_argument(
'--device', default='cuda:0', help='Device used for inference')
args = parser.parse_args()
Expand All @@ -18,7 +24,9 @@ def main():
# test a single image
result = inference_model(model, args.img)
# show the results
show_result_pyplot(model, args.img, result)
print(mmcv.dump(result, file_format='json', indent=4))
if args.show:
show_result_pyplot(model, args.img, result)


if __name__ == '__main__':
Expand Down
82 changes: 82 additions & 0 deletions docs/en/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Frequently Asked Questions

We list some common troubles faced by many users and their corresponding
solutions here. Feel free to enrich the list if you find any frequent issues
and have ways to help others to solve them. If the contents here do not cover
your issue, please create an issue using the
[provided templates](https://github.com/open-mmlab/mmclassification/issues/new/choose)
and make sure you fill in all required information in the template.

## Installation

- Compatibility issue between MMCV and MMClassification; "AssertionError:
MMCV==xxx is used but incompatible. Please install mmcv>=xxx, <=xxx."

Compatible MMClassification and MMCV versions are shown as below. Please
choose the correct version of MMCV to avoid installation issues.

| MMClassification version | MMCV version |
|:------------------------:|:---------------------:|
| dev | mmcv>=1.5.0, <1.6.0 |
| 0.23.0 (master) | mmcv>=1.4.2, <1.6.0 |
| 0.22.1 | mmcv>=1.4.2, <1.6.0 |
| 0.21.0 | mmcv>=1.4.2, <=1.5.0 |
| 0.20.1 | mmcv>=1.4.2, <=1.5.0 |
| 0.19.0 | mmcv>=1.3.16, <=1.5.0 |
| 0.18.0 | mmcv>=1.3.16, <=1.5.0 |
| 0.17.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.16.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.15.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.15.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.14.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.13.0 | mmcv>=1.3.8, <=1.5.0 |
| 0.12.0 | mmcv>=1.3.1, <=1.5.0 |
| 0.11.1 | mmcv>=1.3.1, <=1.5.0 |
| 0.11.0 | mmcv>=1.3.0 |
| 0.10.0 | mmcv>=1.3.0 |
| 0.9.0 | mmcv>=1.1.4 |
| 0.8.0 | mmcv>=1.1.4 |
| 0.7.0 | mmcv>=1.1.4 |
| 0.6.0 | mmcv>=1.1.4 |

```{note}
Since the `dev` branch is under frequent development, the MMCV
version dependency may be inaccurate. If you encounter problems when using
the `dev` branch, please try to update MMCV to the latest version.
```

- Using Albumentations

If you would like to use `albumentations`, we suggest using `pip install -r requirements/albu.txt` or
`pip install -U albumentations --no-binary qudida,albumentations`.

If you simply use `pip install albumentations>=0.3.2`, it will install `opencv-python-headless` simultaneously
(even though you have already installed `opencv-python`). Please refer to the
[official documentation](https://albumentations.ai/docs/getting_started/installation/#note-on-opencv-dependencies)
for details.

## Coding

- Do I need to reinstall mmcls after some code modifications?

If you follow [the best practice](install.md) and install mmcls from source,
any local modifications made to the code will take effect without
reinstallation.

- How to develop with multiple MMClassification versions?

Generally speaking, we recommend to use different virtual environments to
manage MMClassification in different working directories. However, you
can also use the same environment to develop MMClassification in different
folders, like mmcls-0.21, mmcls-0.23. When you run the train or test shell script,
it will adopt the mmcls package in the current folder. And when you run other Python
script, you can also add ``PYTHONPATH=`pwd` `` at the beginning of your command
to use the package in the current folder.

Conversely, to use the default MMClassification installed in the environment
rather than the one you are working with, you can remove the following line
in those shell scripts:

```shell
PYTHONPATH="$(dirname $0)/..":$PYTHONPATH
```
4 changes: 3 additions & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ You can switch between Chinese and English documentation in the lower-left corne

.. toctree::
:maxdepth: 1
:caption: Changelog
:caption: Notes

changelog.md
compatibility.md
faq.md

.. toctree::
:caption: Language Switch
Expand Down
Loading

0 comments on commit 3e198e6

Please sign in to comment.