Comments (5)
Hi @mehameha998 and @zikai1 ,
In default, OpenCV can support the convertion from .webp
to .jpg
.
I provide the simple script to convert the image into .jpg
format.
# convert.py
from tqdm import tqdm
import argparse
import cv2
import os
parser = argparse.ArgumentParser()
parser.add_argument('--indir', help = "The path of the flat folder")
parser.add_argument('--outdir', help = "The path of the output folder")
args = parser.parse_args()
if not os.path.exists(args.outdir):
os.mkdir(args.outdir)
for img_name in tqdm(os.listdir(args.indir)):
img = cv2.imread(os.path.join(args.indir, img_name))
cv2.imwrite(os.path.join(args.outdir, img_name[:-5] + '.jpg'), img)
The procedure step is list below:
First, you should extract the mdb
file into flat format.
python2.7 data.py export <image db path> --out_dir <output directory> --flat
Next, run the following code to transfer the whole file into JPG format.
python3 convert.py --indir <output_directory> --outdir <final_output_directory>
from lsun.
Did you solve the problem?
@shanYanGuan
from lsun.
Hi @mehameha998 and @zikai1 ,
In default, OpenCV can support the convertion from.webp
to.jpg
.
I provide the simple script to convert the image into.jpg
format.# convert.py from tqdm import tqdm import argparse import cv2 import os parser = argparse.ArgumentParser() parser.add_argument('--indir', help = "The path of the flat folder") parser.add_argument('--outdir', help = "The path of the output folder") args = parser.parse_args() if not os.path.exists(args.outdir): os.mkdir(args.outdir) for img_name in tqdm(os.listdir(args.indir)): img = cv2.imread(os.path.join(args.indir, img_name)) cv2.imwrite(os.path.join(args.outdir, img_name[:-5] + '.jpg'), img)The procedure step is list below:
First, you should extract themdb
file into flat format.python2.7 data.py export <image db path> --out_dir <output directory> --flat
Next, run the following code to transfer the whole file into JPG format.
python3 convert.py --indir <output_directory> --outdir <final_output_directory>
It doesn't work. Which version of opencv are you using?
$ python3 convert.py --indir bedroom_train_lmdb --outdir bedroom_train_lmdb
0%| | 0/18 [00:00<?, ?it/s]
Traceback (most recent call last):
File "convert.py", line 16, in <module>
cv2.imwrite(os.path.join(args.outdir, img_name[:-5] + '.jpg'), img)
cv2.error: OpenCV opencv/modules/imgcodecs/src/loadsave.cpp:740: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'
from lsun.
Hi @mehameha998 and @zikai1 ,
In default, OpenCV can support the convertion from.webp
to.jpg
.
I provide the simple script to convert the image into.jpg
format.# convert.py from tqdm import tqdm import argparse import cv2 import os parser = argparse.ArgumentParser() parser.add_argument('--indir', help = "The path of the flat folder") parser.add_argument('--outdir', help = "The path of the output folder") args = parser.parse_args() if not os.path.exists(args.outdir): os.mkdir(args.outdir) for img_name in tqdm(os.listdir(args.indir)): img = cv2.imread(os.path.join(args.indir, img_name)) cv2.imwrite(os.path.join(args.outdir, img_name[:-5] + '.jpg'), img)The procedure step is list below:
First, you should extract themdb
file into flat format.python2.7 data.py export <image db path> --out_dir <output directory> --flat
Next, run the following code to transfer the whole file into JPG format.
python3 convert.py --indir <output_directory> --outdir <final_output_directory>
It doesn't work. Which version of opencv are you using?
$ python3 convert.py --indir bedroom_train_lmdb --outdir bedroom_train_lmdb 0%| | 0/18 [00:00<?, ?it/s] Traceback (most recent call last): File "convert.py", line 16, in <module> cv2.imwrite(os.path.join(args.outdir, img_name[:-5] + '.jpg'), img) cv2.error: OpenCV opencv/modules/imgcodecs/src/loadsave.cpp:740: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'
I got the same error. Did you solve the problem?
from lsun.
I try to utilize this dataset to train my network.But After I export those dataset,I found those're .webp file. So could you tell me how to convert to .png? PS: When I directly train my network with lmdb files in the dataset,an error occurred .Maybe lmdb files have somthing wrong I guess. error:
F0326 01:27:43.210084 15934 data_transformer.cpp:734] Check failed: datum_channels > 0 (0 vs. 0)
If you want jpg format, you can modify the code directly in the export_images
image_out_path = join(image_out_dir, key.decode('ascii') + '.jpg')
# image_out_path = join(image_out_dir, key.decode('ascii') + '.webp')
from lsun.
Related Issues (20)
- cannot get data HOT 1
- What's the mean and std for lsun dataset?
- LSUN Layout HOT 1
- What does the acronym "LSUN" mean? HOT 1
- 404 not found HOT 3
- .mat files HOT 1
- Seems like http://dl.yf.io/lsun/objects is down? HOT 2
- The transformed images hint PIL. UnidentifiedImageError: always identify a image file
- Download very slow HOT 4
- TEST set has only label 0 HOT 1
- HTTP 404 Error
- Could someone share the church_outdoor dataset to me? HOT 1
- Server is down HOT 2
- Can this dataset be used for commercial purposes ?
- curl http://dl.yf.io/lsun/scenes/classroom_train_lmdb.zip timed out HOT 2
- urlopen error No route to host HOT 3
- curl: (18) transfer closed with (1729112674) bytes remaining to read
- No route to host HOT 1
- The directory structure is not onsistent with meta list HOT 2
- Broken link HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsun.