This is a actuallization for python3.9 and Tensorflow 2.x for The original code is: https://github.com/marcobaturan/Image-classification-from-mess-folder-to-ordered-folder
I have a folder where I put all my cambridge holidays pictures... I would love to sort by topics my pictures of my holidays in Cambridge.
In fact, these pictures are a groundtruth for computer vision algorithms from University of Washington
Here is the expected result of the classification :
Oh dear god ! My computer analysed my pictures and recognized on its own all the churches of my cambridge holidays pictures and put them in the same folder :
With this command line, I am now able to sort my pictures by topics as above
python3.9 messed_path_to_classify.py --out_path ./example/sorted ./example/cambridge
The installation procedure has been tested on Ubuntu 16.04.
This code needs python3 and TensorFlow to work.
- Install python3 :
sudo apt-get install python3.9
-
Install TensorFlow :
You need to first install pip3 plugin for managing the modules.
sudo apt-get install python3-pip python3-dev
Then, install Tensorflow :
sudo pip3 install --upgrade <link>
Choose your link on tensorflow documentation.
Because of some difficulties to install TensorFlow with cuda and cudnn libraries, I used :
sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp35-cp35m-linux_x86_64.whl
Once you have fill the requirements, you need to clone the repository :
git clone https://github.com/marcobaturan/Image-classification-from-mess-folder-to-ordered-folder
cd image-classifier-service
The goal of creating an alias is to not care about the location of the repository but used it anywhere.
chmod +x ./alias.sh
./alias.sh
You could now use classify_path
to call the script. Easier and faster.
virtualenv env --python=python3.9
source env/bin/activate
pip install -r requirements.txt
Now have fun and classify your folder !
-
Mainly use :
classify_path --out_path ./sorted ./path_to_classify/
where :
./sorted
is the destination path./path_to_classify/
is the path where images are located
-
Help :
classify_path -h
- Label image with deep learning
- Create folder corresponding to the Label
- Copy the image into the right path