1 Star 5 Fork 1

cubone/learnopencv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Setup

This code was tested with python 3.7, however, it should work with any python 3.

  1. Create and activate virtual environment for experiments with t-SNE.
python3 -m venv venv
source venv/bin/activate
  1. install the dependencies
python3 -m pip install -r requirements.txt

Data downloading

Download data from Kaggle and unzip it. The easiest way is to use kaggle console API. To setup it, follow this guide. However, you can download the data using your browser - results will be the same.

After that, execute the following commands:


kaggle datasets download alessiocorrado99/animals10

mkdir -p data

cd data

unzip ../animals10.zip

cd ..

Executing the T-SNE visualization


python3 tsne.py

Additional options:

python3 tsne.py -h

usage: tsne.py [-h] [--path PATH] [--batch BATCH] [--num_images NUM_IMAGES]

optional arguments:
  -h, --help            show this help message and exit
  --path PATH
  --batch BATCH
  --num_images NUM_IMAGES

You can change the data directory with --path argument.

Tweak the --num_images to speed-up the process - by default it is 500, you can make it smaller.

Tweak the --batch to better utilize your PC's resources. The script uses GPU automatically if it available. You may want to increase the batch size to utilize the GPU better or decrease it if the default batch size does not fit your GPU.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cubone/learnopencv.git
git@gitee.com:cubone/learnopencv.git
cubone
learnopencv
learnopencv
master

搜索帮助