久久精品国产亚洲高清|精品日韩中文乱码在线|亚洲va中文字幕无码久|伊人久久综合狼伊人久久|亚洲不卡av不卡一区二区|精品久久久久久久蜜臀AV|国产精品19久久久久久不卡|国产男女猛烈视频在线观看麻豆

    1. <style id="76ofp"></style>

      <style id="76ofp"></style>
      <rt id="76ofp"></rt>
      <form id="76ofp"><optgroup id="76ofp"></optgroup></form>
      1. 千鋒教育-做有情懷、有良心、有品質(zhì)的職業(yè)教育機(jī)構(gòu)

        手機(jī)站
        千鋒教育

        千鋒學(xué)習(xí)站 | 隨時(shí)隨地免費(fèi)學(xué)

        千鋒教育

        掃一掃進(jìn)入千鋒手機(jī)站

        領(lǐng)取全套視頻
        千鋒教育

        關(guān)注千鋒學(xué)習(xí)站小程序
        隨時(shí)隨地免費(fèi)學(xué)習(xí)課程

        當(dāng)前位置:首頁  >  技術(shù)干貨  > s3dis詳解:從特點(diǎn)到應(yīng)用

        s3dis詳解:從特點(diǎn)到應(yīng)用

        來源:千鋒教育
        發(fā)布人:xqq
        時(shí)間: 2023-11-23 17:27:15 1700731635

        一、什么是s3dis

        s3dis,即Stanford Large-Scale 3D Indoor Spaces Dataset,是斯坦福大學(xué)發(fā)布的大規(guī)模室內(nèi)三維空間數(shù)據(jù)集。它包含了6個(gè)建筑物的室內(nèi)三維地圖和物體標(biāo)注數(shù)據(jù),其中每個(gè)建筑物的數(shù)據(jù)集都包含了數(shù)千個(gè)點(diǎn)云和高質(zhì)量的渲染圖像。s3dis提供了豐富的數(shù)據(jù)資源,被廣泛應(yīng)用于室內(nèi)場景分割、多視角圖像生成、室內(nèi)導(dǎo)航等方向的研究領(lǐng)域。

        二、s3dis的數(shù)據(jù)組成

        s3dis的數(shù)據(jù)集包含了6個(gè)建筑物的室內(nèi)空間,共計(jì)超過270萬點(diǎn)的點(diǎn)云數(shù)據(jù),以及高質(zhì)量的渲染圖像和物體標(biāo)注數(shù)據(jù)。其中包括了辦公室、教室、會(huì)議室、走廊、洗手間等常見室內(nèi)場景。在每個(gè)建筑物中,數(shù)據(jù)集以房間為單位進(jìn)行劃分,并標(biāo)注出了房間中的物體類型,如桌子、椅子、地毯等。 下面是s3dis數(shù)據(jù)集的一些統(tǒng)計(jì)信息:

        Building A: 4532 room scans
                    31 object categories
                    9 object instances
         
        Building B: 5063 room scans
                    27 object categories
                    4 object instances
         
        Building C: 5463 room scans
                    27 object categories
                    4 object instances
         
        Building D: 5117 room scans
                    27 object categories
                    4 object instances
         
        Building E: 5292 room scans
                    27 object categories
                    4 object instances
         
        Building F: 5117 room scans
                    27 object categories
                    4 object instances

        除了點(diǎn)云數(shù)據(jù)、渲染圖像和物體標(biāo)注數(shù)據(jù),s3dis還提供了每個(gè)物體在室內(nèi)的3D坐標(biāo)、旋轉(zhuǎn)角度和尺寸信息,這為室內(nèi)場景重建、物體識(shí)別提供了有力支撐。

        三、s3dis的應(yīng)用場景

        由于s3dis數(shù)據(jù)集具有真實(shí)、多樣、明確的標(biāo)注信息,因此在室內(nèi)場景分割、多視角圖像生成、室內(nèi)導(dǎo)航等領(lǐng)域得到了廣泛應(yīng)用。

        四、s3dis的使用示例

        1. 室內(nèi)場景分割

        在室內(nèi)場景分割方面,s3dis數(shù)據(jù)集被廣泛應(yīng)用。下面,我們通過使用s3dis數(shù)據(jù)集訓(xùn)練模型,實(shí)現(xiàn)一個(gè)室內(nèi)場景分割的樣例。我們使用tensorflow框架和pointnet++網(wǎng)絡(luò)結(jié)構(gòu)來實(shí)現(xiàn)場景分割。

        import numpy as np
        import tensorflow as tf
        import os
        import sys
        import time
        
        ## 定義pointnet++網(wǎng)絡(luò)結(jié)構(gòu)
        def pointnet2_ssg(inputs, is_training, bn_decay=None):
            # todo: add pointnet++ ssg
            return seg_pred
        
        ## 數(shù)據(jù)讀取
        def load_data(data_dir):
            # todo: load s3dis data
            return data, label
        
        if __name__ == '__main__':
            data_dir = 'data/s3dis'
            model_dir = 'model/s3dis'
            if not os.path.exists(model_dir):
                os.makedirs(model_dir)
        
            tf.reset_default_graph()
            pointclouds_pl = tf.placeholder(tf.float32, shape=(32, 4096, 6))
            labels_pl = tf.placeholder(tf.int32, shape=(32, 4096))
            is_training_pl = tf.placeholder(tf.bool, shape=())
        
            batch_size = 32
            num_point = 4096
            num_classes = 13
            learning_rate = 0.001
            max_epoch = 250
        
            with tf.device('/gpu:0'):
                logits = pointnet2_ssg(pointclouds_pl, is_training=is_training_pl, bn_decay=0.7)
                loss = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=labels_pl)
                loss = tf.reduce_mean(loss)
        
                tf.summary.scalar('loss', loss)
        
                if bn_decay is not None:
                    update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
                    with tf.control_dependencies(update_ops):
                        optimizer = tf.train.AdamOptimizer(learning_rate)
                        train_op = optimizer.minimize(loss)
        
            saver = tf.train.Saver()
        
            ## 數(shù)據(jù)讀取
            data, label = load_data(data_dir)
            num_data = data.shape[0]
        
            ## 開始訓(xùn)練
            with tf.Session() as sess:
                sess.run(tf.global_variables_initializer())
                file_writer = tf.summary.FileWriter('logs', sess.graph)
        
                for epoch in range(max_epoch):
                    idx = np.arange(num_data)
                    np.random.shuffle(idx)
                    total_loss = 0
        
                    ## 按批次進(jìn)行訓(xùn)練
                    for from_idx in range(0, num_data, batch_size):
                        to_idx = min(from_idx + batch_size, num_data)
                        batch_data = data[idx[from_idx:to_idx], :, :]
                        batch_label = label[idx[from_idx:to_idx], :]
        
                        ## 訓(xùn)練一個(gè)批次
                        _, batch_loss, batch_logits, summary = sess.run([train_op, loss, logits, merged_summary_op], feed_dict={
                            pointclouds_pl: batch_data,
                            labels_pl: batch_label,
                            is_training_pl: True
                        })
        
                        total_loss += batch_loss
        
                    print('Epoch %d, loss %.4f' % (epoch, total_loss))
        
                    ## 每十個(gè)epoch保存一次模型
                    if epoch % 10 == 0:
                        saver.save(sess, os.path.join(model_dir, 'model.ckpt'), global_step=epoch)
        

        2. 多視角圖像生成

        s3dis數(shù)據(jù)集包含了大量的高質(zhì)量渲染圖像,這為多視角圖像生成提供了有力支撐。下面,我們通過使用s3dis數(shù)據(jù)集中的渲染圖像,訓(xùn)練一個(gè)GAN網(wǎng)絡(luò)來生成室內(nèi)場景中的多視角圖像。

        ## 定義GAN網(wǎng)絡(luò)結(jié)構(gòu)
        def generator(inputs, is_training):
            # todo: add generator network
            return gen_output
        
        def discriminator(inputs, is_training):
            # todo: add discriminator network
            return dis_output
        
        ## 數(shù)據(jù)讀取
        def load_data(data_dir):
            # todo: load s3dis data
            return data, label, imgs
        
        if __name__ == '__main__':
            data_dir = 'data/s3dis'
            model_dir = 'model/s3dis'
            if not os.path.exists(model_dir):
                os.makedirs(model_dir)
        
            tf.reset_default_graph()
            z_ph = tf.placeholder(tf.float32, shape=(32, 100))
            img_ph = tf.placeholder(tf.float32, shape=(32, 224, 224, 3))
            is_training = tf.placeholder(tf.bool, shape=())
        
            ## 定義GAN網(wǎng)絡(luò)
            gen_output = generator(z_ph, is_training=is_training)
            dis_real = discriminator(img_ph, is_training=is_training)
            dis_fake = discriminator(gen_output, is_training=is_training, reuse=True)
        
            ## 定義損失函數(shù)
            d_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_real, labels=tf.ones_like(dis_real)))
            d_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake, labels=tf.zeros_like(dis_fake)))
            d_loss = d_loss_real + d_loss_fake
        
            g_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=dis_fake, labels=tf.ones_like(dis_fake)))
        
            tf.summary.scalar("d_loss", d_loss)
            tf.summary.scalar("g_loss", g_loss)
        
            ## 定義優(yōu)化器
            gen_vars = [var for var in tf.trainable_variables() if 'Generator' in var.name]
            dis_vars = [var for var in tf.trainable_variables() if 'Discriminator' in var.name]
        
            gan_optimizer = tf.train.AdamOptimizer(learning_rate=1e-4)
            dis_optimizer = tf.train.AdamOptimizer(learning_rate=2e-4)
            gen_optimizer = tf.train.AdamOptimizer(learning_rate=2e-4)
        
            gan_train = gan_optimizer.minimize(g_loss, var_list=gen_vars, global_step=tf.train.get_global_step())
            dis_train = dis_optimizer.minimize(d_loss, var_list=dis_vars, global_step=tf.train.get_global_step())
            gen_train = gen_optimizer.minimize(g_loss, var_list=gen_vars, global_step=tf.train.get_global_step())
        
            saver = tf.train.Saver()
        
            ## 數(shù)據(jù)讀取
            data, label, imgs = load_data(data_dir)
            num_data = data.shape[0]
        
            ## 開始訓(xùn)練
            with tf.Session() as sess:
                sess.run(tf.global_variables_initializer())
                file_writer = tf.summary.FileWriter('logs', sess.graph)
                merged_summary_op = tf.summary.merge_all()
        
                for epoch in range(max_epoch):
                    idx = np.arange(num_data)
                    np.random.shuffle(idx)
                    total_d_loss, total_g_loss = 0, 0
        
                    ## 按批次進(jìn)行訓(xùn)練
                    for from_idx in range(0, num_data, batch_size):
                        to_idx = min(from_idx + batch_size, num_data)
                        batch_z = np.random.normal(size=[batch_size, 100])
        
                        ## 訓(xùn)練判別器
                        _, batch_d_loss, summary = sess.run([dis_train, d_loss, merged_summary_op], feed_dict={
                            z_ph: batch_z,
                            img_ph: imgs[idx[from_idx:to_idx]],
                            is_training: True
                        })
                        total_d_loss += batch_d_loss
        
                        ## 訓(xùn)練生成器
                        _, batch_g_loss, summary = sess.run([gen_train, g_loss, merged_summary_op], feed_dict={
                            z_ph: batch_z,
                            is_training: True
                        })
                        total_g_loss += batch_g_loss
        
                    print('Epoch %d, d_loss %.4f, g_loss %.4f' % (epoch, total_d_loss, total_g_loss))
        
                    ## 每十個(gè)epoch保存一次模型
                    if epoch % 10 == 0:
                        saver.save(sess, os.path.join(model_dir, 'model.ckpt'), global_step=epoch)
        

        3. 室內(nèi)導(dǎo)航

        利用s3dis數(shù)據(jù)集,我們可以實(shí)現(xiàn)室內(nèi)導(dǎo)航系統(tǒng)。下面,我們通過使用s3dis數(shù)據(jù)集和強(qiáng)化學(xué)習(xí)算法,訓(xùn)練一個(gè)智能體來實(shí)現(xiàn)室內(nèi)導(dǎo)航。

        import numpy as np
        import tensorflow as tf
        import os
        import sys
        import time
        
        ## 定義DQN網(wǎng)絡(luò)結(jié)構(gòu)
        def DQN(state_ph, action_ph, is_training):
            # todo: add DQN network
            return Q
        
        ## 數(shù)據(jù)讀取
        def load_data(data_dir):
            # todo: load s3dis data
            return data, label, nav_path
        
        if __name__ == '__main__':
            data_dir = 'data/s3dis'
            model_dir = 'model/s3dis'
            if not os.path.exists(model_dir):
                os.makedirs(model_dir)
        
            tf.reset_default_graph()
            state_ph = tf.placeholder(tf.float32, shape=(None, 4096, 6))
            action_ph = tf.placeholder(tf.int32, shape=(None,))
            is_training = tf.placeholder(tf.bool, shape=())
        
            ## 定義DQN網(wǎng)絡(luò)
            Q = DQN(state_ph, action_ph, is_training=is_training)
        
            ## 定義損失函數(shù)和優(yōu)化器
            target_ph = tf.placeholder(tf.float32, shape=(None,))
            action_one_hot = tf.one_hot(action_ph, num_action)
            Q_pred = tf.reduce_sum(tf.multiply(Q, action_one_hot), axis=1)
            loss = tf.reduce_mean(tf.square(Q_pred - target_ph))
            optimizer = tf.train.AdamOptimizer(learning_rate=1e-3)
            train_op = optimizer.minimize(loss)
        
            saver = tf.train.Saver()
        
            ## 數(shù)據(jù)讀取
            data, label, nav_path = load_data(data_dir)
            num_data = data.shape[0]
        
            ## 開始訓(xùn)練
            with tf.Session() as sess:
                sess.run(tf.global_variables_initializer())
                file_writer = tf.summary.FileWriter('logs', sess.graph)
        
                for epoch in range(max_epoch):
                    idx = np.arange(num_data)
                    np.random.shuffle(idx)
                    total_loss = 0
        
                    ## 按批次進(jìn)行訓(xùn)練
                    for from_idx in range(0, num_data, batch_size):
                        to_idx = min(from_idx + batch_size, num_data)
                        batch_data = data[idx[from_idx:to_idx], :, :]
                        batch_nav_path = nav_path[idx[from_idx:to_idx], :, :]
        
                        ## 訓(xùn)練一個(gè)批次
                        Q_pred_ = sess.run(Q, feed_dict={
                            state_ph: batch_data,
                            is_training: False
                        })
        
                        ## 以一定的概率采取隨機(jī)            
        聲明:本站稿件版權(quán)均屬千鋒教育所有,未經(jīng)許可不得擅自轉(zhuǎn)載。
        10年以上業(yè)內(nèi)強(qiáng)師集結(jié),手把手帶你蛻變精英
        請您保持通訊暢通,專屬學(xué)習(xí)老師24小時(shí)內(nèi)將與您1V1溝通
        免費(fèi)領(lǐng)取
        今日已有369人領(lǐng)取成功
        劉同學(xué) 138****2860 剛剛成功領(lǐng)取
        王同學(xué) 131****2015 剛剛成功領(lǐng)取
        張同學(xué) 133****4652 剛剛成功領(lǐng)取
        李同學(xué) 135****8607 剛剛成功領(lǐng)取
        楊同學(xué) 132****5667 剛剛成功領(lǐng)取
        岳同學(xué) 134****6652 剛剛成功領(lǐng)取
        梁同學(xué) 157****2950 剛剛成功領(lǐng)取
        劉同學(xué) 189****1015 剛剛成功領(lǐng)取
        張同學(xué) 155****4678 剛剛成功領(lǐng)取
        鄒同學(xué) 139****2907 剛剛成功領(lǐng)取
        董同學(xué) 138****2867 剛剛成功領(lǐng)取
        周同學(xué) 136****3602 剛剛成功領(lǐng)取
        相關(guān)推薦HOT
        荃湾区| 武陟县| 顺平县| 出国| 怀集县| 中牟县| 霍林郭勒市| 岚皋县| 长海县| 承德市| 梓潼县| 敖汉旗| 延吉市| 天津市| 浑源县| 富蕴县| 洪湖市| 呼和浩特市| 武乡县| 区。| 镇江市| 铁力市| 华蓥市| 竹山县| 长葛市| 平顶山市| 郸城县| 通海县| 万全县| 儋州市| 塔河县| 长沙县| 中阳县| 巩留县| 霍山县| 双城市| 盐池县| 五台县| 台东县| 胶州市| 江山市|