This application clusters images and provides a web interface for selecting representative images from each cluster.
backend/: Contains server code and clustering script.scripts/: Python script for clustering images.data/: Containsdataset/,clusters/, andexported_images/.
frontend/: React application for the web interface.
- Node.js and npm
- Python 3.x and pip
-
Navigate to the backend directory:
cd backend -
Install Node.js dependencies:
npm install
-
Install Python dependencies:
pip install -r scripts/requirements.txt
-
Prepare your dataset:
- Place your images in
backend/data/dataset/.
- Place your images in
-
Run the clustering script:
npm run cluster
-
Start the server:
npm start
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the React application:
npm start
-
Open your browser and navigate to
http://localhost:3000.
- Use the web interface to view image clusters.
- Click on images to select or deselect them.
- Click the "Export" button to save selected images to
backend/data/exported_images/.
This project requires Node.js and npm (Node Package Manager) to run the server and client applications. If you do not already have Node.js and npm installed, please follow the instructions below for your operating system.
-
Download the Installer:
- Visit the official Node.js website at https://nodejs.org/.
- Download the LTS (Long Term Support) version for Windows.
-
Run the Installer:
- Locate the downloaded
.msifile and double-click to run it. - Follow the prompts in the setup wizard.
- Accept the license agreement and use the default installation settings.
- Locate the downloaded
-
Verify the Installation:
-
Open Command Prompt or PowerShell.
-
Run the following commands:
node -v npm -v
-
You should see the version numbers of Node.js and npm, confirming they are installed.
-
-
Download the Installer:
- Go to https://nodejs.org/.
- Download the LTS version for macOS.
-
Run the Installer:
- Open the downloaded
.pkgfile. - Follow the installation steps provided by the installer.
- Open the downloaded
-
Verify the Installation:
-
Open Terminal.
-
Run:
node -v npm -v
-
You should see the version numbers displayed.
-
You can also use nvm to install Node.js and npm, which allows you to manage multiple versions.
-
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash- Note: Replace
v0.39.4with the latest nvm version if necessary. - Close and reopen your terminal, or run
source ~/.nvm/nvm.sh.
- Note: Replace
-
Install Node.js LTS Version:
nvm install --lts
-
Verify the Installation:
node -v npm -v
If you wish to uninstall Node.js and npm after using this project, follow the steps for your operating system.
-
Open Control Panel:
- Go to "Control Panel" > "Programs" > "Programs and Features".
-
Uninstall Node.js:
- Find "Node.js" in the list of installed programs.
- Select it and click "Uninstall".
- Follow the prompts to complete the uninstallation.
-
Delete Remaining Files (Optional):
- Delete any remaining files in the installation directory, usually
C:\Program Files\nodejs.
- Delete any remaining files in the installation directory, usually
If you installed Node.js via the installer:
-
Remove Node.js and npm:
sudo rm -rf /usr/local/bin/node sudo rm -rf /usr/local/lib/node_modules/npm sudo rm -rf /usr/local/lib/node_modules/corepack sudo rm -rf /usr/local/include/node sudo rm -rf /usr/local/lib/node sudo rm -rf /usr/local/bin/npm sudo rm -rf /usr/local/bin/npx sudo rm -rf /usr/local/share/man/man1/node.1 sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
- Warning: Be very careful with the
rm -rfcommand to avoid deleting unintended files.
- Warning: Be very careful with the
-
Delete Local npm Configurations (Optional):
rm -rf ~/.npm rm -rf ~/.nvm
- This removes global npm and nvm configurations.
Alternatively, if you installed Node.js via Homebrew:
-
Uninstall Node.js:
brew uninstall node
-
Remove Any Remaining Files (Optional):
brew cleanup
-
Uninstall Node.js Versions:
nvm uninstall <version>
- Replace
<version>with the version number, e.g.,nvm uninstall 14.17.0.
- Replace
-
Uninstall nvm:
rm -rf "$NVM_DIR"- Usually,
$NVM_DIRis located in~/.nvm.
- Usually,
After uninstalling Node.js and npm, you can also remove the project files:
-
Delete the Project Directory:
-
Navigate to the parent directory of the project.
-
Remove the project folder:
rm -rf "Dataset Cluster Tool"
-
-
Remove Global npm Packages (Optional):
-
If you have installed any global npm packages, you can remove them:
npm list -g --depth=0 npm uninstall -g <package_name>
-
Replace
<package_name>with the name of the package you want to remove.
-
