提交 e9ba37bc 编写于 作者: D dayhaha

fix mnist predict.py bug

上级 6332ea6b
...@@ -229,7 +229,9 @@ def process(settings, file_list): ...@@ -229,7 +229,9 @@ def process(settings, file_list):
labels = batch['labels'] labels = batch['labels']
for im, lab in zip(images, labels): for im, lab in zip(images, labels):
if settings.is_train and np.random.randint(2): if settings.is_train and np.random.randint(2):
im = im.reshape(3, 32, 32)
im = im[:,:,::-1] im = im[:,:,::-1]
im = im.flatten()
im = im - settings.mean im = im - settings.mean
yield { yield {
'image': im.astype('float32'), 'image': im.astype('float32'),
......
...@@ -389,7 +389,7 @@ The classification accuracy is 99.20% ...@@ -389,7 +389,7 @@ The classification accuracy is 99.20%
脚本 `predict.py` 可以对训练好的模型进行预测,例如softmax回归中: 脚本 `predict.py` 可以对训练好的模型进行预测,例如softmax回归中:
```bash ```bash
python predict.py -c softmax_mnist.py -d data/raw_data/ -m softmax_mnist_model/pass-00047 python predict.py -c mnist_model.py -d data/raw_data/ -m softmax_mnist_model/pass-00047
``` ```
- -c 指定模型的结构 - -c 指定模型的结构
......
...@@ -430,7 +430,7 @@ The classification accuracy is 99.20% ...@@ -430,7 +430,7 @@ The classification accuracy is 99.20%
脚本 `predict.py` 可以对训练好的模型进行预测,例如softmax回归中: 脚本 `predict.py` 可以对训练好的模型进行预测,例如softmax回归中:
```bash ```bash
python predict.py -c softmax_mnist.py -d data/raw_data/ -m softmax_mnist_model/pass-00047 python predict.py -c mnist_model.py -d data/raw_data/ -m softmax_mnist_model/pass-00047
``` ```
- -c 指定模型的结构 - -c 指定模型的结构
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""Usage: predict.py -c CONF -d ./data/raw_data/ -m MODEL """Usage: predict.py -c CONF -d DATA -m MODEL
Arguments: Arguments:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册