运行 WuJie1010/Facial-Expression-Recognition.Pytorch 的 代码

运行 WuJie1010/Facial-Expression-Recognition.Pytorch 的 代码

通过 idea 打开,这些依赖全部都用最新的,直接让idea 解决依赖就行了,py用的是3.7 是可以的。
然后就是要 在images文件夹里创建一个 results 文件夹,不然会报错

以下是安装依赖的过程,其实都是在走弯路,可以不看。

因为看到他用的是py2.7,我就在尝试装py2,装相应的pytorch,但是装不好,最后还是直接用py3.7,然后idea帮我pip install 就行了。能用3的原因,应该是之前有大佬pull了py3的代码吧。。
(base) C:\Users\Lenovo>conda create -n py2_7_pytorch_0_3_1 python=2.7

conda install pytorch-cpu=0.3.1 torchvision-cpu=0.3.1
https://blog.csdn.net/sinat_37916505/article/details/86128289

PackagesNotFoundError: The following packages are not available from current channels:

  • torchvision-cpu=0.3.1
  • pytorch-cpu=0.3.1

conda install pytorch-cpu torchvision-cpu
但是不指定版本的话 会怎么样

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64/repodata.json
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
‘https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64’

python visualize.py
python visualize_cpu.py -cpu

“D:\project\python_project\ALBERT\venv\Scripts\python.exe” visualize_cpu.py --cpu

pip install numpy

conda install -c peterjc123 pytorch-cpu

https://github.com/peterjc123/pytorch-scripts

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pytorch-cpu -> python[version='2.6.*|2.7.*|3.5.*|3.6.*|3.6.12|3.6.12|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|3.7.9|3.6.9|3.6.9|3.6.9|>=2.7,<2.8.0a0|3.6.9|3.4.*|3.3.*',build='0_73_pypy|1_73_pypy|3_73_pypy|4_73_pypy|5_73_pypy|2_73_pypy']
  - pytorch-cpu -> python[version='>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']

Your python: python=2.7

If python is on the left-most side of the chain, that’s the version you’ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

pip install pytorch

https://www.cnblogs.com/-wawcc/p/13972879.html

http://www.cocoachina.com/articles/69415
如果激活了您感兴趣的环境,则可以在环境变量中找到该答案.

https://blog.csdn.net/qq_36401512/article/details/86646035
liunx下pytorch(python2.7)先前几个版本的安装(由于官网点击先前版本进不去)

FileNotFoundError: [Errno 2] No such file or directory: ‘images/results/l.png’
所以要创建文件夹吧

E:\project\python_project\Facial-Expression-Recognition.Pytorch-master>“D:\project\python_project\ALBERT\venv\Scripts\python.exe” visualize_cpu.py --cpu
Namespace(cpu=True)
visualize_cpu.py:65: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead.
inputs = Variable(inputs, volatile=True)
visualize_cpu.py:70: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
score = F.softmax(outputs_avg)
The Expression is Angry
可以运行了

你可能感兴趣的:(人工智能)