Skip to content

Commit

Permalink
✏️ grammarly check
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Venturelli committed Aug 25, 2021
1 parent 8f63f98 commit ef1b29d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions _posts/2021-08-09-image-resizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ We chose to use synthetic images because we want to evidence the creation of art
<br/>

### Image resizing in ML models
As said in the first part of the article, image resizing could be a problem even in a machine learning application.
As mentioned in the first part of the article, image resizing could be a problem even in a machine learning application.

Imagine you want to use a model from an ML third-party library. For example, you want to solve a problem of instance segmentation from images, and you find that exists a fantastic library from Facebook Research, called [`Detectron2`](https://github.com/facebookresearch/detectron2), which contains the state-of-the-art for this class of problems.
The authors provide all kinds of functionality, including scripts from training and evaluation on your own dataset and even the script for exporting your new trained model.
It could be very difficult and time-consuming to reproduce the same features from scratch, so you decide to use the library in your application.
Imagine you want to use a model from an ML third-party library. For example, you want to solve a problem of instance segmentation from images. You find an incredible library from Facebook Research, called [Detectron2](https://github.com/facebookresearch/detectron2), which contains the state-of-the-art for this class of problems. The authors provide all kinds of functionality, including scripts from training and evaluation on your dataset and even the script for exporting your new trained model. It could be challenging and time-consuming to reproduce the same features from scratch, so you can use the library in your application.

Suppose you train the network on your data, then you want to put the model into production. Your deployment environment is written in C++, so you export the model as `TorchScript` and you use the `PyTorch` C++ library to load the module and run the experiments. You know that `Detectron` needs images with a fixed size as input, then you use `OpenCV` to rescale your input.
If you feed the network with the same images, you will expect to get the same results, but unfortunately, this is not true. You check everything and it seems correct.
If you dig inside the code, you will eventually find that `Detectron` uses `Pillow` to resize the input image, and, as you could see in the section before, the results could be very different.
Suppose you train the network on your data. Then you want to put the model into production. Your deployment environment is written in C++, so you export the model as TorchScript, and you use the PyTorch C++ library to load the module and run the experiments. You know that Detectron needs images with a fixed size as input, then you use OpenCV to rescale your input. If you feed the network with the same images, you will expect the same results, but unfortunately, this is not true. You check everything, and it seems correct. If you dig inside the code, you will eventually find Detectron uses Pillow to resize the input image, and, as you could see in the section before, the results could be very different.

## Conclusion

Expand Down

0 comments on commit ef1b29d

Please sign in to comment.