未验证 提交 14285daa 编写于 作者: W whs 提交者: GitHub

Remove paddle.v2 from models. (#1312)

上级 7ec97024
...@@ -2,7 +2,6 @@ from __future__ import absolute_import ...@@ -2,7 +2,6 @@ from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle.v2 as paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
""" """
CNN on mnist data using fluid api of paddlepaddle CNN on mnist data using fluid api of paddlepaddle
""" """
import paddle.v2 as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -8,7 +8,7 @@ sys.path.append("..") ...@@ -8,7 +8,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.gradient_method import BIM from advbox.attacks.gradient_method import BIM
......
...@@ -8,7 +8,7 @@ sys.path.append("..") ...@@ -8,7 +8,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.deepfool import DeepFoolAttack from advbox.attacks.deepfool import DeepFoolAttack
......
...@@ -8,7 +8,7 @@ sys.path.append("..") ...@@ -8,7 +8,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.gradient_method import FGSM from advbox.attacks.gradient_method import FGSM
......
...@@ -7,7 +7,7 @@ sys.path.append("..") ...@@ -7,7 +7,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.gradient_method import ILCM from advbox.attacks.gradient_method import ILCM
......
...@@ -7,7 +7,7 @@ sys.path.append("..") ...@@ -7,7 +7,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.saliency import JSMA from advbox.attacks.saliency import JSMA
......
...@@ -7,7 +7,7 @@ sys.path.append("..") ...@@ -7,7 +7,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.lbfgs import LBFGS from advbox.attacks.lbfgs import LBFGS
......
...@@ -9,7 +9,7 @@ sys.path.append("..") ...@@ -9,7 +9,7 @@ sys.path.append("..")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from advbox.adversary import Adversary from advbox.adversary import Adversary
from advbox.attacks.gradient_method import MIFGSM from advbox.attacks.gradient_method import MIFGSM
......
...@@ -8,7 +8,7 @@ import os ...@@ -8,7 +8,7 @@ import os
import cv2 import cv2
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
from icnet import icnet from icnet import icnet
from utils import add_arguments, print_arguments, get_feeder_data from utils import add_arguments, print_arguments, get_feeder_data
from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter
...@@ -111,10 +111,10 @@ def infer(args): ...@@ -111,10 +111,10 @@ def infer(args):
for line in open(args.images_list): for line in open(args.images_list):
image_file = args.images_path + "/" + line.strip() image_file = args.images_path + "/" + line.strip()
filename = os.path.basename(image_file) filename = os.path.basename(image_file)
image = paddle.image.load_image( image = paddle.dataset.image.load_image(
image_file, is_color=True).astype("float32") image_file, is_color=True).astype("float32")
image -= IMG_MEAN image -= IMG_MEAN
img = paddle.image.to_chw(image)[np.newaxis, :] img = paddle.dataset.image.to_chw(image)[np.newaxis, :]
image_t = fluid.core.LoDTensor() image_t = fluid.core.LoDTensor()
image_t.set(img, place) image_t.set(img, place)
result = exe.run(inference_program, result = exe.run(inference_program,
......
...@@ -8,7 +8,7 @@ import sys ...@@ -8,7 +8,7 @@ import sys
import os import os
import numpy as np import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.v2 as paddle import paddle
def test_model(exe, test_program, fetch_list, test_reader, feeder): def test_model(exe, test_program, fetch_list, test_reader, feeder):
......
...@@ -4,7 +4,6 @@ import random ...@@ -4,7 +4,6 @@ import random
import cPickle import cPickle
import functools import functools
import numpy as np import numpy as np
#import paddle.v2 as paddle
import paddle import paddle
from PIL import Image, ImageEnhance from PIL import Image, ImageEnhance
......
import paddle.v2 as paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from utility import add_arguments, print_arguments, to_lodtensor, get_ctc_feeder_data, get_attention_feeder_data from utility import add_arguments, print_arguments, to_lodtensor, get_ctc_feeder_data, get_attention_feeder_data
from attention_model import attention_eval from attention_model import attention_eval
......
from __future__ import print_function from __future__ import print_function
import paddle.v2 as paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from utility import add_arguments, print_arguments, to_lodtensor, get_ctc_feeder_data, get_attention_feeder_for_infer from utility import add_arguments, print_arguments, to_lodtensor, get_ctc_feeder_data, get_attention_feeder_for_infer
import paddle.fluid.profiler as profiler import paddle.fluid.profiler as profiler
......
import numpy as np import numpy as np
import paddle.v2 as paddle
import paddle.fluid as fluid import paddle.fluid as fluid
# reproducible # reproducible
np.random.seed(1) np.random.seed(1)
......
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
import numpy as np import numpy as np
import time import time
import sys import sys
import paddle.v2 as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from resnet import TSN_ResNet from resnet import TSN_ResNet
import reader import reader
......
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
import numpy as np import numpy as np
import time import time
import sys import sys
import paddle.v2 as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from resnet import TSN_ResNet from resnet import TSN_ResNet
import reader import reader
......
...@@ -5,7 +5,7 @@ import functools ...@@ -5,7 +5,7 @@ import functools
import cPickle import cPickle
from cStringIO import StringIO from cStringIO import StringIO
import numpy as np import numpy as np
import paddle.v2 as paddle import paddle
from PIL import Image, ImageEnhance from PIL import Image, ImageEnhance
random.seed(0) random.seed(0)
......
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
import numpy as np import numpy as np
import time import time
import sys import sys
import paddle.v2 as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from resnet import TSN_ResNet from resnet import TSN_ResNet
import reader import reader
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册