Skip to content

Commit

Permalink
[ADD] added AGPL 3 LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecinspace committed Feb 22, 2024
1 parent 848f7c1 commit e81fab2
Show file tree
Hide file tree
Showing 23 changed files with 952 additions and 8 deletions.
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Data Augmentation with Stable Diffusion for Object Detection using YOLOv8
# CIA: Controllable Image Augmentation Framework based on Stable Diffusion Synthesis

This is a data generation framework that uses [Stable Diffusion](https://huggingface.co/blog/stable_diffusion)
with [ControlNet](https://huggingface.co/blog/train-your-controlnet).
Models can be trained using a mix of real and generated data. They can also be logged and evaluated.
This is a data generation framework that uses [Stable Diffusion](https://huggingface.co/blog/stable_diffusion) with [ControlNet](https://huggingface.co/blog/train-your-controlnet), to do Data Augmentation for Object Detection using [YOLOv8](https://github.com/ultralytics/ultralytics)

Models can be trained using a mix of real and generated data. They can also be logged and evaluated.

<img src="docs/images/general_pipeline.png" />

Expand Down
13 changes: 13 additions & 0 deletions conf/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

data:
base: "data"
real: "real" # should contains images/, labels/, and captions/ (captions are optional)
Expand Down
28 changes: 28 additions & 0 deletions conf/vocabulary-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

comment:
vocabulary: "You can add the vocabulary classes (variables to be used in the prompt) as keys and its possible values in the form of a list"
prompt_templates: "Each template (with variables as in vocabulary keys) should be an element in the list. The variables in the templates should start with 'opt_<vocabulary key>'. In case of colors it should be 'opt_color<number>', where number is the color number of that template (opt_color1, opt_color2,..) if you possibly want a different color for each color number. Make sure that the color numbers are in increasing numerical order."
vocabulary:
gender: ["man", "woman", "boy", "girl", "kid", "person"]
# age: ["infant", "toddler", "child", "young", "middle aged", "old"]
ethnicity: ["caucasian", "african", "asian", "hispanic", "middle eastern", "native american", "pacific islander", "mixed"]
# attractiveness: ["attractive", "unattractive", "ugly", "beautiful"]
emotions: ["happy", "sad", "angry", "neutral", "surprised", "disgusted", "scared"]
prompt_templates: [
"a opt_emotions opt_attractiveness opt_ethnicity opt_gender",
"a opt_emotions opt_attractiveness opt_ethnicity opt_gender",
"a opt_emotions opt_attractiveness opt_ethnicity opt_gender",
"a opt_emotions opt_attractiveness opt_ethnicity opt_gender"
]
13 changes: 13 additions & 0 deletions conf/vocabulary.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

comment:
vocabulary: "You can add the vocabulary classes (variables to be used in the prompt) as keys and its possible values in the form of a list"
prompt_templates: "Each template (with variables as in vocabulary keys) should be an element in the list. The variables in the templates should start with 'opt_<vocabulary key>'. In case of colors it should be 'opt_color<number>', where number is the color number of that template (opt_color1, opt_color2,..) if you possibly want a different color for each color number. Make sure that the color numbers are in increasing numerical order."
Expand Down
17 changes: 13 additions & 4 deletions plot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 10:49:24 2023

@author: tgodelaine
"""
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.


import os
import sys
Expand Down
13 changes: 13 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/usr/bin/bash

# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

# Current possibilities:
# - gen for generation
# - coco for downloading and preparing coco
Expand Down
13 changes: 13 additions & 0 deletions src/coco.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import cv2
import hydra
import os
Expand Down
13 changes: 13 additions & 0 deletions src/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import cv2
import logging
import matplotlib.pyplot as plt
Expand Down
13 changes: 13 additions & 0 deletions src/coreset_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import yaml
import numpy as np
import scipy as sc
Expand Down
13 changes: 13 additions & 0 deletions src/create_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import random
Expand Down
13 changes: 13 additions & 0 deletions src/create_n_train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import sys
Expand Down
13 changes: 13 additions & 0 deletions src/download.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

# Written on top of local package wandb==0.12.1 and remote api 0.13.3
# "wandb login" in a terminal before using this script
# Runs states : finished, running, crashed
Expand Down
13 changes: 13 additions & 0 deletions src/extractors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import cv2
import numpy as np
import torch
Expand Down
13 changes: 13 additions & 0 deletions src/flickr30k.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import cv2
Expand Down
13 changes: 13 additions & 0 deletions src/gen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import glob
import hydra
import os
Expand Down
13 changes: 13 additions & 0 deletions src/generators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import numpy as np
import random
import torch
Expand Down
13 changes: 13 additions & 0 deletions src/iqa.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import matplotlib.pyplot as plt
import os
Expand Down
13 changes: 13 additions & 0 deletions src/iqa_paper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import re
Expand Down
13 changes: 13 additions & 0 deletions src/load_iqa_metrics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import matplotlib.pyplot as plt
import os
Expand Down
13 changes: 13 additions & 0 deletions src/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

# Written on top of local package wandb==0.12.1 and remote api 0.13.3
# "wandb login" in a terminal before using this script
# Runs states : finished, running, crashed
Expand Down
13 changes: 13 additions & 0 deletions src/train-corset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import sys
Expand Down
13 changes: 13 additions & 0 deletions src/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# © - 2024 Université de Mons, Multitel, Université Libre de Bruxelles, Université Catholique de Louvain

# CIA is free software. You can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or any later version. This program is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details. You should have received a copy of the Lesser GNU
# General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.

import hydra
import os
import sys
Expand Down

0 comments on commit e81fab2

Please sign in to comment.