diff --git a/ACL_TensorFlow/contrib/cv/edsr/.keep b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/.keep similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/.keep rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/.keep diff --git a/ACL_TensorFlow/contrib/cv/edsr/README.md b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/README.md similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/README.md rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/README.md diff --git a/ACL_TensorFlow/contrib/cv/edsr/ckpt2pb.py b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/ckpt2pb.py similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/ckpt2pb.py rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/ckpt2pb.py diff --git a/ACL_TensorFlow/contrib/cv/edsr/edsr.py b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/edsr.py similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/edsr.py rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/edsr.py diff --git a/ACL_TensorFlow/contrib/cv/edsr/run.py b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/run.py similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/run.py rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/run.py diff --git a/ACL_TensorFlow/contrib/cv/edsr/testpic.bin b/ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/testpic.bin similarity index 100% rename from ACL_TensorFlow/contrib/cv/edsr/testpic.bin rename to ACL_TensorFlow/contrib/cv/EDSR_ID1263_for_ACL/testpic.bin diff --git a/ACL_TensorFlow/contrib/cv/mnasnet/.keep b/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/.keep similarity index 100% rename from ACL_TensorFlow/contrib/cv/mnasnet/.keep rename to ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/.keep diff --git a/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/README.md b/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d23f87af6cc23beac0a4600bec11cff1dd7d9072 --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/README.md @@ -0,0 +1,83 @@ + # ATC Fpointnet + + +- references: + + ["Frustum PointNets for 3D Object Detection from RGB-D Data"](https://arxiv.org/pdf/1711.08488.pdf) + + +- training model: + + [Fpointnet_ID1470_for_TensorfFow](https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/Fpointnet_ID1470_for_TensorfFow) + + +# 1. ckpt to pb + +download **ckpt** and use **ckpt2pb.py** process ckpt to pb. + +[ckpt](https://pan.baidu.com/s/1U7qJ4cYOokd8cRAmeezxHg) +Password:ms1m + +# 2. pb to om +Command: +``` +atc --input_shape="Placeholder:32,1024,4;Placeholder_1:32,3;Placeholder_3:32,3;Placeholder_9:32,512,2" --input_format=ND --output="fpointnet" --soc_version=Ascend310 --framework=3 --model="./fpointnet.pb" --log=info +``` +[Pb](https://pan.baidu.com/s/1UzZkdb_1rkEOdNwWx50JFw) +Password:z8ml + +[OM](https://pan.baidu.com/s/1Q-GDPUCVJ6-ZyuC7Xp_QEw) +Password:zzls + +# 3. compile msame +Reference to https://gitee.com/ascend/tools/tree/master/msame, compile **msame** + +Compile msame command: +```bash +. /home/HwHiAiUser/Ascend/ascend-toolkit/set_env.sh +export DDK_PATH=/home/HwHiAiUser/Ascend/ascend-toolkit/latest +export NPU_HOST_LIB=/home/HwHiAiUser/Ascend/ascend-toolkit/latest/runtime/lib64/stub +cd $HOME/AscendProjects/tools/msame/ +./build.sh g++ $HOME/AscendProjects/tools/msame/out + +``` + +# 4. inference +Inference command: +```bash +cd $HOME/AscendProjects/tools/msame/out +model_path=/home/HwHiAiUser/AscendProjects/Fpointnet/fpointnet.om +output_path=/home/HwHiAiUser/AscendProjects/Fpointnet +./msame --model ${model_path} --output ${output_path} +``` + + + +Part of **Inference sys output**: +```bash +[INFO] acl init success +[INFO] open device 0 success +[INFO] create context success +[INFO] create stream success +[INFO] get run mode success +[INFO] load model ./fpointnet.om success +[INFO] create model description success +[INFO] get input dynamic gear count success +[INFO] create model output success +.//2022117_16_37_5_559775 +[INFO] model execute success +Inference time: 29.151ms +[INFO] get max dynamic batch size success +[INFO] output data success +Inference average time: 29.151000 ms +[INFO] destroy model input success +[INFO] unload model success, model Id is 1 +[INFO] Execute sample success +[INFO] end to destroy stream +[INFO] end to destroy context +[INFO] end to reset device is 0 +[INFO] end to finalize acl +``` + + + diff --git a/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/ckpt2pb.py b/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/ckpt2pb.py new file mode 100644 index 0000000000000000000000000000000000000000..cb9e166997eacc49e1048704bfc58d92289f2749 --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/Fpointnet_ID1470for_ACL/ckpt2pb.py @@ -0,0 +1,58 @@ +import tensorflow as tf +from tensorflow.python.framework import graph_util +from tensorflow.core.protobuf.rewriter_config_pb2 import RewriterConfig + +tf.compat.v1.disable_eager_execution() + +def freeze_graph(input_checkpoint,output_graph): + + # 指定输出的节点名称,该节点名称必须是原模型中存在的节点 + output_node_names = "Squeeze_1,add_2" + saver = tf.train.import_meta_graph(input_checkpoint + '.meta', clear_devices=True) + + with tf.Session() as sess: + saver.restore(sess, input_checkpoint) #恢复图并得到数据 + graph_def = tf.get_default_graph().as_graph_def(add_shapes=True) + node_list = [n.name for n in graph_def.node] + for node in node_list: + print("node_name", node) + + for node in graph_def.node: + if node.op == 'Placeholder' and node.name == 'Placeholder_8': + print(node) + node.op = 'Const' + node.attr["value"].CopyFrom(tf.AttrValue(tensor=tf.make_tensor_proto(False, tf.bool))) + del node.attr['shape'] + + if node.op == 'PyFunc' and node.name == 'PyFunc': + print(node) + node.op = 'Placeholder' + node.name = 'Placeholder_9' + shape = tf.TensorShape([32,None,2]) + node.attr["shape"].CopyFrom(tf.AttrValue(shape=shape.as_proto())) + dtype = tf.dtypes.as_dtype("int32") + node.attr["dtype"].CopyFrom(tf.AttrValue(type=dtype.as_datatype_enum)) + node.input.remove('Squeeze_1') + del node.attr['Tin'] + del node.attr['Tout'] + del node.attr['token'] + del node.attr['_output_shapes'] + print(node) + + if node.op == 'GatherNd' and node.name == 'GatherNd': + node.input.remove('PyFunc') + node.input.append('Placeholder_9') + print(node) + + output_graph_def = graph_util.convert_variables_to_constants( # 模型持久化,将变量值固定 + sess=sess, + input_graph_def=graph_def,# 等于:sess.graph_def + output_node_names=output_node_names.split(","))# 如果有多个输出节点,以逗号隔开 + + with tf.gfile.GFile(output_graph, "wb") as f: #保存模型 + f.write(output_graph_def.SerializeToString()) #序列化输出 + print("%d ops in the final graph." % len(output_graph_def.node)) #得到当前图有几个操作节点 + +input_checkpoint='./model.ckpt' +out_pb_path='fpointnet.pb' +freeze_graph(input_checkpoint, out_pb_path) diff --git a/ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/.keep b/ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ACL_TensorFlow/contrib/cv/mnasnet/README.md b/ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/README.md similarity index 100% rename from ACL_TensorFlow/contrib/cv/mnasnet/README.md rename to ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/README.md diff --git a/ACL_TensorFlow/contrib/cv/mnasnet/ckpt2pb.py b/ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/ckpt2pb.py similarity index 100% rename from ACL_TensorFlow/contrib/cv/mnasnet/ckpt2pb.py rename to ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/ckpt2pb.py diff --git a/ACL_TensorFlow/contrib/cv/mnasnet/pic.bin b/ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/pic.bin similarity index 100% rename from ACL_TensorFlow/contrib/cv/mnasnet/pic.bin rename to ACL_TensorFlow/contrib/cv/MnasNet_ID0728_for ACL/pic.bin diff --git a/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/.keep b/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/README.md b/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/README.md new file mode 100644 index 0000000000000000000000000000000000000000..07a7c35d14803eb6de5a891d0abb8f15b659ba2a --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/README.md @@ -0,0 +1,81 @@ +# ATC SeqGAN + + +- references: + + ["SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient"](https://arxiv.org/abs/1609.05473) + + +- training model: + + [SeqGAN_ID2096_for_TensorFlow](https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/SeqGAN_ID2096_for_TensorFlow) + + +# 1. ckpt to pb + +download **ckpt** and use **ckpt2pb.py** process ckpt to pb. + +[ckpt](https://pan.baidu.com/s/1hTrdrkppaHT_onXrrTMwFg) +Password:lzqe + +# 2. pb to om +Command: +``` +atc --model=seqgan.pb --framework=3 --input_format="ND" --input_shape="Placeholder:64,20" --output=seqgan --soc_version=Ascend310 +``` +[Pb](https://pan.baidu.com/s/1zudcMVdDYCDN5q4LDrDXrg) +Password:yh6q + +[OM](https://pan.baidu.com/s/1HJZhBZKBX2W6i6daaMKuuw) +Password:9p09 + +# 3. compile msame +Reference to https://gitee.com/ascend/tools/tree/master/msame, compile **msame** + +Compile msame command: +```bash +. /home/HwHiAiUser/Ascend/ascend-toolkit/set_env.sh +export DDK_PATH=/home/HwHiAiUser/Ascend/ascend-toolkit/latest +export NPU_HOST_LIB=/home/HwHiAiUser/Ascend/ascend-toolkit/latest/runtime/lib64/stub +cd $HOME/AscendProjects/tools/msame/ +./build.sh g++ $HOME/AscendProjects/tools/msame/out + +``` + +# 4. inference +Inference command: +```bash +cd $HOME/AscendProjects/tools/msame/out +model_path=/home/HwHiAiUser/AscendProjects/SeqGAN/seqgan.om +output_path=/home/HwHiAiUser/AscendProjects/SeqGAN +./msame --model ${model_path} --output ${output_path} --outputSize 25600000 +``` + + + +Part of **Inference sys output**: +```bash +[INFO] acl init success +[INFO] open device 0 success +[INFO] create context success +[INFO] create stream success +[INFO] get run mode success +[INFO] load model ./seqgan.om success +[INFO] create model description success +[INFO] get input dynamic gear count success +[INFO] create model output success +.//2022118_17_18_37_136806 +[INFO] model execute success +Inference time: 181.534ms +[INFO] get max dynamic batch size success +[INFO] output data success +Inference average time: 181.534000 ms +[INFO] destroy model input success +[INFO] unload model success, model Id is 1 +[INFO] Execute sample success +[INFO] end to destroy stream +[INFO] end to destroy context +[INFO] end to reset device is 0 +[INFO] end to finalize acl +``` + diff --git a/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/ckpt2pb.py b/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/ckpt2pb.py new file mode 100644 index 0000000000000000000000000000000000000000..b714d367432ea770600b06faf7e39b1320849f9f --- /dev/null +++ b/ACL_TensorFlow/contrib/cv/SeqGAN_ID2096_for_ACL/ckpt2pb.py @@ -0,0 +1,32 @@ +import tensorflow as tf +from tensorflow.python.tools import freeze_graph +from tensorflow.python.framework import graph_util + + +def freeze_graph(input_checkpoint,output_graph): + + # 指定输出的节点名称,该节点名称必须是原模型中存在的节点 + output_node_names = "transpose_2" + saver = tf.train.import_meta_graph(input_checkpoint + '.meta', clear_devices=True) + graph = tf.get_default_graph() # 获得默认的图 + input_graph_def = graph.as_graph_def() # 返回一个序列化的图代表当前的图 + + with tf.Session() as sess: + + graph_def = tf.get_default_graph().as_graph_def(add_shapes=True) + node_list = [n.name for n in graph_def.node] + #for node in node_list: + # print("node_name", node) + saver.restore(sess, input_checkpoint) #恢复图并得到数据 + output_graph_def = graph_util.convert_variables_to_constants( # 模型持久化,将变量值固定 + sess=sess, + input_graph_def=input_graph_def,# 等于:sess.graph_def + output_node_names=output_node_names.split(","))# 如果有多个输出节点,以逗号隔开 + + with tf.gfile.GFile(output_graph, "wb") as f: #保存模型 + f.write(output_graph_def.SerializeToString()) #序列化输出 + print("%d ops in the final graph." % len(output_graph_def.node)) #得到当前图有几个操作节点 + +input_checkpoint='./checkpoint/myModel' +out_pb_path='seqgan.pb' +freeze_graph(input_checkpoint, out_pb_path)