Code Monkey home page Code Monkey logo

alexnet-prod's Introduction

安装说明

  • 下载代码库
git clone https://github.com/littletomatodonkey/AlexNet-Prod.git
  • 进入文件夹,安装requirements
pip3.7 install -r requirements.txt
  • 安装PaddlePaddle与PyTorch
# CPU版本的PaddlePaddle
pip3.7 install paddlepaddle==2.2.0
# 如果希望安装GPU版本的PaddlePaddle,可以使用下面的命令
# python -m pip install paddlepaddle-gpu==2.2.0
# 安装PyTorch
pip3.7 install torch
  • 验证PaddlePaddle是否安装成功

运行python,输入下面的命令。

import paddle
paddle.utils.run_check()

如果输出下面的内容,则说明PaddlePaddle安装成功。

PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
  • 验证PyTorch是否安装成功

运行python,输入下面的命令,如果可以正常输出,则说明torch安装成功。

import torch
print(torch.__version__)
# 如果安装的是cpu版本,可以按照下面的命令确认torch是否安装成功
# 期望输出为 tensor([1.])
print(torch.Tensor([1.0]))
# 如果安装的是gpu版本,可以按照下面的命令确认torch是否安装成功
# 期望输出为 tensor([1.], device='cuda:0')
print(torch.Tensor([1.0]).cuda())

Reference

alexnet-prod's People

Contributors

duanzhihua avatar dyning avatar littletomatodonkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

alexnet-prod's Issues

关于服务端部署预测

我在使用您给的服务端部署示例中,已经走通了全部流程,可是只能输出一个结果
输出如下:
{'err_no': 0, 'err_msg': '', 'key': ['class_id', 'confidence', 'left_top', 'right_bottom'], 'value': ['[0]', '[0.92535084]', '[[283.15506, 8.095686]]', '[[636.6692, 391.48724]]'], 'tensors': []}
我做的任务是目标检测,在 infer 中,输出有 4 个 boxes,这里只显示了第一个,我换了一张图也是一样,只会输出第一个 boxes 的结果,输出的这个结果是完全和 infer 对的上的,只是还有几个没有输出。
于是,我打印了 fetch_dict 结果如下:
{'concat_5.tmp_0': array([100], dtype=int32), 'concat_6.tmp_0': array([[ 0. , 0.92535084, 283.15506 , 8.095686 , 636.6692 , 391.48724 ]], dtype=float32)}
“concat_5.tmp_0” 中的 100 表示预测的结果有 100 个 boxes,“concat_6.tmp_0” 按理说应该有 100 个结果。

torch2paddle.py提示错误

torch2paddle.py提示错误

torch2paddle.py中

def transfer():
    input_fp = "resnet50-0676ba61.pth"
    output_fp = "model.pdparams"
    # torch_dict = torch.load(input_fp)['model']

提示

Traceback (most recent call last):
  File "H:/论文复现0814/ResNet50-livingbody/torch2paddle.py", line 71, in <module>
    transfer()
  File "H:/论文复现0814/ResNet50-livingbody/torch2paddle.py", line 31, in transfer
    torch_dict = torch.load(input_fp)['model']
KeyError: 'model'

论文复现:from apex import amp出错

在 AlexNet-paddle / train.py中有语句from apex import amp
但在aistudio中运行代码:
from apex import amp会出错。

应该怎么用paddle复现:
from apex import amp ?

requirement.txt 文件存在错误

requirement.txt 文件中第九行多打了个 ?,
image

导致安装 requirements 时报错,如下图所示,
image
删除后可顺利安装 requirement
image

diff_threshold可否更改

fake_data数据在不同网络中前向传播即step1中,diff_threshold默认为1e-6,可否视情况(网络、数据因素)更改为1e-5等

保存的前向文件不正确

Step1 文件夹中 AlexNet_paddle/forward_alexnet.py 文件和 AlexNet_torch/forward_alexnet.py 保存的前向文件不正确,应该保存 out,而不是 fake_data。
image

无法保存比对结果

image

目前这个方法不会把比对结果写入文件,只是生成这样一个空文件,查看源码发现 print_func 为 print,如果要写入应该如何修改?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.