diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9808fc..68b389a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,15 +24,9 @@ jobs: - name: Generate synthetic dataset run: | - python generate_synthetic_dataset.py - python train_color_model.py + python data/generate_synthetic_dataset.py + python app/model/train_color_model.py - name: Run tests run: | - pytest tests/ - - - name: Check test coverage - run: | - pip install coverage - coverage run -m pytest tests/ - coverage report + pytest tests/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2d099ff..24402ae 100644 --- a/.gitignore +++ b/.gitignore @@ -38,8 +38,5 @@ Thumbs.db ehthumbs.db Desktop.ini -# Images and data -tests/images/ - # Logs *.log \ No newline at end of file diff --git a/app/model/train_color_model.py b/app/model/train_color_model.py index 6cedb5c..0f37b82 100644 --- a/app/model/train_color_model.py +++ b/app/model/train_color_model.py @@ -6,7 +6,7 @@ import os # Load dataset -df = pd.read_csv('../../data/dataset.csv') +df = pd.read_csv('./data/dataset.csv') X = df[['H', 'S', 'V']].values y = df['label'].values @@ -18,7 +18,7 @@ model.fit(X_train, y_train) # Save model -os.makedirs('', exist_ok=True) +os.makedirs('./', exist_ok=True) joblib.dump(model, 'color_model.pkl') print("✅ Model trained and saved to app/model/color_model.pkl") diff --git a/dataset.csv b/dataset.csv new file mode 100644 index 0000000..f194d6a --- /dev/null +++ b/dataset.csv @@ -0,0 +1,601 @@ +H,S,V,label +0,16,241,W +0,0,233,W +10,0,240,W +1,0,255,W +5,0,219,W +0,5,255,W +0,0,251,W +4,0,255,W +5,2,255,W +0,0,212,W +0,0,255,W +4,0,255,W +5,0,242,W +0,0,245,W +0,17,255,W +9,3,255,W +0,20,255,W +1,0,255,W +6,1,233,W +2,0,255,W +0,0,255,W +0,24,212,W +1,4,255,W +0,34,255,W +0,4,255,W +0,0,250,W +4,0,233,W +0,14,255,W +3,0,255,W +0,0,249,W +0,16,255,W +0,0,235,W +0,0,233,W +0,33,255,W +7,0,255,W +8,2,227,W +0,33,255,W +11,1,255,W +8,30,255,W +0,0,250,W +3,16,255,W +2,41,255,W +0,30,241,W +0,11,255,W +0,32,254,W +0,3,255,W +4,16,237,W +0,9,245,W +0,0,255,W +0,0,228,W +0,22,252,W +0,12,218,W +7,25,220,W +0,7,248,W +0,0,244,W +1,15,252,W +6,0,249,W +0,12,245,W +10,15,241,W +0,10,255,W +0,0,255,W +0,34,239,W +0,9,223,W +4,11,247,W +0,0,246,W +5,0,255,W +7,0,220,W +1,10,255,W +0,3,255,W +8,0,231,W +6,0,236,W +2,0,255,W +3,0,255,W +0,15,237,W +5,31,210,W +4,0,255,W +6,0,255,W +2,0,233,W +0,6,245,W +0,8,255,W +2,0,250,W +0,0,238,W +0,20,255,W +2,28,255,W +4,40,255,W +0,0,246,W +10,2,238,W +5,17,207,W +0,0,230,W +0,23,234,W +0,7,236,W +0,10,255,W +0,7,247,W +1,1,255,W +0,0,254,W +2,3,240,W +7,6,235,W +0,29,255,W +1,0,240,W +0,38,255,W +23,255,205,Y +31,255,255,Y +21,245,252,Y +15,252,219,Y +16,244,243,Y +30,255,255,Y +27,255,247,Y +35,255,240,Y +31,245,253,Y +27,240,255,Y +7,255,255,Y +25,250,246,Y +21,234,255,Y +23,255,234,Y +21,253,255,Y +30,255,255,Y +23,255,253,Y +20,242,255,Y +22,246,213,Y +21,242,249,Y +34,255,255,Y +9,252,247,Y +25,223,212,Y +21,243,255,Y +24,212,255,Y +23,246,240,Y +28,220,255,Y +21,255,239,Y +22,255,255,Y +27,222,237,Y +17,255,255,Y +25,246,229,Y +22,253,255,Y +34,255,255,Y +18,235,255,Y +26,255,255,Y +26,255,232,Y +18,233,255,Y +30,255,255,Y +18,255,241,Y +26,255,251,Y +17,255,255,Y +38,255,255,Y +26,232,226,Y +27,255,243,Y +27,255,232,Y +31,255,245,Y +30,255,255,Y +32,223,255,Y +22,220,247,Y +32,246,228,Y +21,231,243,Y +21,230,255,Y +29,255,255,Y +29,249,231,Y +20,254,255,Y +22,255,255,Y +29,227,226,Y +20,255,255,Y +20,255,246,Y +14,223,255,Y +21,252,244,Y +23,247,255,Y +28,245,255,Y +20,241,255,Y +20,255,239,Y +24,253,255,Y +33,249,249,Y +26,251,204,Y +26,245,255,Y +23,219,255,Y +26,231,255,Y +30,255,255,Y +23,238,235,Y +25,250,255,Y +32,255,253,Y +19,240,224,Y +21,218,255,Y +16,244,253,Y +18,255,255,Y +18,255,226,Y +22,237,255,Y +15,255,255,Y +20,255,255,Y +30,255,255,Y +25,236,247,Y +23,251,246,Y +16,245,255,Y +27,247,255,Y +30,217,255,Y +25,255,242,Y +20,255,252,Y +19,255,219,Y +24,255,247,Y +28,246,255,Y +20,230,255,Y +19,241,238,Y +21,252,243,Y +28,210,255,Y +27,255,230,Y +8,237,249,R +5,243,255,R +1,255,255,R +0,232,249,R +9,237,255,R +0,253,255,R +0,255,255,R +1,242,227,R +0,255,238,R +7,255,255,R +0,238,255,R +0,235,231,R +0,234,255,R +4,249,255,R +0,255,255,R +0,232,255,R +1,255,254,R +7,246,243,R +4,255,236,R +0,252,242,R +0,247,255,R +3,255,255,R +2,255,255,R +2,255,253,R +0,255,255,R +0,252,255,R +0,255,255,R +2,247,220,R +0,255,255,R +0,238,255,R +6,255,228,R +10,242,255,R +1,252,231,R +0,255,253,R +1,255,255,R +3,255,255,R +6,247,255,R +4,241,255,R +2,254,240,R +0,255,251,R +11,255,255,R +0,255,240,R +3,255,255,R +0,255,255,R +0,255,246,R +3,255,255,R +0,255,255,R +0,246,255,R +0,255,246,R +4,255,255,R +7,255,255,R +0,214,247,R +0,255,245,R +0,235,235,R +3,231,255,R +0,255,241,R +6,241,255,R +0,235,234,R +0,255,255,R +0,255,248,R +1,248,247,R +0,255,255,R +0,232,243,R +0,240,255,R +0,241,210,R +5,255,244,R +4,228,255,R +0,255,255,R +0,255,228,R +0,255,248,R +0,239,238,R +2,255,255,R +0,255,224,R +1,225,237,R +4,255,254,R +6,255,255,R +2,253,255,R +0,224,255,R +0,255,255,R +0,255,255,R +0,236,252,R +1,250,255,R +0,252,254,R +6,245,255,R +0,255,236,R +0,255,249,R +3,215,255,R +7,224,255,R +5,255,248,R +0,255,255,R +0,222,231,R +3,255,255,R +0,236,223,R +3,255,255,R +5,231,232,R +11,255,252,R +8,251,247,R +0,255,255,R +13,255,255,R +2,255,238,R +11,252,255,O +19,245,255,O +16,255,255,O +15,246,255,O +18,255,254,O +12,227,255,O +14,255,235,O +12,246,238,O +21,255,244,O +18,255,255,O +4,255,255,O +12,238,232,O +15,215,255,O +5,234,237,O +13,235,224,O +10,233,255,O +22,222,255,O +20,255,255,O +14,235,254,O +13,255,255,O +24,246,255,O +12,255,233,O +17,255,239,O +5,255,255,O +13,255,239,O +11,255,255,O +13,232,255,O +24,255,255,O +20,241,233,O +18,201,245,O +22,255,234,O +14,189,255,O +17,225,255,O +14,229,246,O +14,187,241,O +18,255,255,O +15,253,242,O +7,255,255,O +18,255,250,O +14,246,246,O +19,246,255,O +19,246,255,O +13,222,251,O +10,221,255,O +17,255,216,O +6,255,248,O +11,253,238,O +22,255,255,O +12,253,241,O +11,255,229,O +5,244,249,O +11,239,255,O +17,255,255,O +13,242,255,O +11,242,255,O +18,255,232,O +20,255,251,O +6,216,248,O +14,255,227,O +10,255,253,O +16,255,255,O +11,236,245,O +17,255,251,O +10,255,217,O +15,255,254,O +17,186,255,O +19,244,255,O +10,246,255,O +12,255,240,O +8,255,255,O +13,229,233,O +4,255,255,O +12,249,255,O +5,218,255,O +19,224,255,O +10,255,255,O +17,243,255,O +13,255,248,O +21,245,255,O +14,226,255,O +10,227,255,O +1,255,247,O +22,251,255,O +10,248,255,O +20,223,255,O +11,252,255,O +12,255,255,O +17,220,241,O +20,255,255,O +16,255,252,O +6,235,255,O +13,250,255,O +14,229,255,O +13,255,246,O +21,255,255,O +20,255,241,O +15,251,255,O +14,255,243,O +14,234,248,O +11,254,255,O +112,255,255,B +112,221,255,B +107,255,255,B +106,241,253,B +117,188,255,B +100,220,252,B +111,221,224,B +108,250,232,B +117,240,255,B +112,242,255,B +108,255,255,B +112,255,255,B +111,252,231,B +106,255,210,B +108,253,233,B +109,244,230,B +106,255,254,B +101,255,255,B +119,230,255,B +108,255,255,B +110,255,247,B +105,214,234,B +116,255,240,B +110,255,238,B +110,243,232,B +113,226,246,B +117,255,247,B +102,236,238,B +107,248,255,B +112,255,255,B +113,218,238,B +109,255,240,B +109,233,232,B +105,237,255,B +110,255,231,B +105,255,255,B +108,249,255,B +110,255,254,B +102,228,242,B +107,255,255,B +112,214,255,B +117,238,255,B +111,250,255,B +113,232,255,B +113,255,255,B +105,222,255,B +113,249,255,B +117,255,253,B +106,246,245,B +107,255,237,B +107,242,255,B +113,255,252,B +101,255,255,B +108,223,255,B +107,255,247,B +104,255,255,B +110,254,246,B +108,217,255,B +115,219,226,B +109,243,249,B +120,208,254,B +114,255,241,B +102,255,241,B +108,255,255,B +107,254,255,B +110,199,255,B +110,247,241,B +113,255,236,B +108,255,222,B +112,237,255,B +110,255,234,B +112,232,255,B +107,255,249,B +123,255,255,B +104,255,240,B +116,227,255,B +104,255,241,B +116,255,234,B +111,255,254,B +110,210,255,B +114,255,225,B +107,191,223,B +107,255,240,B +109,217,255,B +103,236,243,B +105,251,245,B +115,255,240,B +112,247,234,B +113,255,230,B +117,236,255,B +99,255,229,B +108,255,255,B +109,255,251,B +115,255,255,B +114,255,255,B +113,255,255,B +107,255,255,B +102,247,255,B +109,255,255,B +109,255,234,B +64,255,242,G +70,255,255,G +60,244,243,G +58,255,255,G +49,255,250,G +55,255,255,G +51,255,255,G +51,255,255,G +62,255,240,G +63,255,255,G +59,255,252,G +59,242,247,G +57,232,254,G +59,255,217,G +57,226,255,G +58,214,255,G +65,254,255,G +54,255,255,G +61,255,255,G +62,236,243,G +53,248,255,G +56,253,252,G +55,255,234,G +55,216,255,G +57,238,247,G +60,242,233,G +53,248,248,G +56,255,255,G +51,255,255,G +56,255,224,G +59,243,217,G +54,255,255,G +63,229,255,G +67,255,255,G +73,244,255,G +63,255,224,G +54,255,255,G +53,255,255,G +60,249,255,G +59,255,255,G +61,255,255,G +66,241,255,G +63,224,255,G +62,254,247,G +51,255,255,G +63,239,255,G +56,235,250,G +55,247,215,G +63,238,237,G +55,255,238,G +58,249,231,G +60,255,255,G +60,238,255,G +65,231,246,G +55,250,244,G +47,255,255,G +45,241,251,G +58,255,255,G +58,255,237,G +58,255,255,G +64,243,237,G +63,245,255,G +59,255,255,G +60,255,255,G +59,240,240,G +63,252,224,G +65,249,244,G +60,253,221,G +66,233,248,G +55,234,238,G +55,251,255,G +63,239,255,G +69,255,237,G +69,235,255,G +65,244,255,G +57,243,245,G +62,255,255,G +51,255,251,G +56,244,255,G +53,250,255,G +51,255,255,G +61,255,255,G +59,240,255,G +67,255,239,G +62,255,255,G +55,255,255,G +54,243,255,G +59,255,245,G +64,224,246,G +65,255,255,G +61,255,255,G +55,255,219,G +58,255,255,G +57,234,255,G +60,246,253,G +67,237,255,G +63,241,227,G +61,250,255,G +56,255,255,G +59,240,255,G diff --git a/requirements.txt b/requirements.txt index 11a4222..6d1489e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,4 @@ requests~=2.32.3 scikit-learn joblib pandas -pytest -coverage -contextlib \ No newline at end of file +pytest \ No newline at end of file diff --git a/tests/images/dummy.jpg b/tests/images/dummy.jpg new file mode 100644 index 0000000..484dff0 Binary files /dev/null and b/tests/images/dummy.jpg differ