City-Segmentation-Inpainting is an image segmentation model that allows you to remove specific classes within an image and then replace them with diffusion based in fill.
The data used to train this model can be found here. A more detailed discussion of its limitations and potential pitfalls can be found in the Ethics statement.
in the Naïve model there are very simple functions for converting to greyscale, segmenting by a set amount and then reconstructing the image. An example of usage is given in the 'Example use' function.
In the Classical model there is extensive functions for testing and evaluation of the segmentation technique. A demonstration of these evaluation techniques is shown in the eval_on_dataset function. The segment_Kmeans function provides the core functionality for the segmentation, it should be passed an image and returns the segmented version.
The Deep Learning Model model is a U-Net model trained from scratch, the training code for this is included in this script. This is by far our most accurate model.
To manage dependencies, it's recommended to use a virtual environment.
python -m venv venv-
On macOS/Linux:
source venv/bin/activate -
On Windows (Command Prompt):
venv\Scripts\activate
-
On Windows (PowerShell):
venv\Scripts\Activate.ps1
pip install -r requirements.txt4. Run main
There are no models stored directly in this repo, this is because K-Means is not stored as a model and the U-Net is too large, and thus hosted externally.
You can find our model hosted here on huggingface
Notebooks folder includes the notebook for training the U-net.
The web app is included here, this demonstrates the entire project as an interactive experience. A video demonstration is shown here.