Giter VIP home page Giter VIP logo

Comments (4)

xuelunshen avatar xuelunshen commented on September 26, 2024

@memon-aliraza
Sorry for reply your issue too late.
I think this may be a problem with the TensorFlow version.
I probably remember that this code was running around TensorFlow 1.2.
Would you like to decrease your version of TensorFlow and rerun it?

from h-net.

memon-aliraza avatar memon-aliraza commented on September 26, 2024

Hi. I tried several combinations but didn't work! I decided to re-write it in Keras. What is rate/probability did you assigned to dropout layers in the metric network?

from h-net.

xuelunshen avatar xuelunshen commented on September 26, 2024

@memon-aliraza

https://github.com/Xylon-Sean/H-Net/blob/05b4b30dd756059fff333e72add01c191a4e2b76/trainHNet.py#L189-L191

Looks like I used keep probability 1.0 in the training.

from h-net.

dylanrstewart avatar dylanrstewart commented on September 26, 2024

@memon-aliraza A bit late to the party here but you can fix your error by writing your training TFRecords like the Test data is written.

def createDataRecord_individual(out_folder, addrs):
    for i in range(len(addrs)):
        # open the TFRecords file
        fname = out_folder+str(i)+".tfrecords"
        writer = tf.io.TFRecordWriter(fname)
        
        # Load the image
        rgbIm, renIm, label = load_sample(addrs[i])

        # Create a feature
        feature = {
            "uds": _bytes_feature(renIm.tostring()),
            "label": _int64_feature(label),
            "photo": _bytes_feature(rgbIm.tostring())
        }
        # Create an example protocol buffer
        example = tf.train.Example(features=tf.train.Features(feature=feature))

        # Serialize to string and write on the file
        writer.write(example.SerializeToString())
        print("writing sample: ", fname)
        writer.close()
        sys.stdout.flush()


base_images_folder = "CrossDomainImage_processed/*.pickle"
# read addresses and labels from the 'train' folder
addrs = glob.glob(base_images_folder)
labels = [1 if "Match" in addr else -1 for addr in addrs]  # 0 = Cat, 1 = Dog

# to shuffle data
c = list(zip(addrs, labels))
shuffle(c)
addrs, labels = zip(*c)

# Divide the data into 60% train, 20% validation, and 20% test
train_addrs = addrs[0 : int(0.6 * len(addrs))]
val_addrs = addrs[int(0.6 * len(addrs)) : int(0.8 * len(addrs))]
test_addrs = addrs[int(0.8 * len(addrs)) :]

createDataRecord_individual("./baseTrainExample2/train/HNET_TRAIN_",train_addrs)
createDataRecord_individual("./baseTrainExample2/val/HNET_VAL_",val_addrs)
createDataRecord_individual("./baseTrainExample2/test/HNET_TEST_",test_addrs)

from h-net.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.