Skip to content
kwankill edited this page Jun 21, 2024 · 8 revisions

Image Clothing Analysis and Recommendation System

The project is a model that removes the background from the image, detects human body parts, separates the top and bottom, and finds similar clothing images for each part (The EfficientNet model is used to extract image features, and the cosine similarity is calculated to return similar images.)

Key features described as functions

  1. Remove Background The 'remove_background(image_path)' function uses the rembg library to remove the background of the image.

  2. Body part detection The function 'detect_body_parts (image_path, limg) uses OpenPose to detect body parts in an image. The function returns 15 major joint positions.

  3. image segmentation The function 'crop_body_parts(rimg, points)' divides the top and bottom images based on the detected body parts.

  4. Load Model The 'load_models()' function loads the EfficientNet model and initializes the model for each class classification and feature extraction.

  5. Image feature extraction The 'predict(img)' function converts the input image into a feature vector using the ResNet model.

  6. Cosine similarity calculation The function 'cos_sim(A, B)' calculates the cosine similarity between the two vectors.

  7. Color Analysis The 'colorAnalyze(input)' function analyzes the main color of the image and returns the closest color.

  8. prediction of bottom categories The function 'predict_bottom_category (image_path, bottom LengthModel)' receives the image below and predicts the category.

  9. Finding Pseudo Images The function 'find_similar_images(source_embedding, path)' calculates the similarity between the images of the given path and the feature vector of the input image to find similar images.

  10. prediction of categories on an award The function 'predict_top_category(image_path, topClassModel)' receives the image on the and predicts the category.

  11. Sorting and filtering results The function 'sort_and_filter_results(similar, pathlist, N_Ten)' sorts image paths and similarities based on similarity and returns the top 10.

  12. Database queries and data collection The 'execute_database_queries_and_collect_data(topTen, bottomTen)' function queries and collects data from the top 10 top and bottom of the database.

  13. Visualize the results The 'visualize_results(image_path, top_pairs, bottom_pairs)' function visualizes the original image and the top 10 similar images.

Execution procedures

  1. Model Load -> Background Removal -> Body Parts Detected with Openpose -> Image Segmentation (Top, Bottom) -> Top and Bottom Category Prediction and Feature Extractions -> Run different models -> Search for similar images -> Sort and filter results -> Query databases -> Visualization of results

Library

API

Model

Clone this wiki locally