提交 c08748d8 编写于 作者: S superjom

Merge branch 'feature/add_image_component-channels' into feature/add_image_component

......@@ -21,6 +21,9 @@ class LibTest(unittest.TestCase):
add_image(writer, "train", "layer/image0", 7, 10, 1)
add_image(writer, "test", "layer/image0", 7, 10, 3)
add_image(writer, "train", "layer/image1", 7, 10, 1, shape=[30,30,2])
add_image(writer, "test", "layer/image1", 7, 10, 1, shape=[30,30,2])
self.reader = storage.StorageReader(dir)
def test_modes(self):
......
......@@ -11,6 +11,7 @@ export PYTHONPATH="${core_path}:${python_path}"
backend_test() {
cd $cur
sudo pip install numpy
sudo pip install Pillow
mkdir -p build
cd build
cmake ..
......
......@@ -103,6 +103,10 @@ void Image::SetSample(int index,
int size = std::accumulate(
shape.begin(), shape.end(), 1., [](float a, float b) { return a * b; });
CHECK_GT(size, 0);
CHECK_EQ(shape.size(), 3)
<< "shape should be something like (width, height, num_channel)";
CHECK_LE(shape.back(), 3);
CHECK_GE(shape.back(), 2);
CHECK_EQ(size, data.size()) << "image's shape not match data";
CHECK_LT(index, num_samples_);
CHECK_LE(index, num_records_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册