I am Atharva Malode, a fresh graduate and a research fellow at CSIR-NEERI, a Government of India organization for environmental research. I graduated few months back and enjoy working in the research and machine learning domain.
Here are my tasks for the project ArtExtract: Painting in Painting.
To run the project, follow these steps:
-
Clone the Repository
Clone the GitHub repository using the following command or download it as a ZIP file:
git clone <repository_link>
-
Create and Activate the Conda Environment
Navigate to the project root directory and create the Conda environment using the
environment.ymlfile:conda env create -f environment.yml conda activate <your_env_name>
-
Run Task 1
Navigate to the
task1directory:cd task1Open Jupyter Notebook and run
tutorial.ipynb -
Run Task 2
Navigate to the
task2directory:cd task2Open Jupyter Notebook and run
tutorial.ipynb:
Build a model based on convolutional-recurrent architectures for classifying Style, Artist, Genre, and other attributes. The goal was to select the most appropriate approach, discuss the strategy, and implement it using the ArtGAN WikiArt dataset.
The approach combines traditional feature extraction with deep learning techniques:
- Gabor Filters: Used to extract texture-based features, capturing brush stroke patterns and stylistic elements in the paintings.
- ConvNeXt (Pretrained on ImageNet): Extracts high-level visual features from paintings, complementing the handcrafted features from Gabor filters.
- Bidirectional LSTM: Processes the combined feature sequence from Gabor filters and ConvNeXt, capturing complex relationships in the extracted artistic features.
The mathematical foundation for the Gabor filter is defined as:
Where:
$x' = x\cos\theta + y\sin\theta$ $y' = -x\sin\theta + y\cos\theta$ -
$\lambda$ represents wavelength -
$\theta$ represents orientation -
$\psi$ is phase offset -
$\sigma$ is standard deviation -
$\gamma$ is spatial aspect ratio
To evaluate the model's performance, F1-score and model accuracy on validation data were used as the primary metrics. A detailed explanation of the model implementation and its results can be found in the Task 1 README file.
The model achieved the following classification accuracy:
- Artist Classification: 0.63
- Genre Classification: 0.70
- Style Classification: 0.40
To handle class imbalance in style classification, class-weighted loss was assigned to underrepresented styles.
Confusion matrices for all three classification tasks can be found in the results folder.
Task1/
│── results/ # Results for all models
│ ├── artist/ ── [confusion_matrix.png, scores.txt, classification_report.txt]
│ ├── genre/ ── [confusion_matrix.png, scores.txt, classification_report.txt]
│ ├── style/ ── [confusion_matrix.png, scores.txt, classification_report.txt]
│
│── utils/ # Files used for training and evaluation
│ ├── [data_preprocessing.py, model_architecture.py, training_helpers.py]
│
│── weight/ # Saved model weights
│ ├── artist/ ── [epoch_1.pth, epoch_2.pth, ...]
│ ├── genre/ ── [epoch_1.pth, epoch_2.pth, ...]
│ ├── style/ ── [epoch_1.pth, epoch_2.pth, ...]
│ ├── final_weight/ ── [artist.pth, genre.pth, style.pth]
│
│── Wikiart Dataset/ # Original data CSV files
│── evaluation.ipynb # Model evaluation is done here
│── train.py # File used for training
└── README.md # Implementation documentation
Develop a model to find similarities in paintings, such as identifying portraits with a similar face or pose. The approach and methodology were discussed, and the model was implemented using the National Gallery Of Art open dataset.
The similarity search was performed using feature extraction methods and various similarity metrics. The pipeline involved the following steps:
-
Feature Extraction:
- ConvNeXt (trained on ImageNet) and DINO were used for feature extraction.
- The model selection (ConvNeXt or DINO) was configurable and had to be specified before extraction.
- If face-based similarity was enabled, Mask R-CNN was used to detect faces before feature extraction.
-
Similarity Computation:
- The extracted features were compared using similarity metrics like cosine similarity and SSIM (Structural Similarity Index Measure).
-
Visualization:
- The similarity relationships between images were mapped using t-SNE, providing a 2D visual representation.
- The visualization was generated using the t-SNE visualizer function from the
utilsmodule.
- ConvNeXt: A modern convolutional network architecture for extracting visual features
- DINO: Self-supervised vision transformer for robust feature extraction
- SSIM (Structural Similarity Index): Measures the perceived similarity between two images
- RMSE (Root Mean Square Error): Measures the absolute differences between images
- LPIPS (Learned Perceptual Image Patch Similarity): Measures perceptual differences using deep features
Where:
-
$\mu_x$ is the average of x -
$\mu_y$ is the average of y -
$\sigma_x^2$ is the variance of x -
$\sigma_y^2$ is the variance of y -
$\sigma_{xy}$ is the covariance of x and y -
$c_1$ and$c_2$ are constants to stabilize division
For the evaluation, 50 images were selected and analyzed using both feature extraction methods:
- Average SSIM - ConvNeXt: 0.2045
- Average SSIM - DINO: 0.2045
The other metrics used and their results are provided in detail in the Task 2 README file.
Task2/
│── features/ # features in npy for fast processing
│
│── utils/ # Files used for data and features extraction
│ ├── [download_data.py, extract_features.py, image_retrival.py, visualize.py]
│
│── tutorial.ipynb/ # notebook to test the work
│
└── README.md # Implementation documentation
There are several directions for improving and extending this work:
- Temporal Data Utilization: Obtain the year for all paintings and incorporate temporal data to enhance Task 1, making it more historically aware.
- Domain-Specific Feature Extraction: Instead of using general ImageNet-based models, fine-tune a CNN specifically on paintings to extract more domain-relevant features.
- Efficient Similarity Search: Replace KNN with FAISS for Task 2 to enable faster and more scalable image retrieval.
- Improved Face Feature Extraction: Further fine-tune the face detection model on paintings to better capture fine details like noses, ears, and other facial features unique to artwork.
This was an exciting challenge, and I truly enjoyed implementing and learning from it! Thank you again for this opportunity. 🚀

